1 # =============================================================================
2 # Rocks'n'Diamonds Makefile (src)
3 # -----------------------------------------------------------------------------
4 # (c) 1995-2003 Holger Schemel <info@artsoft.org>
5 # =============================================================================
7 # -----------------------------------------------------------------------------
9 # -----------------------------------------------------------------------------
11 .EXPORT_ALL_VARIABLES:
13 ifndef PLATFORM # no platform specified -- try auto detection
21 ifdef X11_PATH # path to X11 specified by top level Makefile
22 XINC_PATH = $(X11_PATH)/include
23 XLIB_PATH = $(X11_PATH)/lib
24 X11_INCL = -I$(XINC_PATH)
25 X11_LIBS = -L$(XLIB_PATH) -lX11
34 ifeq ($(PLATFORM),msdos) # MS-DOS native compiling
39 PROGNAME = ../$(PROGBASE).exe
41 SYS_CFLAGS = -DTARGET_X11
42 SYS_LDFLAGS = -s -lalleg
44 else # Unix or cross-compiling for MS-DOS and Win32
48 PROGBASE = rocksndiamonds
49 PROGNAME = ../$(PROGBASE)
51 ifeq ($(PLATFORM),solaris)
52 EXTRA_LDFLAGS = -lnsl -lsocket -R$(XLIB_PATH)
56 ifeq ($(PLATFORM),macosx)
61 ifeq ($(PLATFORM),os2)
63 PROGNAME = ../$(PROGBASE).exe
64 EXTRA_CFLAGS = -Zbin-files -D__ST_MT_ERRNO__ -Zmtd -fomit-frame-pointer
65 EXTRA_LDFLAGS = -lsocket
70 ifeq ($(PLATFORM),unix)
74 ifeq ($(PLATFORM),cross-msdos)
76 PROGNAME = ../$(PROGBASE).exe
80 ifeq ($(PLATFORM),cross-win32)
81 EXTRA_LDFLAGS = -lshfolder -lwsock32
82 PROGNAME = ../$(PROGBASE).exe
87 SYS_CFLAGS = -DTARGET_X11 $(X11_INCL)
88 SYS_LDFLAGS = $(X11_LIBS)
92 SYS_CFLAGS = -DTARGET_SDL $(shell sdl-config --cflags)
93 SDL_LIBS = -lSDL_image -lSDL_mixer -lSDL_net -lsmpeg
94 SYS_LDFLAGS = $(SDL_LIBS) $(shell sdl-config --libs)
97 ifeq ($(TARGET),allegro)
98 SYS_CFLAGS = -DTARGET_ALLEGRO -I$(CROSS_PATH_MSDOS)/include
102 endif # (PLATFORM != msdos)
105 ifdef RO_GAME_DIR # path to read-only game data specified
106 CONFIG_RO_GAME_DIR = -DRO_GAME_DIR="\"$(RO_GAME_DIR)\""
109 ifdef RW_GAME_DIR # path to writable game data specified
110 CONFIG_RW_GAME_DIR = -DRW_GAME_DIR="\"$(RW_GAME_DIR)\""
113 ifdef SCORE_ENTRIES # number of score entries per player specified
114 CONFIG_SCORE_ENTRIES = -D$(SCORE_ENTRIES)
117 CONFIG_GAME_DIR = $(CONFIG_RO_GAME_DIR) $(CONFIG_RW_GAME_DIR)
120 CONFIG = $(CONFIG_GAME_DIR) $(CONFIG_SCORE_ENTRIES) $(JOYSTICK)
122 # PROFILING = $(PROFILING_FLAGS)
124 # OPTIONS = $(DEBUG) -Wall # only for debugging purposes
125 # OPTIONS = $(DEBUG) -O3 -Wall # only for debugging purposes
126 OPTIONS = $(DEBUG) -Wall # only for debugging purposes
127 # OPTIONS = $(DEBUG) -Wall -ansi -pedantic # only for debugging purposes
128 # OPTIONS = -O3 -Wall -ansi -pedantic
129 # OPTIONS = -O3 -Wall
131 # OPTIONS = -DSYSV -Ae # may be needed for HP-UX
133 ifdef BUILD_DIST # distribution build
137 CFLAGS = $(OPTIONS) $(SYS_CFLAGS) $(EXTRA_CFLAGS) $(CONFIG)
138 LDFLAGS = $(SYS_LDFLAGS) $(EXTRA_LDFLAGS) -lm
193 CNFS_CMD = ../Scripts/create_element_defs.pl
195 TIMESTAMP_FILE = conftime.h
198 LIBGAME = $(LIBDIR)/libgame.a
200 ICONBASE = windows_icon
201 ifeq ($(PLATFORM),cross-win32)
202 ICON32X32 = ../graphics/$(ICONBASE)_32x32.bmp
207 # -----------------------------------------------------------------------------
209 # -----------------------------------------------------------------------------
211 all: libgame_dir $(PROGNAME)
213 $(PROGNAME): $(LIBGAME) $(TIMESTAMP_FILE) $(OBJS) $(ICON)
214 $(CC) $(PROFILING) $(OBJS) $(ICON) $(LIBGAME) $(LDFLAGS) -o $(PROGNAME)
217 @$(MAKE) -C $(LIBDIR)
219 @$(MAKE) -C $(LIBDIR)
222 @for i in $(CNFS); do \
223 echo "$(CNFS_CMD) $$i > $$i"; \
224 $(CNFS_CMD) $$i > $$i; \
227 conf_gfx.h: conf_gfx.c
230 conf_snd.h: conf_snd.c
233 conf_mus.h: conf_mus.c
236 $(TIMESTAMP_FILE): $(SRCS) $(LIBGAME)
237 @date '+"[%Y-%m-%d %H:%M]"' \
238 | sed -e 's/^/#define COMPILE_DATE_STRING /' \
242 $(BMP2ICO) -transparent $(ICONBASE).ico $(ICON32X32)
243 echo "$(ICONBASE) ICON $(ICONBASE).ico" | $(WINDRES) -o $(ICON)
246 $(CC) $(PROFILING) $(CFLAGS) -c $*.c
249 $(MAKE) -C $(LIBDIR) clean
254 $(RM) $(ICONBASE).ico
261 clean: clean-obj clean-ico clean-bin
264 # -----------------------------------------------------------------------------
266 # -----------------------------------------------------------------------------
268 dist-clean: clean-obj
271 $(MAKE) -C $(LIBDIR) depend
272 for i in $(SRCS); do $(CPP) $(CFLAGS) -M $$i; done > .depend
274 ifeq (.depend,$(wildcard .depend))