Rev 107 | Go to most recent revision | Blame | Last modification | View Log | RSS feed
#----------------------------------------------------------------------------
# Macros
#----------------------------------------------------------------------------
<%marker(top)%>
<%foreach(configurations)%>
CXX = <%cxx%>
<%if(ld)%>
LD = <%ld%>
<%else%>
LD = $(CXX) $(CCFLAGS) $(CPPFLAGS)
<%endif%>
AR = <%if(ar)%><%ar%><%else%>ar<%endif%>
<%if(nm)%>
NM = <%nm%>
<%endif%>
<%if(cputype)%>
CPUTYPE = <%cputype%>
<%endif%>
<%if(cpu)%>
CPU = <%cpu%>
<%endif%>
<%if(pic)%>
PICFLAGS = <%pic%>
<%endif%>
CPPFLAGS = $(PICFLAGS) $(GENFLAGS)<%if(compile_flags)%> <%compile_flags%><%endif%><%if(cpu)%> -DCPU=$(CPU)<%endif%><%if(tempincopt)%> <%tempincopt%>$(TEMPINCDIR)<%endif%><%if(compilerflags)%> <%compilerflags%><%endif%><%if(build64bit && compilerflags64)%> <%compilerflags64%><%endif%><%if(pch_source && pchsupport)%><%foreach(pch_defines)%> -D<%pch_define%><%endfor%><%endif%><%foreach(platforms)%><%if(extracppflags)%> <%extracppflags%><%endif%><%endfor%><%if(includes)%><%foreach(includes)%> -I"<%include%>"<%endfor%><%endif%><%if(macros)%><%foreach(macros)%> -D<%macro%><%endfor%><%endif%>
OBJEXT = <%obj_ext%>
OUTPUT_OPTION = <%output_option(-o \"$@\")%>
COMPILE.cc = $(CXX) $(CCFLAGS) $(CPPFLAGS) <%compile_option("-c")%>
<%foreach(platforms)%>
<%if(build64bit && arflags64)%>
ARFLAGS = <%if(extraarflags)%><%extraarflags%> <%endif%><%arflags64%>
<%else%>
<%if(arflags)%>
ARFLAGS = <%if(extraarflags)%><%extraarflags%> <%endif%><%arflags%>
<%endif%>
<%endif%>
<%endfor%>
<%if(tempinc)%>
TEMPINCDIR = <%tempinc%><%if(tempincopt)%><%slash%><%project_name%><%endif%>
<%endif%>
LDFLAGS =<%if(libpaths)%><%foreach(libpaths)%> -L"<%libpath%>"<%endfor%><%endif%><%if(linkflags)%> <%linkflags%><%endif%><%if(build64bit && linkflags64)%> <%linkflags64%><%endif%>
<%endfor%>
CCC = $(CXX)
MAKEFILE = <%project_file%>
DEPENDENCIES = .depend.$(MAKEFILE)
<%if(exename)%>
BTARGETDIR = <%if(install)%><%install%><%else%>.<%endif%><%slash%><%targetoutdir%>
BIN = $(BTARGETDIR)<%exename%>$(EXEEXT)
<%else%>
LTARGETDIR = <%libout%><%slash%><%targetoutdir%>
<%endif%>
<%foreach(configurations)%>
<%foreach(platforms)%>
RM = <%delete("rm -rf")%>
CP = <%copy("cp -p")%>
NUL = <%devnull("/dev/null")%>
MKDIR = <%makedir("mkdir -p")%>
EXEEXT = <%exe_ext%>
LIBPREFIX = <%lib_prefix%><%libname_prefix%>
LDLIBS =<%foreach(libs)%> <%libopt%>"<%libname_prefix%><%lib%>"<%endfor%><%foreach(lit_libs)%> <%libopt%>"<%lit_lib%>"<%endfor%><%foreach(pure_libs)%> "<%pure_lib%>"<%endfor%> <%ldlibs%>
OBJS =<%if(pch_source && pchsupport)%> <%targetoutdir%><%noextension(pch_source)%>$(OBJEXT)<%endif%><%foreach(source_files)%> <%targetoutdir%><%noextension(source_file)%>$(OBJEXT)<%endfor%><%if(rc)%><%foreach(resource_files)%> <%targetoutdir%><%resource_file%>$(OBJEXT)<%endfor%><%endif%>
<%if(lib_ext)%>
<%if(staticname)%>
AREXT = <%lib_ext%>
LIB = $(LTARGETDIR)$(LIBPREFIX)<%staticname%>$(AREXT)
<%endif%>
<%endif%>
<%if(dll_ext)%>
<%if(sharedname)%>
SOEXT = <%dll_ext%>
SHTARGETDIR = <%if(dllout)%><%dllout%><%else%><%libout%><%endif%><%slash%><%targetoutdir%>
SHLIB = $(SHTARGETDIR)$(LIBPREFIX)<%sharedname%>$(SOEXT)
<%if(shflags)%>
SHFLAGS = <%shflags%>
<%endif%>
<%endif%>
<%endif%>
<%endfor%>
<%endfor%>
GENFLAGS = <%genflags(-g)%>
SRC =<%if(pch_source && pchsupport)%> <%pch_source%><%endif%> <%source_files%>
LINK.cc = $(LD) $(LDFLAGS)
<%if(dynamicflags)%>
DYNAMICFLAGS =<%foreach(dynamicflags)%> -D<%dynamicflag%><%endfor%>
<%endif%>
<%if(staticflags)%>
STATICFLAGS =<%foreach(staticflags)%> -D<%staticflag%><%endfor%>
<%endif%>
EXPORTFLAGS = <%if(exename)%><%if(need_staticflags)%>$(STATICFLAGS)<%endif%><%else%><%foreach(configurations)%><%foreach(platforms)%><%if(dll_ext && sharedname)%>$(DYNAMICFLAGS)<%else%>$(STATICFLAGS)<%endif%><%endfor%><%endfor%><%endif%>
<%marker(macros)%>
#----------------------------------------------------------------------------
# Local targets
#----------------------------------------------------------------------------
<%if(exename)%>
all: $(BIN)<%if(postbuild)%> __postbuild__<%endif%>
<%foreach(configurations)%>
<%foreach(platforms)%>
<%if(specialscript)%>
specialscript:
@echo '<%specialscript%>' > specialscript
@chmod 755 specialscript
<%endif%>
<%if(prelink)%>
<%prelink%>: specialscript $(OBJS)
@.<%slash%>specialscript $(NM) "$(OBJS)" "$(LDLIBS)" "<%if(libpaths)%><%libpaths%><%else%>.<%endif%>" <%prelink%>
@$(RM) specialscript
<%targetoutdir%><%noextension(prelink)%>$(OBJEXT): <%prelink%>
$(COMPILE.cc) $(OUTPUT_OPTION) <%prelink%>
@$(RM) <%prelink%>
<%endif%>
<%endfor%>
<%endfor%>
$(BTARGETDIR):
@$(MKDIR) "$@"
$(BIN): $(BTARGETDIR)<%foreach(configurations)%><%if(tempinc)%> $(TEMPINCDIR)<%endif%><%foreach(platforms)%><%if(prelink)%> <%targetoutdir%><%noextension(prelink)%>$(OBJEXT)<%endif%><%endfor%><%endfor%> $(OBJS)
$(LINK.cc) $(OUTPUT_OPTION) $(OBJS) $(LDLIBS)
<%else%>
$(LTARGETDIR):
@$(MKDIR) "$@"
<%endif%>
<%foreach(configurations)%>
<%foreach(platforms)%>
<%if(dll_ext)%>
<%if(sharedname)%>
all: $(SHLIB)<%if(postbuild)%> __postbuild__<%endif%>
<%if(dllout)%>
$(SHTARGETDIR):
@$(MKDIR) "$@"
<%endif%>
$(SHLIB): $(SHTARGETDIR) <%foreach(configurations)%><%if(tempinc)%>$(TEMPINCDIR) <%endif%><%endfor%>$(OBJS)
<%foreach(configurations)%><%foreach(platforms)%><%if(dld)%><%dld%> $(LDFLAGS)<%else%>$(LINK.cc)<%endif%><%endfor%><%endfor%> $(SHFLAGS) $(OUTPUT_OPTION) $(OBJS) $(LDLIBS)
<%else%>
<%if(staticname)%>
all: $(LIB)<%if(postbuild)%> __postbuild__<%endif%>
<%endif%>
<%endif%>
<%else%>
<%if(staticname)%>
all: $(LIB)<%if(postbuild)%> __postbuild__<%endif%>
<%endif%>
<%endif%>
<%endfor%>
<%endfor%>
<%if(staticname)%>
$(LIB): $(LTARGETDIR) <%foreach(configurations)%><%if(tempinc)%>$(TEMPINCDIR) <%endif%><%endfor%>$(OBJS)
<%foreach(configurations)%>
<%foreach(platforms)%>
$(AR) $(ARFLAGS) $(LIB) $(OBJS)<%if(tempinc)%> `find $(TEMPINCDIR) -name \*.o\*`<%endif%>
<%if(ranlib)%>
ranlib $(LIB)
<%endif%>
<%endfor%>
<%endfor%>
<%endif%>
<%if(custom_types)%>
GENERATED_DIRTY =<%foreach(custom_types)%><%foreach(custom_type->input_files)%><%if(custom_type->input_file->output_files)%><%foreach(custom_type->input_file->output_files)%> <%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%><%slash%><%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%><%endfor%><%endif%><%endfor%><%endfor%>
<%foreach(custom_types)%>
<%if(custom_type->libpath)%>
# These may be needed, but some versions of make do not accept this syntax
#DYLD_LIBRARY_PATH := $(DYLD_LIBRARY_PATH):<%custom_type->libpath%>
#LD_LIBRARY_PATH := $(LD_LIBRARY_PATH):<%custom_type->libpath%>
#SHLIB_PATH := $(SHLIB_PATH):<%custom_type->libpath%>
#LIBPATH := $(LIBPATH):<%custom_type->libpath%>
#PATH := $(PATH):<%custom_type->libpath%>
<%endif%>
<%foreach(custom_type->input_files)%>
<%if(custom_type->input_file->output_files)%>
<%foreach(custom_type->input_file->output_files)%><%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%><%slash%><%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%><%fornotlast(" ")%><%endfor%>: <%custom_type->input_file%><%if(custom_type->input_file->dependencies)%> <%custom_type->input_file->dependencies%><%endif%><%if(flag_overrides(custom_type->input_file, dependent))%> <%flag_overrides(custom_type->input_file, dependent)%><%else%><%if(custom_type->dependent)%> <%custom_type->dependent%><%endif%><%endif%>
<%if(flag_overrides(custom_type->input_file, gendir))%>
@$(MKDIR) <%flag_overrides(custom_type->input_file, gendir)%>
<%endif%>
<%if(flag_overrides(custom_type->input_file, command))%><%flag_overrides(custom_type->input_file, command)%><%else%><%custom_type->command%><%endif%> <%if(flag_overrides(custom_type->input_file, commandflags))%><%flag_overrides(custom_type->input_file, commandflags)%><%else%><%custom_type->commandflags%><%endif%><%if(custom_type->output_option)%> <%custom_type->output_option%> "$@"<%endif%> <%custom_type->input_file%>
<%if(flag_overrides(custom_type->input_file, postcommand))%>
<%foreach(custom_type->input_file)%>
<%flag_overrides(custom_type->input_file, postcommand)%>
<%endfor%>
<%else%>
<%if(custom_type->postcommand)%>
<%foreach(custom_type->input_file)%>
<%custom_type->postcommand%>
<%endfor%>
<%endif%>
<%endif%>
<%if(pch_header)%>
<%if(custom_type->pch_postrule)%>
<%foreach(custom_type->input_file->source_output_files)%>
@echo '#include "<%pch_header%>"' > temp.$$$$ && cat <%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%><%slash%><%basename(custom_type->input_file->source_output_file)%><%else%><%custom_type->input_file->source_output_file%><%endif%> >> temp.$$$$ && mv temp.$$$$ <%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%><%slash%><%basename(custom_type->input_file->source_output_file)%><%else%><%custom_type->input_file->source_output_file%><%endif%>
<%endfor%>
<%endif%>
<%endif%>
<%endif%>
<%endfor%>
<%endfor%>
.PRECIOUS: $(GENERATED_DIRTY)
<%if(source_files)%>
$(OBJS): $(GENERATED_DIRTY)
<%else%>
all: $(GENERATED_DIRTY)<%if(postbuild)%> __postbuild__<%endif%>
<%endif%>
<%endif%>
generated: $(GENERATED_DIRTY)
@-:
<%foreach(configurations)%>
<%if(tempinc)%>
$(TEMPINCDIR):
@-test -d $(TEMPINCDIR) || $(MKDIR) $(TEMPINCDIR) 2> $(NUL) || true
<%endif%>
<%if(pch_source && pchsupport)%>
<%targetoutdir%><%noextension(pch_source)%>$(OBJEXT): <%pch_source%>
$(COMPILE.cc) <%if(pchcreate)%><%pchcreate%><%targetoutdir%><%pch_header%>.gch <%endif%>$(EXPORTFLAGS)<%if(!pchnobj)%> $(OUTPUT_OPTION)<%endif%> <%pch_source%>
<%if(pchnobj)%>
@$(CP) <%pch_header%>.gch <%targetoutdir%><%noextension(pch_source)%>$(OBJEXT)
<%endif%>
<%endif%>
<%foreach(source_files)%>
<%targetoutdir%><%noextension(source_file)%>$(OBJEXT): <%source_file%>
<%if(targetoutdir)%>
@$(MKDIR) <%targetoutdir%><%dirname(source_file)%>
<%endif%>
$(COMPILE.cc) <%if(pchuse && pch_source && pchsupport)%><%pchuse%><%pch_header%>.gch <%endif%>$(EXPORTFLAGS) $(OUTPUT_OPTION) <%source_file%>
<%endfor%>
<%endfor%>
<%if(resource_files)%>
<%foreach(platforms)%>
<%if(rc)%>
<%foreach(resource_files)%>
<%targetoutdir%><%resource_file%>$(OBJEXT):
<%rc%><%foreach(includes)%> -I<%include%><%endfor%> <%resource_file%> <%targetoutdir%><%resource_file%>$(OBJEXT)
<%endfor%>
<%endif%>
<%endfor%>
<%endif%>
clean:
-$(RM) $(OBJS)<%if(pch_source && pchsupport)%> <%pch_header%>.gch<%endif%>
<%foreach(configurations)%>
<%if(clean)%>
-$(RM) <%clean%>
<%endif%>
<%endfor%>
realclean: clean
-$(RM) <%if(exename)%>$(BIN)<%else%>$(SHLIB) $(LIB)<%endif%>
<%if(custom_types)%>
-$(RM) $(GENERATED_DIRTY)
<%endif%>
<%if(postbuild)%>
__postbuild__:
@<%eval(postbuild)%>
<%endif%>
<%marker(local)%>
#----------------------------------------------------------------------------
# Dependencies
#----------------------------------------------------------------------------
$(DEPENDENCIES):
@touch $(DEPENDENCIES)
depend:
<%if(source_files || pch_source)%>
-<%depgen("makedepend -Y")%> $(CFLAGS) $(CCFLAGS) $(CPPFLAGS) -f $(DEPENDENCIES) $(SRC) 2> $(NUL)
<%else%>
@-:
<%endif%>
include $(DEPENDENCIES)
<%marker(bottom)%>