# Makefile for building #$ Expand("TARGET")
# Generated by tmake at #$ Now();
#     Project: #$ Expand("PROJECT");
#    Template: #$ Expand("TEMPLATE");
#############################################################################

####### Compiler, tools and options

CC	=	#$ Expand("TMAKE_CC");
CXX	=	#$ Expand("TMAKE_CXX");
CFLAGS	=	#$ Expand("TMAKE_CFLAGS"); 
CXXFLAGS=	#$ Expand("TMAKE_CXXFLAGS");
INCPATH	=	#$ Expand('TMAKE_INCPATH');
#$ Config("staticlib") && DisableOutput();
LINK	=	#$ Expand("TMAKE_LINK");
LFLAGS	=	#$ Expand("TMAKE_LFLAGS");
LIBS	=	#$ Expand("TMAKE_LIBDIR_FLAGS"); Expand("TMAKE_LIBS");
#$ Config("staticlib") && EnableOutput();
#$ Project("TMAKE_LIB_FLAG") || DisableOutput();
#$ ExpandGlue("TMAKE_AR","AR\t\t=\t"," ","");
#$ ExpandGlue("TMAKE_LIB","LIBRARY\t=\t"," ","");
#$ ExpandGlue("TMAKE_RANLIB","RANLIB\t=\t"," ","");
#$ Project("TMAKE_LIB_FLAG") || EnableOutput();
MOC	=	#$ Expand("TMAKE_MOC");
UIC	=	#$ Expand("TMAKE_UIC");
REMOVE	=	#$ Expand("TMAKE_REMOVE");
#$ ExpandGlue("TMAKE_RMDIR","RMDIR\t=\t"," ","");
#$ ExpandGlue("TMAKE_TAR","TAR\t=\t"," ","");
#$ ExpandGlue("TMAKE_GZIP","GZIP\t=\t"," ","");
#$ ExpandGlue("TMAKE_ZIP","ZIP\t=\t"," ","");

####### Files

HEADERS =	#$ ExpandList("HEADERS");
SOURCES =	#$ ExpandList("SOURCES");
OBJECTS =	#$ ExpandList("OBJECTS");
INTERFACES =	#$ ExpandList("INTERFACES");
UICDECLS =	#$ ExpandList("UICDECLS");
UICIMPLS =	#$ ExpandList("UICIMPLS");
SRCMOC	=	#$ ExpandList("SRCMOC");
OBJMOC	=	#$ ExpandList("OBJMOC");
DIST	=	#$ ExpandList("DISTFILES");
TARGET	=	#$ Expand("TARGET");
#$ ExpandGlue("TARGETA", "TARGETA\t=\t","","");
#$ ExpandGlue("INTERFACE_DECL_PATH", "INTERFACE_DECL_PATH = ","","");
#$ Expand("TMAKE_MAKE_HEADER");

#$ Project("TMAKE_RUN_CXX_IMP") || DisableOutput();
####### Implicit rules

.SUFFIXES: .cpp .cxx .cc .C .c

.cpp#$ ExpandGlue('OBJ_EXT',".","",":");
	$(CXX) -c $(CXXFLAGS) $(INCPATH) #$ Expand('OBJ_IMPL_OUT');

.cxx#$ ExpandGlue('OBJ_EXT',".","",":");
	$(CXX) -c $(CXXFLAGS) $(INCPATH) #$ Expand('OBJ_IMPL_OUT');

.cc#$ ExpandGlue('OBJ_EXT',".","",":");
	$(CXX) -c $(CXXFLAGS) $(INCPATH) #$ Expand('OBJ_IMPL_OUT');

.C#$ ExpandGlue('OBJ_EXT',".","",":");
	$(CXX) -c $(CXXFLAGS) $(INCPATH) #$ Expand('OBJ_IMPL_OUT');

.c#$ ExpandGlue('OBJ_EXT',".","",":");
	$(CC) -c $(CFLAGS) $(INCPATH) #$ Expand('OBJ_IMPL_OUT');

#$ Project("TMAKE_RUN_CXX_IMP") || EnableOutput();
####### Build rules

#${
	if ( Project("SUBLIBS") ) {
	    $text = "SUBLIBS=";
	    for $m ( split / /, Project("SUBLIBS") ) {
		$text .= "tmp/lib$m.a ";
	    }
	    $text .= "\n";
	}
#$}

all: #$ ExpandGlue("ALL_DEPS",""," "," "); $text .= '$(TARGET)';

$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) #$ Expand("TARGETDEPS");
	$(REMOVE) $(TARGET) #$ Expand("TARGET_VERSIONS");
	#$ Expand('TMAKE_BLD_CMD');
	#$ $ln_t = "-ln -s ".$project{'TARGET_SONAME'}." "; ExpandGlue("TARGET_VERSIONS",$ln_t,"\n\t".$ln_t,"\n");

#$ Project('TARGETA') || DisableOutput();
staticlib: $(TARGETA)

$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC) #$ Expand("TARGETDEPS");
	$(REMOVE) $(TARGETA)
	#$ Expand("TMAKE_LIBA_CMD");
   
#$ Project('TARGETA') || EnableOutput();
moc: $(SRCMOC)

#$ TmakeSelf();

dist:
	$(REMOVE) Makefile #$ Expand('TMAKE_DIST_FILES');

clean:
	$(REMOVE) $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
#$ Project('TARGET_VERSIONS') || DisableOutput();
	$(REMOVE) #$ Expand('TARGET_VERSIONS');
#$ Project('TARGET_VERSIONS') || EnableOutput();
#$ ExpandGlue("TMAKE_CLEAN","\t\$(REMOVE) "," ","\n");
#$ ExpandGlue("CLEAN_FILES","\t\$(REMOVE) "," ","\n");
#$ ExpandGlue("CLEAN_DIRS","\t\$(RMDIR) "," ","");

#$ Project("SUBLIBS") || DisableOutput();
####### Sub-libraries

#${
	if ( Project("SUBLIBS") ) {
	    for $m ( split / /, Project("SUBLIBS") ) {
		$text .= "tmp/lib$m.a:\n\t";
		$text .= $project{"MAKELIB$m"}."\n";
	    }
	}
#$}

#$ Project("SUBLIBS") || EnableOutput();
#$ Config("embedded") && Project("PRECOMPH") || DisableOutput();
###### Combined headers

#${
	if ( Config("embedded") && Project("PRECOMPH") ) {
	    $t = "allmoc.cpp: ".Project("PRECOMPH")." ".$original_HEADERS;
	    ExpandList("HEADERS_ORIG");
	    $t.= $text;
	    $t.= "\n\techo '#include \"".Project("PRECOMPH")."\"' >allmoc.cpp";
	    $t.= "\n\t\$(CXX) -E -DQT_MOC_CPP \$(CXXFLAGS) \$(INCPATH) >allmoc.h allmoc.cpp";
	    $t.= "\n\t\$(MOC) -o allmoc.cpp allmoc.h";
	    $t.= "\n\tperl -pi -e 's{\"allmoc.h\"}{\"".Project("PRECOMPH")."\"}' allmoc.cpp";
	    $t.= "\n\trm allmoc.h";
	    $t.= "\n";
	    $text = $t;
	}
#$}
#$ Config("embedded") && Project("PRECOMPH") || EnableOutput();

####### Compile

#$ BuildObj(Project("OBJECTS"),Project("SOURCES"));
#$ BuildUicSrc(Project("INTERFACES"));
#$ BuildObj(Project("UICOBJECTS"), Project("UICIMPLS"));
#$ BuildMocObj(Project("OBJMOC"),Project("SRCMOC"));
#$ BuildMocSrc(Project("HEADERS"));
#$ BuildMocSrc(Project("SOURCES"));
#$ BuildMocSrc( Project("UICDECLS"));
