Makefile
changeset 3380 2d02cfdf6d14
parent 3355 e414a0b104a6
child 3389 56f72f7838cc
equal deleted inserted replaced
3379:50b253bb9819 3380:2d02cfdf6d14
    44 # WITH_PNG: screenshots using PNG
    44 # WITH_PNG: screenshots using PNG
    45 # WITH_SDL: SDL video driver support
    45 # WITH_SDL: SDL video driver support
    46 # WITH_COCOA: Cocoa video driver support
    46 # WITH_COCOA: Cocoa video driver support
    47 #
    47 #
    48 # Summary of other defines:
    48 # Summary of other defines:
    49 # MANUAL_CONFIG: do not use Makefile.config, config options set manually
       
    50 # DEBUG: build in debug mode
    49 # DEBUG: build in debug mode
    51 # PROFILE: build in profile mode, disables -s and -fomit-frame-pointer
    50 # PROFILE: build in profile mode, disables -s and -fomit-frame-pointer
    52 # TRANSLATOR: build in translator mode (untranslated strings are prepended by
    51 # TRANSLATOR: build in translator mode (untranslated strings are prepended by
    53 #             a <TODO> mark)
    52 #             a <TODO> mark)
    54 # RELEASE: this will be the released version number. It replaces all places
    53 # RELEASE: this will be the released version number. It replaces all places
   132 
   131 
   133 # Makefile version tag
   132 # Makefile version tag
   134 # it checks if the version tag in Makefile.config is the same and force update outdated config files
   133 # it checks if the version tag in Makefile.config is the same and force update outdated config files
   135 MAKEFILE_VERSION:=10
   134 MAKEFILE_VERSION:=10
   136 
   135 
   137 # CONFIG_WRITER has to be found even for manual configuration
       
   138 CONFIG_WRITER=makefiledir/Makefile.config_writer
       
   139 
       
   140 ifndef MANUAL_CONFIG
       
   141 # Automatic configuration
   136 # Automatic configuration
   142 MAKE_CONFIG:=Makefile.config
   137 MAKE_CONFIG:=Makefile.config
   143 MAKEFILE:=Makefile
   138 MAKEFILE:=Makefile
   144 LIB_DETECTION=makefiledir/Makefile.libdetection
   139 LIB_DETECTION=makefiledir/Makefile.libdetection
   145 CONFIG_WRITER=makefiledir/Makefile.config_writer
   140 CONFIG_WRITER=makefiledir/Makefile.config_writer
   146 
   141 
   147 # Apply automatic configuration
   142 # Apply automatic configuration
   148 # See target section for how this is built, suppress errors
   143 # See target section for how this is built, suppress errors
   149 # since first time it isn't found but make reads this twice
   144 # since first time it isn't found but make reads this twice
   150 -include $(MAKE_CONFIG)
   145 -include $(MAKE_CONFIG)
   151 else
   146 
   152 CONFIG_INCLUDED:=1
       
   153 endif
       
   154 
       
   155 ifndef LIBPNG-CONFIG
       
   156 LIBPNG-CONFIG :=libpng-config
       
   157 endif
       
   158 
   147 
   159 # updates Makefile.config if it's outdated
   148 # updates Makefile.config if it's outdated
   160 ifneq ($(MAKEFILE_VERSION),$(CONFIG_VERSION))
   149 ifneq ($(MAKEFILE_VERSION),$(CONFIG_VERSION))
   161 	ifndef MANUAL_CONFIG	# manual config should not check this
       
   162 		UPDATECONFIG:=upgradeconf
       
   163 		CONFIG_INCLUDED:=
       
   164 	else
       
   165 		# this should define SDL-CONFIG for manual configuration
       
   166 		ifeq ($(shell uname),FreeBSD)
       
   167 			SDL-CONFIG:=sdl11-config
       
   168 		else
       
   169 			SDL-CONFIG:=sdl-config
       
   170 		endif
       
   171 	endif
       
   172 endif
       
   173 
       
   174 ifndef SDL-CONFIG
       
   175 	UPDATECONFIG:=upgradeconf
   150 	UPDATECONFIG:=upgradeconf
   176 	CONFIG_INCLUDED:=
   151 	CONFIG_INCLUDED:=
   177 endif
   152 endif
   178 
   153 
   179 # this is used if there aren't any Makefile.config
   154 # this is used if there aren't any Makefile.config
   246 
   221 
   247 ifdef OSX
   222 ifdef OSX
   248 	LDFLAGS+=-framework Cocoa
   223 	LDFLAGS+=-framework Cocoa
   249 endif
   224 endif
   250 
   225 
       
   226 ifdef WITH_SDL
       
   227 	ifndef SDL-CONFIG
       
   228 $(error WITH_SDL can't be used when SDL-CONFIG is not set. Edit Makefile.config to correct this)
       
   229 	endif
       
   230 endif
       
   231 
       
   232 ifdef WITH_PNG
       
   233 	ifndef LIBPNG-CONFIG
       
   234 $(error WITH_PNG can't be used when LIBPNG-CONFIG is not set. Edit Makefile.config to correct this)
       
   235 	endif
       
   236 endif
   251 
   237 
   252 ##############################################################################
   238 ##############################################################################
   253 #
   239 #
   254 # Compiler configuration
   240 # Compiler configuration
   255 #
   241 #
   429 endif
   415 endif
   430 
   416 
   431 # zlib config
   417 # zlib config
   432 ifdef WITH_ZLIB
   418 ifdef WITH_ZLIB
   433 	CDEFS +=  -DWITH_ZLIB
   419 	CDEFS +=  -DWITH_ZLIB
   434 	ifdef STATIC
   420 	LIBS += -lz
   435 		ifdef OSX
       
   436 # zlib is default on OSX, so everybody have it. No need for static linking
       
   437 			LIBS += -lz
       
   438 		else
       
   439 			ifndef STATIC_ZLIB_PATH
       
   440 				ifndef MANUAL_CONFIG
       
   441 					# updates Makefile.config with the zlib path
       
   442 					UPDATECONFIG:=upgradeconf
       
   443 				endif
       
   444 				TEMP:=$(shell ls /lib 2>/dev/null | grep "zlib.a")$(shell ls /lib 2>/dev/null | grep "libz.a")
       
   445 				ifdef TEMP
       
   446 					STATIC_ZLIB_PATH:=/lib/$(TEMP)
       
   447 				else
       
   448 					TEMP:=$(shell ls /usr/lib 2>/dev/null | grep "zlib.a")$(shell ls /usr/lib 2>/dev/null | grep "libz.a")
       
   449 					ifdef TEMP
       
   450 						STATIC_ZLIB_PATH:=/usr/lib/$(TEMP)
       
   451 					else
       
   452 						TEMP:=$(shell ls /usr/local/lib 2>/dev/null | grep "zlib.a")$(shell ls /usr/local/lib 2>/dev/null | grep "libz.a")
       
   453 						ifdef TEMP
       
   454 							STATIC_ZLIB_PATH:=/usr/local/lib/$(TEMP)
       
   455 						endif
       
   456 					endif
       
   457 				endif
       
   458 			endif
       
   459 			LIBS += $(STATIC_ZLIB_PATH)
       
   460 		endif
       
   461 	else
       
   462 		LIBS += -lz
       
   463 	endif
       
   464 endif
   421 endif
   465 
   422 
   466 # libpng config
   423 # libpng config
   467 ifdef WITH_PNG
   424 ifdef WITH_PNG
   468 CDEFS += -DWITH_PNG
   425 CDEFS += -DWITH_PNG