Makefile
changeset 1692 2587eee1c632
parent 1629 79d88b84df1b
child 1693 e3a6eedee876
equal deleted inserted replaced
1691:fcd9fefaed02 1692:2587eee1c632
   105 # CYGWIN: build in Cygwin environment
   105 # CYGWIN: build in Cygwin environment
   106 # MINGW: build with MingW compiler, link with MingW libraries
   106 # MINGW: build with MingW compiler, link with MingW libraries
   107 #
   107 #
   108 # VERBOSE: show full compiler invocations instead of brief progress messages
   108 # VERBOSE: show full compiler invocations instead of brief progress messages
   109 #
   109 #
       
   110 # Special for crosscompiling there are some commands available:
       
   111 #
       
   112 # ENDIAN_FORCE: forces the endian-check to give a certain result. Can be either BE or LE.
       
   113 # WINDRES: the location of your windres
       
   114 # CC_HOST: the gcc of your localhost if you are making a target that produces incompatible executables
       
   115 # CFLAGS_HOST: cflags used for CC_HOST. Make it something if you are getting errors when you try to compi
       
   116 #		windows executables on linux. (just: CFLAGS_HOST:='-I' or something)
       
   117 #
   110 # Experimental (does not work properly):
   118 # Experimental (does not work properly):
   111 # WITH_DIRECTMUSIC: enable DirectMusic MIDI support
   119 # WITH_DIRECTMUSIC: enable DirectMusic MIDI support
   112 
   120 
   113 
   121 
   114 ##############################################################################
   122 ##############################################################################
   117 #
   125 #
   118 
   126 
   119 
   127 
   120 # Makefile version tag
   128 # Makefile version tag
   121 # it checks if the version tag in Makefile.config is the same and force update outdated config files
   129 # it checks if the version tag in Makefile.config is the same and force update outdated config files
   122 MAKEFILE_VERSION:=6
   130 MAKEFILE_VERSION:=7
   123 
   131 
   124 # CONFIG_WRITER has to be found even for manual configuration
   132 # CONFIG_WRITER has to be found even for manual configuration
   125 CONFIG_WRITER=makefiledir/Makefile.config_writer
   133 CONFIG_WRITER=makefiledir/Makefile.config_writer
   126 
   134 
   127 ifndef MANUAL_CONFIG
   135 ifndef MANUAL_CONFIG
   259 endwarnings:=endwarnings
   267 endwarnings:=endwarnings
   260 64_bit_warnings:=64_bit_warnings
   268 64_bit_warnings:=64_bit_warnings
   261 BASECFLAGS += -m64
   269 BASECFLAGS += -m64
   262 endif
   270 endif
   263 
   271 
       
   272 # Check if there is a windres override
       
   273 ifndef WINDRES
       
   274 WINDRES = windres
       
   275 endif
       
   276 
       
   277 # Check if we have a new target
       
   278 ifdef CC_TARGET
       
   279 CC = $(CC_TARGET)
       
   280 endif
       
   281 
       
   282 # Check if CC_HOST is defined. If not, it is CC
       
   283 ifndef CC_HOST
       
   284 CC_HOST = $(CC)
       
   285 endif
       
   286 ifndef CFLAGS_HOST
       
   287 CFLAGS_HOST = $(BASECFLAGS)
       
   288 endif
   264 
   289 
   265 # When calling the compiler, use these flags
   290 # When calling the compiler, use these flags
   266 # -g	debugging symbols
   291 # -g	debugging symbols
   267 # -Wall	all warnings
   292 # -Wall	all warnings
   268 # -s    automatic strip
   293 # -s    automatic strip
   518 ifdef WITH_DIRECTMUSIC
   543 ifdef WITH_DIRECTMUSIC
   519 CDEFS += -DWIN32_ENABLE_DIRECTMUSIC_SUPPORT
   544 CDEFS += -DWIN32_ENABLE_DIRECTMUSIC_SUPPORT
   520 endif
   545 endif
   521 
   546 
   522 ifdef WIN32
   547 ifdef WIN32
   523 LIBS += -lws2_32 -lwinmm -lgdi32 -ldxguid -lole32 -lstdc++
   548 LIBS += -lws2_32 -lwinmm -lgdi32 -ldxguid -lole32
       
   549 ifdef WITH_DIRECTMUSIC
       
   550 LIBS += -lstdc++
       
   551 endif
   524 TTDLDFLAGS += -Wl,--subsystem,windows
   552 TTDLDFLAGS += -Wl,--subsystem,windows
   525 endif
   553 endif
   526 
   554 
   527 ifndef DEST_DIR
   555 ifndef DEST_DIR
   528 DEST_DIR = $(DESTDIR)
   556 DEST_DIR = $(DESTDIR)
   721 
   749 
   722 # The build commands themselves. Note that if you omit the quiet version,
   750 # The build commands themselves. Note that if you omit the quiet version,
   723 # nothing will be shown in the non-verbose mode.
   751 # nothing will be shown in the non-verbose mode.
   724 
   752 
   725 quiet_cmd_compile_link = '===> Compiling and Linking $@'
   753 quiet_cmd_compile_link = '===> Compiling and Linking $@'
   726       cmd_compile_link = $(CC) $(BASECFLAGS) $(CDEFS) $< -o $@
   754       cmd_compile_link = $(CC_HOST) $(CFLAGS_HOST) $(CDEFS) $< -o $@
   727 
   755 
   728 quiet_cmd_ttd_link = '===> Linking $@'
   756 quiet_cmd_ttd_link = '===> Linking $@'
   729       cmd_ttd_link = $(CC) $(LDFLAGS) $(TTDLDFLAGS) $(OBJS) $(LIBS) -o $@
   757       cmd_ttd_link = $(CC) $(LDFLAGS) $(TTDLDFLAGS) $(OBJS) $(LIBS) -o $@
   730 
   758 
   731 COMPILE_PARAMS=$(CFLAGS) $(CDEFS) -MD -c $< -o $@
   759 COMPILE_PARAMS=$(CFLAGS) $(CDEFS) -MD -c $< -o $@
   753 
   781 
   754 all: endian.h $(UPDATECONFIG) $(LANGS) $(TTD) $(OSX) $(endwarnings)
   782 all: endian.h $(UPDATECONFIG) $(LANGS) $(TTD) $(OSX) $(endwarnings)
   755 
   783 
   756 endian.h: $(ENDIAN_CHECK)
   784 endian.h: $(ENDIAN_CHECK)
   757 	@echo '===> Testing endianness'
   785 	@echo '===> Testing endianness'
   758 	$(Q)./$(ENDIAN_CHECK) > $@
   786 	$(Q)./$(ENDIAN_CHECK) $(ENDIAN_FORCE) > $@
   759 
   787 
   760 $(ENDIAN_CHECK): endian_check.c
   788 $(ENDIAN_CHECK): endian_check.c
   761 	$(call cmd,compile_link)
   789 	$(call cmd,compile_link)
   762 
   790 
   763 
   791 
   798 	@echo '===> Compiling language $(*F)'
   826 	@echo '===> Compiling language $(*F)'
   799 	$(Q)$(STRGEN) $(STRGEN_FLAGS) $< $(LANG_ERRORS)
   827 	$(Q)$(STRGEN) $(STRGEN_FLAGS) $< $(LANG_ERRORS)
   800 
   828 
   801 winres.o: ttd.rc
   829 winres.o: ttd.rc
   802 	@echo '===> Compiling resource $<'
   830 	@echo '===> Compiling resource $<'
   803 	$(Q)windres -o $@ $<
   831 	$(Q)$(WINDRES) -o $@ $<
   804 
   832 
   805 ifdef MORPHOS
   833 ifdef MORPHOS
   806 release: all
   834 release: all
   807 	$(Q)rm -fr "/t/openttd-$(RELEASE)-morphos.lha"
   835 	$(Q)rm -fr "/t/openttd-$(RELEASE)-morphos.lha"
   808 	$(Q)mkdir -p "/t/"
   836 	$(Q)mkdir -p "/t/"