X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2FMakefile;h=f0dd3e00879b88c267ab6ad4ba2a72fedf7e8333;hp=2a1afc908ceb0be4d268c3149edd2f8177c95147;hb=eb72f4adc74084da40e39484b2545e3d49d39eaa;hpb=b05bf3dca0ec7d951f1113066093843804e5be06 diff --git a/src/Makefile b/src/Makefile index 2a1afc90..f0dd3e00 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,7 +1,7 @@ # ============================================================================= # Rocks'n'Diamonds - McDuffin Strikes Back! # ----------------------------------------------------------------------------- -# (c) 1995-2014 by Artsoft Entertainment +# (c) 1995-2015 by Artsoft Entertainment # Holger Schemel # info@artsoft.org # http://www.artsoft.org/ @@ -30,11 +30,6 @@ WINDRES = windres CONVERT_ICON_ARGS = -transparent black -background transparent PROGBASE = rocksndiamonds - -ifdef SPECIAL_EDITION # create special edition -PROGBASE = $(SPECIAL_EDITION) -endif - PROGNAME = ../$(PROGBASE) @@ -42,26 +37,18 @@ PROGNAME = ../$(PROGBASE) # configuring platform # ----------------------------------------------------------------------------- -ifeq ($(PLATFORM),solaris) # native compiling to Solaris -EXTRA_LDFLAGS = -lnsl -lsocket -R$(XLIB_PATH) -PLATFORM = unix -endif - -ifeq ($(PLATFORM),macosx) # native compiling to Mac OS X +ifeq ($(PLATFORM),macosx) # compiling on Mac OS X EXTRA_LDFLAGS = -lstdc++ -PLATFORM = unix -TARGET = sdl +override PLATFORM = unix endif -ifeq ($(PLATFORM),unix) # native compiling to Unix (generic) +ifeq ($(PLATFORM),unix) # compiling on Unix/Linux (generic) PROFILING_FLAGS = -pg endif ifeq ($(PLATFORM),cross-win32) # cross-compiling to Windows PROGNAME = ../$(PROGBASE).exe EXTRA_LDFLAGS = -lshfolder -lwsock32 -# TARGET = sdl -TARGET = sdl2 endif @@ -69,30 +56,34 @@ endif # configuring target # ----------------------------------------------------------------------------- +ifndef TARGET # auto-detect compiling for SDL or SDL2 + SDL_VERSION := $(shell sdl2-config --version 2> /dev/null) + ifdef SDL_VERSION + TARGET = sdl2 + else + SDL_VERSION := $(shell sdl-config --version 2> /dev/null) + ifdef SDL_VERSION + TARGET = sdl + else + $(error SDL/SDL2 library not found) + endif + endif +endif + +# $(info Using SDL version $(SDL_VERSION) [TARGET == $(TARGET)]) + ifeq ($(TARGET),sdl) # compiling for SDL target SYS_CFLAGS = -DTARGET_SDL $(shell sdl-config --cflags) -SDL_LIBS = -lSDL_image -lSDL_mixer -lSDL_net -lsmpeg +SDL_LIBS = -lSDL_image -lSDL_mixer -lSDL_net SYS_LDFLAGS = $(SDL_LIBS) $(shell sdl-config --libs) endif ifeq ($(TARGET),sdl2) # compiling for SDL2 target SYS_CFLAGS = -DTARGET_SDL2 $(shell sdl2-config --cflags) -SDL_LIBS = -lSDL2_image -lSDL2_mixer -lSDL2_net -lsmpeg2 +SDL_LIBS = -lSDL2_image -lSDL2_mixer -lSDL2_net SYS_LDFLAGS = $(SDL_LIBS) $(shell sdl2-config --libs) endif -ifeq ($(TARGET),sdl-static) # compiling for SDL target (static) -SYS_CFLAGS = -DTARGET_SDL $(shell sdl-config --cflags) -SDL_LIBS = -lSDL_image -lSDL_mixer -lSDL_net -lsmpeg -lmikmod -SYS_LDFLAGS = $(SDL_LIBS) $(shell sdl-config --static-libs) -endif - -ifeq ($(TARGET),sdl2-static) # compiling for SDL2 target (static) -SYS_CFLAGS = -DTARGET_SDL2 $(shell sdl2-config --cflags) -SDL_LIBS = -lSDL2_image -lSDL2_mixer -lSDL2_net -lsmpeg2 -lmikmod -SYS_LDFLAGS = $(SDL_LIBS) $(shell sdl2-config --static-libs) -endif - # ----------------------------------------------------------------------------- # configuring compile-time definitions @@ -110,14 +101,8 @@ ifdef SCORE_ENTRIES # number of score entries per player CONFIG_SCORE_ENTRIES = -D$(SCORE_ENTRIES) endif -ifdef SPECIAL_EDITION -ifeq ($(SPECIAL_EDITION),rnd_jue) # create special edition -CONFIG_SPECIAL = -DCREATE_SPECIAL_EDITION -DCREATE_SPECIAL_EDITION_RND_JUE -endif -endif - CONFIG_GAME_DIR = $(CONFIG_RO_GAME_DIR) $(CONFIG_RW_GAME_DIR) -CONFIG_GAME = $(CONFIG_GAME_DIR) $(CONFIG_SCORE_ENTRIES) $(CONFIG_SPECIAL) +CONFIG_GAME = $(CONFIG_GAME_DIR) $(CONFIG_SCORE_ENTRIES) CONFIG = $(CONFIG_GAME) $(JOYSTICK) DEBUG = -DDEBUG -g @@ -130,9 +115,10 @@ OPTIONS = $(DEBUG) -Wall # only for debugging purposes # OPTIONS = -O3 -Wall -ansi -pedantic # OPTIONS = -O3 -Wall # OPTIONS = -O3 -# OPTIONS = -DSYSV -Ae # may be needed for HP-UX ifdef BUILD_DIST # distribution build +SYS_LDFLAGS := $(shell echo $(SYS_LDFLAGS) | \ + sed -e "s%-rpath,[^ ]*%-rpath,'\$$ORIGIN/lib'%") OPTIONS = -O3 -Wall endif @@ -212,15 +198,9 @@ AUTOCONF = conf_gfx.h conf_snd.h conf_mus.h ICONBASE = windows_icon ICON_BASEPATH = ../Special/Icons/windows_icons + ifeq ($(PLATFORM),cross-win32) -ifdef SPECIAL_EDITION -# ICONSUFFIX = 32x32_$(SPECIAL_EDITION) -ICON_PATH = $(ICON_BASEPATH)/$(SPECIAL_EDITION) -else -# ICONSUFFIX = 32x32 ICON_PATH = $(ICON_BASEPATH)/default -endif -# ICON32X32 = ../graphics/$(ICONBASE)_$(ICONSUFFIX).bmp ICON = $(ICONBASE).o endif @@ -235,6 +215,9 @@ all: $(AUTOCONF) libgame_dir game_em_dir game_sp_dir $(PROGNAME) graphics_dir $(PROGNAME): $(RNDLIBS) $(TIMESTAMP_FILE) $(OBJS) $(ICON) $(CC) $(PROFILING) $(OBJS) $(ICON) $(RNDLIBS) $(LDFLAGS) -o $(PROGNAME) +ifdef BUILD_DIST + strip $(PROGNAME) +endif libgame_dir: @$(MAKE) -C $(LIBGAME_DIR) @@ -287,7 +270,7 @@ $(ICON): $(CC) $(PROFILING) $(CFLAGS) -c $*.c graphics_dir: - @$(MAKE) -C $(GRAPHICS_DIR) + @test -f $(GRAPHICS_DIR)/Makefile && $(MAKE) -C $(GRAPHICS_DIR) || true clean-obj: $(MAKE) -C $(LIBGAME_DIR) clean