X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2FMakefile;h=f2b146b71a5ea3ccda68af4a4ba8db414b8355d7;hb=a8b2caa1d373c84c1b3fc2f615370c2a319051ca;hp=965c05884d96e86601f8718dd28242b0c809cc75;hpb=d4c11da68a7271553ca5591adfae54fd3b45011f;p=rocksndiamonds.git diff --git a/src/Makefile b/src/Makefile index 965c0588..f2b146b7 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,11 +1,11 @@ #=============================================================================# -# Makefile for Rocks'n'Diamonds 1.2 # -# (c) 1995-98 Holger Schemel, aeglos@valinor.owl.de # +# Makefile for Rocks'n'Diamonds # +# (c) 1995-2000 Holger Schemel, info@artsoft.org # #=============================================================================# -ifndef PLATFORM # platform not defined -- try auto detection +ifndef PLATFORM # platform not specified -- try auto detection ifdef COMSPEC -PLATFORM = dos +PLATFORM = msdos else PLATFORM = unix endif @@ -18,57 +18,69 @@ X11_INCL = -I$(XINC_PATH) X11_LIBS = -L$(XLIB_PATH) endif -ifndef GAME_DIR # path to game data not defined -- try '.' -GAME_DIR = . -endif - -ifndef SCORE_ENTRIES # number of score entries per player undefined -SCORE_ENTRIES = MANY_PER_NAME -endif - - -# The Xpm library is no longer needed to build this program, -# but is used to load graphics if XPM_INCLUDE_FILE is defined. -# If you want to use the Xpm library, convert the PCX files to XPM -# files (and you need corresponding mask files in X11 Bitmap format). - -# XPM_INCLUDE_FILE = -DXPM_INCLUDE_FILE="" -# EXTRA_X11_LIBS = -lXpm - -ifeq ($(PLATFORM),dos) # DOS / Windows +ifeq ($(PLATFORM),msdos) # MS-DOS native compiling RM = del -PROGNAME = ..\rocks.exe -LIBS = -lm -lalleg +PROGNAME = ../rocks.exe + +SYS_CFLAGS = -DTARGET_X11 +SYS_LDFLAGS = -s -lalleg -lm -else # Unix +else # Unix; Win32 cross-compiling RM = rm -f PROGNAME = ../rocksndiamonds ifeq ($(PLATFORM),solaris) -EXTRA_LIBS = -lnsl -lsocket -R$(XLIB_PATH) +EXTRA_LDFLAGS = -lnsl -lsocket -R$(XLIB_PATH) endif -INCL = $(X11_INCL) -LIBS = $(X11_LIBS) $(EXTRA_X11_LIBS) -lX11 -lm $(EXTRA_LIBS) +ifeq ($(PLATFORM),win32) +PROGNAME = ../rocksndiamonds.exe +TARGET = sdl +else +PROFILING = -pg +endif +ifeq ($(TARGET),sdl) +SYS_CFLAGS = -DTARGET_SDL $(shell sdl-config --cflags) +SYS_LDFLAGS = -lSDL_image -lSDL_mixer $(shell sdl-config --libs) -lm +else +SYS_CFLAGS = -DTARGET_X11 $(X11_INCL) +SYS_LDFLAGS = $(X11_LIBS) -lX11 -lm endif +endif # (PLATFORM != msdos) + -CONFIG_GAME_DIR = -DGAME_DIR="\"$(GAME_DIR)\"" +ifdef RO_GAME_DIR # path to read-only game data specified +CONFIG_RO_GAME_DIR = -DRO_GAME_DIR="\"$(RO_GAME_DIR)\"" +endif + +ifdef RW_GAME_DIR # path to writable game data specified +CONFIG_RW_GAME_DIR = -DRW_GAME_DIR="\"$(RW_GAME_DIR)\"" +endif + +ifdef SCORE_ENTRIES # number of score entries per player specified CONFIG_SCORE_ENTRIES = -D$(SCORE_ENTRIES) +endif + +CONFIG_GAME_DIR = $(CONFIG_RO_GAME_DIR) $(CONFIG_RW_GAME_DIR) -CONFIG = $(CONFIG_GAME_DIR) $(SOUNDS) $(JOYSTICK) \ - $(CONFIG_SCORE_ENTRIES) $(XPM_INCLUDE_FILE) -# OPTIONS = -DDEBUG -g -Wall # only for debugging purposes -OPTIONS = -O3 +CONFIG = $(CONFIG_GAME_DIR) $(CONFIG_SCORE_ENTRIES) $(SOUNDS) $(JOYSTICK) +DEBUG = -DDEBUG -g -# SYSTEM = -DSYSV -Ae # maybe needed for HP-UX +OPTIONS = $(DEBUG) -Wall # only for debugging purposes +# OPTIONS = $(DEBUG) -O3 -Wall # only for debugging purposes +# OPTIONS = $(DEBUG) -Wall -ansi -pedantic # only for debugging purposes +# OPTIONS = -O3 -Wall -ansi -pedantic +# OPTIONS = -O3 -Wall +# OPTIONS = -O3 -CFLAGS = $(OPTIONS) $(SYSTEM) $(INCL) $(CONFIG) +CFLAGS = $(OPTIONS) $(SYS_CFLAGS) $(CONFIG) +LDFLAGS = $(SYS_LDFLAGS) $(EXTRA_LDFLAGS) SRCS = main.c \ init.c \ @@ -89,7 +101,10 @@ SRCS = main.c \ image.c \ network.c \ netserv.c \ - msdos.c + msdos.c \ + system.c \ + x11.c \ + sdl.c OBJS = main.o \ init.o \ @@ -110,16 +125,32 @@ OBJS = main.o \ image.o \ network.o \ netserv.o \ - msdos.o + msdos.o \ + system.o \ + x11.o \ + sdl.o all: $(PROGNAME) $(PROGNAME): $(OBJS) - $(CC) $(CFLAGS) $(OBJS) $(LIBS) -o $(PROGNAME) + $(CC) $(PROFILING) $(OBJS) $(LDFLAGS) -o $(PROGNAME) .c.o: - $(CC) $(CFLAGS) -c $*.c + $(CC) $(PROFILING) $(CFLAGS) -c $*.c clean: $(RM) *.o + $(RM) ../*.exe $(RM) $(PROGNAME) + + +#-----------------------------------------------------------------------------# +# development only stuff # +#-----------------------------------------------------------------------------# + +depend: + for i in $(SRCS); do $(CPP) $(CFLAGS) -M $$i; done > .depend + +ifeq (.depend,$(wildcard .depend)) +include .depend +endif