#=============================================================================#
-# Makefile for Rocks'n'Diamonds 1.2 #
-# (c) 1995-98 Holger Schemel, aeglos@valinor.owl.de #
+# Makefile for Rocks'n'Diamonds 1.4.0 #
+# (c) 1995-1999 Holger Schemel, aeglos@valinor.owl.de #
#=============================================================================#
-ifndef PLATFORM # platform not defined -- try auto detection
+ifndef PLATFORM # platform not specified -- try auto detection
ifdef COMSPEC
PLATFORM = dos
else
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="<X11/xpm.h>"
-# EXTRA_X11_LIBS = -lXpm
-
ifeq ($(PLATFORM),dos) # DOS / Windows
RM = del
-PROGNAME = ..\rocks.exe
-LIBS = -lm -lalleg
+PROGNAME = ../rocks.exe
+LIBS = -s -lm -lalleg
else # Unix
EXTRA_LIBS = -lnsl -lsocket -R$(XLIB_PATH)
endif
-INCL = $(X11_INCL)
-LIBS = $(X11_LIBS) $(EXTRA_X11_LIBS) -lX11 -lm $(EXTRA_LIBS)
+ifeq ($(PLATFORM),windows)
+PROGNAME = ../rocksndiamonds.exe
+TARGET = sdl
+else
+PROFILING = -pg
+endif
+
+ifeq ($(TARGET),sdl)
+USE_SDL = true
+else
+USE_SDL = false
+endif
+
+ifeq ($(USE_SDL_OLD_LIBS),true)
+SDL_EXTRA_LIBS = -lIMG -lmixer
+else
+SDL_EXTRA_LIBS = -lSDL_image -lSDL_mixer
+endif
+
+SDL_CFLAGS := -DUSE_SDL_LIBRARY $(shell sdl-config --cflags)
+SDL_LDFLAGS := $(SDL_EXTRA_LIBS) $(shell sdl-config --libs)
+X11_CFLAGS = -DUSE_X11_LIBRARY $(X11_INCL)
+X11_LDFLAGS = $(X11_LIBS) -lX11
+
+ifeq ($(USE_SDL),true)
+SYS_CFLAGS = $(SDL_CFLAGS)
+SYS_LDFLAGS = $(SDL_LDFLAGS)
+else
+SYS_CFLAGS = $(X11_CFLAGS)
+SYS_LDFLAGS = $(X11_LDFLAGS)
+endif
+
+INCL = $(SYS_CFLAGS)
+LIBS = $(SYS_LDFLAGS) $(EXTRA_LIBS) -lm
+
+endif # (PLATFORM != dos)
+
+
+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
-CONFIG_GAME_DIR = -DGAME_DIR="\"$(GAME_DIR)\""
+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)
+# SYSTEM = -DSYSV -Ae # may be needed for HP-UX
+
+CFLAGS = $(OPTIONS) $(SYSTEM) $(SYS_CFLAGS) $(CONFIG)
SRCS = main.c \
init.c \
image.c \
network.c \
netserv.c \
- msdos.c
+ msdos.c \
+ system.c \
+ x11.c \
+ sdl.c
OBJS = main.o \
init.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) $(LIBS) -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