Makefile
changeset 1118 9156318143d5
parent 1115 55b99683ce51
child 1119 44a402ca7c01
equal deleted inserted replaced
1117:1ed343e9a2b0 1118:9156318143d5
   174 #USE_HOMEDIR:=1
   174 #USE_HOMEDIR:=1
   175 
   175 
   176 -include $(LIB_DETECTION)
   176 -include $(LIB_DETECTION)
   177 endif
   177 endif
   178 
   178 
   179 # Verbose filter
       
   180 
       
   181 ifdef NOVERBOSE
       
   182 VERBOSE_FILTER =  >/dev/null 2>&1
       
   183 else
       
   184 VERBOSE_FILTER =
       
   185 endif
       
   186 
       
   187 ifdef DISPLAY_WARNINGS
   179 ifdef DISPLAY_WARNINGS
   188 WARNING_DISPLAY:=-fstrict-aliasing
   180 WARNING_DISPLAY:=-fstrict-aliasing
   189 VERBOSE_FILTER =
       
   190 else
   181 else
   191 WARNING_DISPLAY:=-fno-strict-aliasing
   182 WARNING_DISPLAY:=-fno-strict-aliasing
   192 endif
   183 endif
   193 
   184 
   194 ifdef SUPRESS_LANG_ERRORS
   185 ifdef SUPRESS_LANG_ERRORS
   195 ifndef VERBOSE_FILTER
       
   196 LANG_ERRORS =  >/dev/null 2>&1
   186 LANG_ERRORS =  >/dev/null 2>&1
   197 endif
       
   198 endif
   187 endif
   199 
   188 
   200 ifdef STATIC
   189 ifdef STATIC
   201 ifndef WIN32
   190 ifndef WIN32
   202 ifndef OSX
   191 ifndef OSX
   719 
   708 
   720 
   709 
   721 all: endian.h $(UPDATECONFIG) $(LANGS) $(TTD) $(OSX) $(endwarnings)
   710 all: endian.h $(UPDATECONFIG) $(LANGS) $(TTD) $(OSX) $(endwarnings)
   722 
   711 
   723 endian.h: $(ENDIAN_CHECK)
   712 endian.h: $(ENDIAN_CHECK)
   724 	@# Check if system is LITTLE_ENDIAN or BIG_ENDIAN
   713 	@echo '===> Testing endianness'
   725 	@echo 'Running endian_check'; \
   714 	@./$(ENDIAN_CHECK) > $@
   726 		./$(ENDIAN_CHECK) > $@
       
   727 
   715 
   728 $(ENDIAN_CHECK): endian_check.c
   716 $(ENDIAN_CHECK): endian_check.c
   729 	@echo 'Compiling and Linking $@'; \
   717 	@echo '===> Compiling and Linking $@'
   730 		$(CC) $(BASECFLAGS) $(CDEFS) endian_check.c -o $@
   718 	@$(CC) $(BASECFLAGS) $(CDEFS) endian_check.c -o $@
   731 
   719 
   732 
   720 
   733 $(TTD): table/strings.h $(ttd_OBJS) $(MAKE_CONFIG)
   721 $(TTD): table/strings.h $(ttd_OBJS) $(MAKE_CONFIG)
   734 	$(if $(VERBOSE),@echo '$(C_LINK) $@ $(TTDLDFLAGS) $(ttd_OBJS) $(LIBS)';,@echo 'Compiling and Linking $@';) \
   722 	@echo '===> Linking $@'
   735  		$(C_LINK) $@ $(TTDLDFLAGS) $(ttd_OBJS) $(LIBS) $(VERBOSE_FILTER)
   723 	@$(if $(VERBOSE), echo '$(C_LINK) $@ $(TTDLDFLAGS) $(ttd_OBJS) $(LIBS)')
       
   724 	@$(C_LINK) $@ $(TTDLDFLAGS) $(ttd_OBJS) $(LIBS)
   736 
   725 
   737 $(OSX): $(TTD)
   726 $(OSX): $(TTD)
   738 	@rm -fr "$(OSXAPP)"
   727 	@rm -fr "$(OSXAPP)"
   739 	@mkdir -p "$(OSXAPP)"/Contents/MacOS
   728 	@mkdir -p "$(OSXAPP)"/Contents/MacOS
   740 	@mkdir -p "$(OSXAPP)"/Contents/Resources
   729 	@mkdir -p "$(OSXAPP)"/Contents/Resources
   756 $(64_bit_warnings):
   745 $(64_bit_warnings):
   757 	$(warning 64 bit CPUs will get some 64 bit specific bugs!)
   746 	$(warning 64 bit CPUs will get some 64 bit specific bugs!)
   758 	$(warning If you see any bugs, include in your bug report that you use a 64 bit CPU)
   747 	$(warning If you see any bugs, include in your bug report that you use a 64 bit CPU)
   759 
   748 
   760 $(STRGEN): strgen/strgen.c endian.h
   749 $(STRGEN): strgen/strgen.c endian.h
   761 	@echo 'Compiling and Linking $@'; \
   750 	@echo '===> Compiling and Linking $@'
   762 		$(CC) $(BASECFLAGS) $(CDEFS) -o $@ $< $(VERBOSE_FILTER)
   751 	@$(CC) $(BASECFLAGS) $(CDEFS) -o $@ $<
   763 
   752 
   764 table/strings.h: lang/english.txt $(STRGEN)
   753 table/strings.h: lang/english.txt $(STRGEN)
   765 	@echo 'Generating $@'; \
   754 	@echo '===> Generating $@'
   766 	$(STRGEN)
   755 	@$(STRGEN)
   767 
   756 
   768 lang/%.lng: lang/%.txt $(STRGEN) lang/english.txt
   757 lang/%.lng: lang/%.txt $(STRGEN) lang/english.txt
   769 	@echo 'Generating $@'; \
   758 	@echo '===> Compiling language $(*F)'
   770 	$(STRGEN) $(STRGEN_FLAGS) $< $(VERBOSE_FILTER) $(LANG_ERRORS)
   759 	@$(STRGEN) $(STRGEN_FLAGS) $< $(LANG_ERRORS)
   771 
   760 
   772 winres.o: ttd.rc
   761 winres.o: ttd.rc
   773 	windres -o $@ $<
   762 	@echo '===> Compiling resource $<'
       
   763 	@windres -o $@ $<
   774 
   764 
   775 ifdef MORPHOS
   765 ifdef MORPHOS
   776 release: all
   766 release: all
   777 	@rm -fr "/t/openttd-$(RELEASE)-morphos.lha"
   767 	@rm -fr "/t/openttd-$(RELEASE)-morphos.lha"
   778 	@mkdir -p "/t/"
   768 	@mkdir -p "/t/"
   853 
   843 
   854 FORCE:
   844 FORCE:
   855 
   845 
   856 
   846 
   857 clean:
   847 clean:
   858 	@echo 'Cleaning up...'; \
   848 	@echo '===> Cleaning up'
   859 	rm -rf .deps *~ $(TTD) $(STRGEN) core table/strings.h $(LANGS) $(ttd_OBJS) endian.h $(ENDIAN_CHECK)
   849 	@rm -rf .deps *~ $(TTD) $(STRGEN) core table/strings.h $(LANGS) $(ttd_OBJS) endian.h $(ENDIAN_CHECK)
   860 
   850 
   861 mrproper: clean
   851 mrproper: clean
   862 	rm -rf $(MAKE_CONFIG)
   852 	@rm -rf $(MAKE_CONFIG)
   863 
   853 
   864 ifndef OSX
   854 ifndef OSX
   865 ifndef MORPHOS
   855 ifndef MORPHOS
   866 install:
   856 install:
   867 ifeq ($(INSTALL),)
   857 ifeq ($(INSTALL),)
   913 
   903 
   914 
   904 
   915 # Export all variables set to subprocesses (a bit dirty)
   905 # Export all variables set to subprocesses (a bit dirty)
   916 .EXPORT_ALL_VARIABLES:
   906 .EXPORT_ALL_VARIABLES:
   917 upgradeconf: $(MAKE_CONFIG)
   907 upgradeconf: $(MAKE_CONFIG)
   918 	rm $(MAKE_CONFIG)
   908 	@rm $(MAKE_CONFIG)
   919 	$(MAKE) $(MAKE_CONFIG)
   909 	@$(MAKE) $(MAKE_CONFIG)
   920 
   910 
   921 .PHONY: upgradeconf
   911 .PHONY: upgradeconf
   922 
   912 
   923 
   913 
   924 ### Internal build rules
   914 ### Internal build rules
   932 # This compiles the object file as well as silently updating its dependencies
   922 # This compiles the object file as well as silently updating its dependencies
   933 # list at the same time. It is not an issue that they aren't around during the
   923 # list at the same time. It is not an issue that they aren't around during the
   934 # first compilation round as we just build everything at that time anyway,
   924 # first compilation round as we just build everything at that time anyway,
   935 # therefore we do not need to watch deps.
   925 # therefore we do not need to watch deps.
   936 
   926 
   937 #@echo '$(C_BUILD) $<'; \
       
   938 
       
   939 
   927 
   940 %.o: %.c $(MAKE_CONFIG) endian.h table/strings.h
   928 %.o: %.c $(MAKE_CONFIG) endian.h table/strings.h
   941 	$(if $(VERBOSE),@echo '$(C_BUILD) $<',@echo 'Compiling $(*F).o'); \
   929 	@echo '===> Compiling $<'
   942 		       $(C_BUILD) $< -Wp,-MD,.deps/$(*F).pp $(VERBOSE_FILTER)
   930 	@$(if $(VERBOSE), echo '$(C_BUILD) $<')
       
   931 	@$(C_BUILD) $< -Wp,-MD,.deps/$(*F).pp
   943 	@-cp .deps/$(*F).pp .deps/$(*F).P; \
   932 	@-cp .deps/$(*F).pp .deps/$(*F).P; \
   944 		tr ' ' '\012' < .deps/$(*F).pp \
   933 		tr ' ' '\012' < .deps/$(*F).pp \
   945 		| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
   934 		| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
   946 		>> .deps/$(*F).P; \
   935 		>> .deps/$(*F).P; \
   947 	rm .deps/$(*F).pp
   936 	rm .deps/$(*F).pp
   948 
   937 
   949 # For DirectMusic build and BeOS specific parts
   938 # For DirectMusic build and BeOS specific parts
   950 %.o: %.cpp  $(MAKE_CONFIG) endian.h table/strings.h
   939 %.o: %.cpp  $(MAKE_CONFIG) endian.h table/strings.h
   951 	$(CXX_BUILD) $< -o $@
   940 	@echo '===> Compiling $<
       
   941 	@$(CXX_BUILD) $< -o $@