X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2FMakefile;h=af907f8c342bd09e56be62056e8cd21e3cf9412f;hp=da479a447fabfb9b51eac29568089292ee5817eb;hb=0896ebe9d29a756c7adc005c6b93ff28f2fd396d;hpb=501680c0c919ce15ff8c33f46445659d4a534c35 diff --git a/src/Makefile b/src/Makefile index da479a44..af907f8c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -4,7 +4,7 @@ # (c) 1995-2015 by Artsoft Entertainment # Holger Schemel # info@artsoft.org -# http://www.artsoft.org/ +# https://www.artsoft.org/ # ----------------------------------------------------------------------------- # src/Makefile # ============================================================================= @@ -57,6 +57,16 @@ PROGNAME = ../$(PROGBASE).exe EXTRA_LDFLAGS = -lshfolder -lwsock32 endif +ifdef BUILD_DIST # distribution build +ifeq ($(shell uname -s),Darwin) # compiling on Mac OS X +MAC_TARGET_VERSION_MIN = 10.7 +EXTRA_FLAGS_MAC = -mmacosx-version-min=$(MAC_TARGET_VERSION_MIN) +EXTRA_CFLAGS = $(EXTRA_FLAGS_MAC) +EXTRA_LDFLAGS = $(EXTRA_FLAGS_MAC) +MACOSX_DEPLOYMENT_TARGET = $MAC_TARGET_VERSION_MIN +endif +endif + # ----------------------------------------------------------------------------- # configuring target @@ -99,18 +109,18 @@ DEBUG = -DDEBUG -g # PROFILING = $(PROFILING_FLAGS) # OPTIONS = $(DEBUG) -Wall # only for debugging purposes -# OPTIONS = $(DEBUG) -O3 -Wall # only for debugging purposes +# OPTIONS = $(DEBUG) -O2 -Wall # only for debugging purposes # OPTIONS = $(DEBUG) -Wall # only for debugging purposes OPTIONS = $(DEBUG) -Wall -Wstrict-prototypes -Wmissing-prototypes # OPTIONS = $(DEBUG) -Wall -ansi -pedantic # only for debugging purposes -# OPTIONS = -O3 -Wall -ansi -pedantic -# OPTIONS = -O3 -Wall -# OPTIONS = -O3 +# OPTIONS = -O2 -Wall -ansi -pedantic +# OPTIONS = -O2 -Wall +# OPTIONS = -O2 ifdef BUILD_DIST # distribution build SYS_LDFLAGS := $(shell echo $(SYS_LDFLAGS) | \ sed -e "s%-rpath,[^ ]*%-rpath,'\$$ORIGIN/lib'%") -OPTIONS = -O3 -Wall +OPTIONS = -O2 -Wall endif CFLAGS = $(OPTIONS) $(SYS_CFLAGS) $(EXTRA_CFLAGS) $(CONFIG) @@ -182,6 +192,12 @@ SOURCE_DATE_EPOCH ?= $(shell test -d ../.git && test `git ls-files -m | wc -l` - # get source date string from either GNU / Linux or BSD / Mac OS X style "date" SOURCE_DATE_STRING := $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "+$(TIMESTAMP_FORMAT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "+$(TIMESTAMP_FORMAT)" 2>/dev/null || date -u "+$(TIMESTAMP_FORMAT)") +COMMIT_HASH_FILE = confhash.h +COMMIT_HASH_NONE = "[changed files]" + +# get last Git commit hash, if no files were changed +SOURCE_HASH_STRING ?= $(shell test -d ../.git && test `git ls-files -m | wc -l` -eq 0 && git show -s --format=%h || echo "$(COMMIT_HASH_NONE)") + LIBGAME_DIR = libgame LIBGAME = $(LIBGAME_DIR)/libgame.a @@ -214,7 +230,7 @@ GRAPHICS_DIR = ../graphics all: $(AUTOCONF) libgame_dir game_em_dir game_sp_dir game_mm_dir $(PROGNAME) graphics_dir -$(PROGNAME): $(RNDLIBS) $(TIMESTAMP_FILE) $(OBJS) $(ICON) +$(PROGNAME): $(RNDLIBS) $(TIMESTAMP_FILE) $(COMMIT_HASH_FILE) $(OBJS) $(ICON) $(CC) $(PROFILING) $(OBJS) $(ICON) $(RNDLIBS) $(LDFLAGS) -o $(PROGNAME) ifdef BUILD_DIST strip $(PROGNAME) @@ -261,10 +277,20 @@ conf_snd.h: conf_snd.c $(CNFS_CMD) conf_mus.h: conf_mus.c $(CNFS_CMD) @$(MAKE) auto-conf -$(TIMESTAMP_FILE): $(SRCS) $(RNDLIBS) +conf-time: @echo '#define SOURCE_DATE_STRING "$(SOURCE_DATE_STRING)"' \ > $(TIMESTAMP_FILE) +conf-hash: + @echo '#define SOURCE_HASH_STRING "$(SOURCE_HASH_STRING)"' \ + > $(COMMIT_HASH_FILE) + +$(TIMESTAMP_FILE): $(SRCS) $(RNDLIBS) + @$(MAKE) conf-time + +$(COMMIT_HASH_FILE): $(SRCS) $(RNDLIBS) + @$(MAKE) conf-hash + $(ICON): # $(CONVERT) $(ICON32X32) $(CONVERT_ICON_ARGS) $(ICONBASE).ico $(CONVERT) $(ICON_PATH)/*.png $(CONVERT_ICON_ARGS) $(ICONBASE).ico