Makefile
changeset 162 565551f829e9
parent 157 dd017fa3bad8
child 163 deb9b58db3f4
equal deleted inserted replaced
161:74453c59315c 162:565551f829e9
    59 #             a <TODO> mark)
    59 #             a <TODO> mark)
    60 # RELEASE: this will be the released version number. It replaces all places
    60 # RELEASE: this will be the released version number. It replaces all places
    61 #          where it normally would print the revision number
    61 #          where it normally would print the revision number
    62 # MIDI: if set, it will use it as custom path to midi player. 
    62 # MIDI: if set, it will use it as custom path to midi player. 
    63 #  If unset, it will use the hardcoded path in the c code
    63 #  If unset, it will use the hardcoded path in the c code
       
    64 # NOVERBOSE: supress all warnings and errors during compilation. 
       
    65 #  It looks nicer, but you will not know what went wrong. Use it on released (stable) sources only
    64 #
    66 #
    65 # DATA_DIR_PREFIX: This sets the dir OpenTTD looks for the needed files. 
    67 # DATA_DIR_PREFIX: This sets the dir OpenTTD looks for the needed files. 
    66 #   MUST END WITH / if defined
    68 #   MUST END WITH / if defined
    67 #
    69 #
    68 # STATIC: link statically
    70 # STATIC: link statically
   119 
   121 
   120 ifndef CONFIG_INCLUDED
   122 ifndef CONFIG_INCLUDED
   121 -include $(LIB_DETECTION)
   123 -include $(LIB_DETECTION)
   122 endif
   124 endif
   123 
   125 
       
   126 # Verbose filter
       
   127 
       
   128 ifdef NOVERBOSE
       
   129 VERBOSE_FILTER =  >/dev/null 2>&1 
       
   130 else
       
   131 VERBOSE_FILTER = 
       
   132 endif
       
   133 
   124 ifdef DISPLAY_WARNINGS
   134 ifdef DISPLAY_WARNINGS
   125 WARNING_DISPLAY:=-fstrict-aliasing
   135 WARNING_DISPLAY:=-fstrict-aliasing
       
   136 VERBOSE_FILTER =  
   126 else
   137 else
   127 WARNING_DISPLAY:=-fno-strict-aliasing
   138 WARNING_DISPLAY:=-fno-strict-aliasing
   128 endif
   139 endif
   129 
   140 
   130 ifdef STATIC
   141 ifdef STATIC
   151 
   162 
   152 ##############################################################################
   163 ##############################################################################
   153 #
   164 #
   154 # Compiler configuration
   165 # Compiler configuration
   155 #
   166 #
   156 
       
   157 CC=gcc
   167 CC=gcc
   158 CXX=g++
   168 CXX=g++
   159 
   169 
   160 ifdef MORPHOS
   170 ifdef MORPHOS
   161 CC += -noixemul -pipe
   171 CC += -noixemul -pipe
   473 CXX_BUILD = $(CXX_COMPILE) -c
   483 CXX_BUILD = $(CXX_COMPILE) -c
   474 
   484 
   475 C_LINK = $(CC) $(LDFLAGS) -o
   485 C_LINK = $(CC) $(LDFLAGS) -o
   476 
   486 
   477 
   487 
       
   488 
   478 ##############################################################################
   489 ##############################################################################
   479 #
   490 #
   480 # Targets
   491 # Targets
   481 #
   492 #
   482 
   493 
   498 $(ENDIAN_CHECK): endian_check.c
   509 $(ENDIAN_CHECK): endian_check.c
   499 	$(CC) $(BASECFLAGS) $(CDEFS) endian_check.c -o $@
   510 	$(CC) $(BASECFLAGS) $(CDEFS) endian_check.c -o $@
   500 	
   511 	
   501 
   512 
   502 $(TTD): table/strings.h $(ttd_OBJS) $(LANGS) $(MAKE_CONFIG)
   513 $(TTD): table/strings.h $(ttd_OBJS) $(LANGS) $(MAKE_CONFIG)
   503 	$(C_LINK) $@ $(TTDLDFLAGS) $(ttd_OBJS) $(LIBS)
   514 	@echo 'Compiling and Linking $@'; \
       
   515 		$(C_LINK) $@ $(TTDLDFLAGS) $(ttd_OBJS) $(LIBS) $(VERBOSE_FILTER)
   504 
   516 
   505 $(OSX):
   517 $(OSX):
   506 	@mkdir -p $(OSXAPP)/Contents/MacOS
   518 	@mkdir -p $(OSXAPP)/Contents/MacOS
   507 	@mkdir -p $(OSXAPP)/Contents/Resources
   519 	@mkdir -p $(OSXAPP)/Contents/Resources
   508 	@echo "APPL????" > $(OSXAPP)/Contents/PkgInfo
   520 	@echo "APPL????" > $(OSXAPP)/Contents/PkgInfo
   510 	@os/macos/plistgen.sh $(OSXAPP) $(REV)
   522 	@os/macos/plistgen.sh $(OSXAPP) $(REV)
   511 	@cp os/macos/track_starter $(OSXAPP)/contents/macos
   523 	@cp os/macos/track_starter $(OSXAPP)/contents/macos
   512 	@ls os/macos | grep -q "\.class" || \
   524 	@ls os/macos | grep -q "\.class" || \
   513 	javac os/macos/OpenTTDMidi.java
   525 	javac os/macos/OpenTTDMidi.java
   514 	@cp os/macos/OpenTTDMidi.class $(OSXAPP)/contents/macos
   526 	@cp os/macos/OpenTTDMidi.class $(OSXAPP)/contents/macos
   515 	@cp $(TTD) $(OSXAPP)/Contents/MacOS/openttd
   527 	@cp $(TTD) $(OSXAPP)/Contents/MacOS/$(TTD)
   516 
   528 
   517 $(endwarnings): $(64_bit_warnings)
   529 $(endwarnings): $(64_bit_warnings)
   518 
   530 
   519 $(64_bit_warnings):
   531 $(64_bit_warnings):
   520 	$(warning 64 bit CPUs will get some 64 bit specific bugs!)
   532 	$(warning 64 bit CPUs will get some 64 bit specific bugs!)
   521 	$(warning If you see any bugs, include in your bug report that you use a 64 bit CPU)
   533 	$(warning If you see any bugs, include in your bug report that you use a 64 bit CPU)
   522 
   534 
   523 $(STRGEN): strgen/strgen.c rev.o
   535 $(STRGEN): strgen/strgen.c rev.o
   524 	$(CC) $(BASECFLAGS) $(CDEFS) -o $@ $^
   536 	@echo 'Compiling and Linking $@'; \
       
   537 		$(CC) $(BASECFLAGS) $(CDEFS) -o $@ $^ $(VERBOSE_FILTER)
   525 
   538 
   526 lang/english.lng: lang/english.txt $(STRGEN)
   539 lang/english.lng: lang/english.txt $(STRGEN)
       
   540 	@echo 'Generating $@'; \
   527 	$(STRGEN)
   541 	$(STRGEN)
   528 	
   542 	
   529 table/strings.h: lang/english.lng
   543 table/strings.h: lang/english.lng
   530 
   544 
   531 lang/%.lng: lang/%.txt $(STRGEN)
   545 lang/%.lng: lang/%.txt $(STRGEN)
   532 	$(STRGEN) $(STRGEN_FLAGS) $<
   546 	@echo 'Generating $@'; \
       
   547 	$(STRGEN) $(STRGEN_FLAGS) $< $(VERBOSE_FILTER)
   533 
   548 
   534 winres.o: ttd.rc
   549 winres.o: ttd.rc
   535 	windres -o $@ $<
   550 	windres -o $@ $<
   536 
   551 
   537 
   552 
   552 
   567 
   553 
   568 
   554 # ttd$(EXE) is removed just to make sure people execute the right binary (openttd$(EXE))
   569 # ttd$(EXE) is removed just to make sure people execute the right binary (openttd$(EXE))
   555 # remove this for next release!
   570 # remove this for next release!
   556 clean:
   571 clean:
   557 	rm -rf .deps *~ $(TTD) $(STRGEN) core table/strings.h $(LANGS) $(ttd_OBJS) endian.h $(ENDIAN_CHECK) ttd$(EXE)
   572 	@echo 'Cleaning up...'; \
       
   573 	rm -rf .deps *~ $(TTD) $(STRGEN) core table/strings.h $(LANGS) $(ttd_OBJS) ttd$(EXE)
   558 
   574 
   559 mrproper: clean
   575 mrproper: clean
   560 	rm -rf $(MAKE_CONFIG)
   576 	rm -rf $(MAKE_CONFIG)
   561 
   577 
   562 ifndef OSX
   578 ifndef OSX
   610 
   626 
   611 # This compiles the object file as well as silently updating its dependencies
   627 # This compiles the object file as well as silently updating its dependencies
   612 # list at the same time. It is not an issue that they aren't around during the
   628 # list at the same time. It is not an issue that they aren't around during the
   613 # first compilation round as we just build everything at that time anyway,
   629 # first compilation round as we just build everything at that time anyway,
   614 # therefore we do not need to watch deps.
   630 # therefore we do not need to watch deps.
       
   631 
       
   632 #@echo '$(C_BUILD) $<'; \
       
   633 
       
   634 
   615 %.o: %.c $(MAKE_CONFIG)
   635 %.o: %.c $(MAKE_CONFIG)
   616 	@echo '$(C_BUILD) $<'; \
   636 	@echo 'Compiling $(*F).o'; \
   617 		$(C_BUILD) $< -Wp,-MD,.deps/$(*F).pp
   637 		       $(C_BUILD) $< -Wp,-MD,.deps/$(*F).pp $(VERBOSE_FILTER)
   618 	@-cp .deps/$(*F).pp .deps/$(*F).P; \
   638 	@-cp .deps/$(*F).pp .deps/$(*F).P; \
   619 		tr ' ' '\012' < .deps/$(*F).pp \
   639 		tr ' ' '\012' < .deps/$(*F).pp \
   620 		| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
   640 		| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
   621 		>> .deps/$(*F).P; \
   641 		>> .deps/$(*F).P; \
   622 	rm .deps/$(*F).pp
   642 	rm .deps/$(*F).pp