X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2FMakefile;h=2a02d8165882463f8f45634d78e6bb4a7b29faee;hb=2e99b0c26d334eb287486b8933b52b5048c6cc0c;hp=20b8f36790085e47ac016cb2d2759f61ffd2f01e;hpb=0d4ace80d081e080a704ee15227e209d5953e325;p=rocksndiamonds.git diff --git a/src/Makefile b/src/Makefile index 20b8f367..2a02d816 100644 --- a/src/Makefile +++ b/src/Makefile @@ -10,29 +10,20 @@ .EXPORT_ALL_VARIABLES: -ifndef PLATFORM # unknown platform -- try auto detection -ifdef COMSPEC -PLATFORM = msdos -else +ifndef PLATFORM # unknown platform -- default to Unix PLATFORM = unix endif -endif - -ifdef X11_PATH # path to X11 from top level Makefile -XINC_PATH = $(X11_PATH)/include -XLIB_PATH = $(X11_PATH)/lib -X11_INCL = -I$(XINC_PATH) -X11_LIBS = -L$(XLIB_PATH) -lX11 -endif AR = ar RANLIB = ranlib ETAGS = etags RM = rm -f -BMP2ICO = bmp2ico +CONVERT = convert WINDRES = windres +CONVERT_ICON_ARGS = -transparent black -background transparent + PROGBASE = rocksndiamonds ifdef SPECIAL_EDITION # create special edition @@ -57,15 +48,6 @@ PLATFORM = unix TARGET = sdl endif -ifeq ($(PLATFORM),os2) # native compiling to OS/2 -RANLIB = echo -PROGNAME = ../$(PROGBASE).exe -EXTRA_CFLAGS = -Zbin-files -D__ST_MT_ERRNO__ -Zmtd -fomit-frame-pointer -EXTRA_LDFLAGS = -lsocket -PLATFORM = unix -TARGET = x11 -endif - ifeq ($(PLATFORM),unix) # native compiling to Unix (generic) PROFILING_FLAGS = -pg endif @@ -73,21 +55,8 @@ endif ifeq ($(PLATFORM),cross-win32) # cross-compiling to Windows PROGNAME = ../$(PROGBASE).exe EXTRA_LDFLAGS = -lshfolder -lwsock32 -TARGET = sdl -endif - -ifeq ($(PLATFORM),cross-msdos) # cross-compiling to MS-DOS -PROGBASE = rocks -PROGNAME = ../$(PROGBASE).exe -TARGET = allegro -endif - -ifeq ($(PLATFORM),msdos) # native compiling to MS-DOS -PROGBASE = rocks -PROGNAME = ../$(PROGBASE).exe -SYS_CFLAGS = -DTARGET_X11 -SYS_LDFLAGS = -s -lalleg -RM = del +# TARGET = sdl +TARGET = sdl2 endif @@ -95,26 +64,28 @@ endif # configuring target # ----------------------------------------------------------------------------- -ifeq ($(TARGET),x11) # compiling for X11 target -SYS_CFLAGS = -DTARGET_X11 $(X11_INCL) -SYS_LDFLAGS = $(X11_LIBS) -endif - ifeq ($(TARGET),sdl) # compiling for SDL target -SYS_CFLAGS = -DTARGET_SDL $(shell sdl-config --cflags) +SYS_CFLAGS = -DTARGET_SDL $(shell sdl-config --cflags) SDL_LIBS = -lSDL_image -lSDL_mixer -lSDL_net -lsmpeg 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 +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 +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),allegro) # compiling for Allegro target -SYS_CFLAGS = -DTARGET_ALLEGRO -I$(CROSS_PATH_MSDOS)/include -SYS_LDFLAGS = -lalleg +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 @@ -218,7 +189,7 @@ CNFS = conf_gfx.h \ conf_var.c \ conf_act.c -CNFS_CMD = ../Scripts/create_element_defs.pl +CNFS_CMD = ../build-scripts/create_element_defs.pl TIMESTAMP_FILE = conftime.h @@ -232,15 +203,19 @@ GAME_SP_DIR = game_sp GAME_SP = $(GAME_SP_DIR)/game_sp.a RNDLIBS = $(LIBGAME) $(GAME_EM) $(GAME_SP) +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) +# ICONSUFFIX = 32x32_$(SPECIAL_EDITION) +ICON_PATH = $(ICON_BASEPATH)/$(SPECIAL_EDITION) else -ICONSUFFIX = 32x32 +# ICONSUFFIX = 32x32 +ICON_PATH = $(ICON_BASEPATH)/default endif -ICON32X32 = ../graphics/$(ICONBASE)_$(ICONSUFFIX).bmp +# ICON32X32 = ../graphics/$(ICONBASE)_$(ICONSUFFIX).bmp ICON = $(ICONBASE).o endif @@ -249,7 +224,7 @@ endif # build targets # ----------------------------------------------------------------------------- -all: libgame_dir game_em_dir game_sp_dir $(PROGNAME) +all: $(AUTOCONF) libgame_dir game_em_dir game_sp_dir $(PROGNAME) $(PROGNAME): $(RNDLIBS) $(TIMESTAMP_FILE) $(OBJS) $(ICON) $(CC) $(PROFILING) $(OBJS) $(ICON) $(RNDLIBS) $(LDFLAGS) -o $(PROGNAME) @@ -290,7 +265,8 @@ $(TIMESTAMP_FILE): $(SRCS) $(LIBGAME) $(GAME_EM) $(GAME_SP) > $(TIMESTAMP_FILE) $(ICON): - $(BMP2ICO) -transparent $(ICONBASE).ico $(ICON32X32) +# $(CONVERT) $(ICON32X32) $(CONVERT_ICON_ARGS) $(ICONBASE).ico + $(CONVERT) $(ICON_PATH)/*.png $(CONVERT_ICON_ARGS) $(ICONBASE).ico echo "$(ICONBASE) ICON $(ICONBASE).ico" | $(WINDRES) -o $(ICON) .c.o: @@ -320,13 +296,13 @@ clean: clean-obj clean-ico clean-bin # run and test targets # ----------------------------------------------------------------------------- -run: all +run: cd .. && ./$(PROGBASE) --verbose -gdb: all +gdb: cd .. && gdb -batch -x GDB_COMMANDS ./$(PROGBASE) -valgrind: all +valgrind: cd .. && valgrind -v --leak-check=yes ./$(PROGBASE) 2> valgrind.out