Makefile
changeset 4094 333c7cf842a7
parent 3994 7ed8945d7171
child 4113 f993487814cf
equal deleted inserted replaced
4093:7766d5a29957 4094:333c7cf842a7
   288 ifndef CXX_HOST
   288 ifndef CXX_HOST
   289 CXX_HOST = $(CXX)
   289 CXX_HOST = $(CXX)
   290 endif
   290 endif
   291 
   291 
   292 # Check if we have a new target
   292 # Check if we have a new target
   293 ifdef CXX_TARGET
   293 ifndef CXX_TARGET
   294 CXX = $(CXX_TARGET)
   294 CXX_TARGET = $(CXX_HOST)
   295 endif
   295 endif
   296 
   296 
   297 # Check if CC_HOST is defined. If not, it is CC
   297 # Check if CC_HOST is defined. If not, it is CC
   298 ifndef CC_HOST
   298 ifndef CC_HOST
   299 CC_HOST = $(CC)
   299 CC_HOST = $(CC)
   300 endif
   300 endif
       
   301 
   301 ifndef CFLAGS_HOST
   302 ifndef CFLAGS_HOST
   302 CFLAGS_HOST = $(BASECFLAGS)
   303 CFLAGS_HOST = $(BASECFLAGS)
   303 endif
   304 endif
   304 
   305 
   305 # Check if we have a new target
   306 # Check if we have a new target
   306 ifdef CC_TARGET
   307 ifndef CC_TARGET
   307 CC = $(CC_TARGET)
   308 CC_TARGET = $(CC_HOST)
   308 endif
   309 endif
   309 
   310 
   310 CC_VERSION = $(shell $(CC) -dumpversion | cut -c 1,3)
   311 CC_VERSION = $(shell $(CC) -dumpversion | cut -c 1,3)
   311 
   312 
   312 # GNU make can only test for (in)equality
   313 # GNU make can only test for (in)equality
   857 
   858 
   858 ifndef MACOSX_BUILD
   859 ifndef MACOSX_BUILD
   859 # OSX links in os/macosx/Makefile to handle universal binaries better
   860 # OSX links in os/macosx/Makefile to handle universal binaries better
   860 $(TTD): $(OBJS) $(MAKE_CONFIG)
   861 $(TTD): $(OBJS) $(MAKE_CONFIG)
   861 	@echo '===> Linking $@'
   862 	@echo '===> Linking $@'
   862 	$(Q)$(CXX) $(LDFLAGS) $(TTDLDFLAGS) $(OBJS) $(LIBS) -o $@
   863 	$(Q)$(CXX_TARGET) $(LDFLAGS) $(TTDLDFLAGS) $(OBJS) $(LIBS) -o $@
   863 endif
   864 endif
   864 
   865 
   865 $(STRGEN): strgen/strgen.c endian_host.h
   866 $(STRGEN): strgen/strgen.c endian_host.h
   866 	@echo '===> Compiling and Linking $@'
   867 	@echo '===> Compiling and Linking $@'
   867 	$(Q)$(CC_HOST) $(CFLAGS_HOST) $(CDEFS) $< -o $@
   868 	$(Q)$(CC_HOST) $(CFLAGS_HOST) $(CDEFS) $< -o $@
  1037 %.h:
  1038 %.h:
  1038 	@true
  1039 	@true
  1039 
  1040 
  1040 .deps/%.d: %.c $(MAKE_CONFIG) table/strings.h endian_target.h
  1041 .deps/%.d: %.c $(MAKE_CONFIG) table/strings.h endian_target.h
  1041 	@echo '===> DEP $<'
  1042 	@echo '===> DEP $<'
  1042 	$(Q)$(CC) $(CFLAGS) $(CDEFS) -MM $< | sed 's#^$(@F:%.d=%.o):#$@ $(@:.deps/%.d=%.o):#' > $@
  1043 	$(Q)$(CC_TARGET) $(CFLAGS) $(CDEFS) -MM $< | sed 's#^$(@F:%.d=%.o):#$@ $(@:.deps/%.d=%.o):#' > $@
  1043 
  1044 
  1044 .deps/%.d: %.cpp $(MAKE_CONFIG) table/strings.h endian_target.h
  1045 .deps/%.d: %.cpp $(MAKE_CONFIG) table/strings.h endian_target.h
  1045 	@echo '===> DEP $<'
  1046 	@echo '===> DEP $<'
  1046 	$(Q)$(CXX) $(CFLAGS) $(CDEFS) -MM $< | sed 's#^$(@F:%.d=%.o):#$@ $(@:.deps/%.d=%.o):#' > $@
  1047 	$(Q)$(CXX_TARGET) $(CFLAGS) $(CDEFS) -MM $< | sed 's#^$(@F:%.d=%.o):#$@ $(@:.deps/%.d=%.o):#' > $@
  1047 
  1048 
  1048 .deps/%.d: %.m $(MAKE_CONFIG) table/strings.h endian_target.h
  1049 .deps/%.d: %.m $(MAKE_CONFIG) table/strings.h endian_target.h
  1049 	@echo '===> DEP $<'
  1050 	@echo '===> DEP $<'
  1050 	$(Q)$(CC) $(OBJCFLAGS) $(CDEFS) -MM $< | sed 's#^$(@F:%.d=%.o):#$@ $(@:.deps/%.d=%.o):#' > $@
  1051 	$(Q)$(CC_TARGET) $(OBJCFLAGS) $(CDEFS) -MM $< | sed 's#^$(@F:%.d=%.o):#$@ $(@:.deps/%.d=%.o):#' > $@
  1051 
  1052 
  1052 
  1053 
  1053 ifndef MACOSX_BUILD
  1054 ifndef MACOSX_BUILD
  1054 # OSX uses os/macosx/Makefile to compile files
  1055 # OSX uses os/macosx/Makefile to compile files
  1055 %.o: %.c $(MAKE_CONFIG)
  1056 %.o: %.c $(MAKE_CONFIG)
  1056 	@echo '===> Compiling $<'
  1057 	@echo '===> Compiling $<'
  1057 	$(Q)$(CC) $(CC_CFLAGS) $(CFLAGS) $(CDEFS) -c -o $@ $<
  1058 	$(Q)$(CC_TARGET) $(CC_CFLAGS) $(CFLAGS) $(CDEFS) -c -o $@ $<
  1058 
  1059 
  1059 %.o: %.cpp  $(MAKE_CONFIG)
  1060 %.o: %.cpp  $(MAKE_CONFIG)
  1060 	@echo '===> Compiling $<'
  1061 	@echo '===> Compiling $<'
  1061 	$(Q)$(CXX) $(CFLAGS) $(CDEFS) -c -o $@ $<
  1062 	$(Q)$(CXX_TARGET) $(CFLAGS) $(CDEFS) -c -o $@ $<
  1062 
  1063 
  1063 %.o: %.m  $(MAKE_CONFIG)
  1064 %.o: %.m  $(MAKE_CONFIG)
  1064 	@echo '===> Compiling $<'
  1065 	@echo '===> Compiling $<'
  1065 	$(Q)$(CC) $(CC_CFLAGS) $(CFLAGS) $(CDEFS) -c -o $@ $<
  1066 	$(Q)$(CC_TARGET) $(CC_CFLAGS) $(CFLAGS) $(CDEFS) -c -o $@ $<
  1066 endif
  1067 endif
  1067 
  1068 
  1068 %.o: %.rc
  1069 %.o: %.rc
  1069 	@echo '===> Compiling resource $<'
  1070 	@echo '===> Compiling resource $<'
  1070 	$(Q)$(WINDRES) -o $@ $<
  1071 	$(Q)$(WINDRES) -o $@ $<