Makefile
changeset 157 dd017fa3bad8
parent 126 152df0cc4ac2
child 162 565551f829e9
equal deleted inserted replaced
156:8fef5e5752d6 157:dd017fa3bad8
   169 EXE=
   169 EXE=
   170 endif
   170 endif
   171 
   171 
   172 # Set output executable names
   172 # Set output executable names
   173 TTD=openttd$(EXE)
   173 TTD=openttd$(EXE)
       
   174 ENDIAN_CHECK=endian_check$(EXE)
   174 STRGEN=strgen/strgen$(EXE)
   175 STRGEN=strgen/strgen$(EXE)
   175 OSXAPP="OpenTTD.app"
   176 OSXAPP="OpenTTD.app"
   176 
   177 
   177 # What revision are we compiling, if we have an idea?
   178 # What revision are we compiling, if we have an idea?
   178 REV_NUMBER := $(shell if test -d .svn; then svnversion . | tr -dc 0-9; fi)
   179 REV_NUMBER := $(shell if test -d .svn; then svnversion . | tr -dc 0-9; fi)
   196 
   197 
   197 # AMD64 needs a little more settings to work
   198 # AMD64 needs a little more settings to work
   198 ifeq ($(shell uname -m), x86_64)
   199 ifeq ($(shell uname -m), x86_64)
   199 endwarnings:=endwarnings
   200 endwarnings:=endwarnings
   200 64_bit_warnings:=64_bit_warnings
   201 64_bit_warnings:=64_bit_warnings
   201 BASECFLAGS += -m64 -D_LITTLE_ENDIAN
   202 BASECFLAGS += -m64
   202 endif
   203 endif
   203 
   204 
   204 
   205 
   205 # When calling the compiler, use these flags
   206 # When calling the compiler, use these flags
   206 # -g	debugging symbols
   207 # -g	debugging symbols
   486 ifdef OSX
   487 ifdef OSX
   487 OSX:=OSX
   488 OSX:=OSX
   488 endif
   489 endif
   489 
   490 
   490 
   491 
   491 all: $(UPDATECONFIG) $(TTD) $(OSX) $(endwarnings)
   492 all: endian.h $(UPDATECONFIG) $(TTD) $(OSX) $(endwarnings)
   492 
   493 
       
   494 endian.h: $(ENDIAN_CHECK)
       
   495 	# Check if system is LITTLE_ENDIAN or BIG_ENDIAN 
       
   496 	./$(ENDIAN_CHECK) > $@
       
   497 
       
   498 $(ENDIAN_CHECK): endian_check.c
       
   499 	$(CC) $(BASECFLAGS) $(CDEFS) endian_check.c -o $@
       
   500 	
   493 
   501 
   494 $(TTD): table/strings.h $(ttd_OBJS) $(LANGS) $(MAKE_CONFIG)
   502 $(TTD): table/strings.h $(ttd_OBJS) $(LANGS) $(MAKE_CONFIG)
   495 	$(C_LINK) $@ $(TTDLDFLAGS) $(ttd_OBJS) $(LIBS)
   503 	$(C_LINK) $@ $(TTDLDFLAGS) $(ttd_OBJS) $(LIBS)
   496 
   504 
   497 $(OSX):
   505 $(OSX):
   544 
   552 
   545 
   553 
   546 # ttd$(EXE) is removed just to make sure people execute the right binary (openttd$(EXE))
   554 # ttd$(EXE) is removed just to make sure people execute the right binary (openttd$(EXE))
   547 # remove this for next release!
   555 # remove this for next release!
   548 clean:
   556 clean:
   549 	rm -rf .deps *~ $(TTD) $(STRGEN) core table/strings.h $(LANGS) $(ttd_OBJS) ttd$(EXE)
   557 	rm -rf .deps *~ $(TTD) $(STRGEN) core table/strings.h $(LANGS) $(ttd_OBJS) endian.h $(ENDIAN_CHECK) ttd$(EXE)
   550 
   558 
   551 mrproper: clean
   559 mrproper: clean
   552 	rm -rf $(MAKE_CONFIG)
   560 	rm -rf $(MAKE_CONFIG)
   553 
   561 
   554 ifndef OSX
   562 ifndef OSX