-#=============================================================================#
-# Makefile for Rocks'n'Diamonds #
-# (c) 1995-2002 Holger Schemel, info@artsoft.org #
-#=============================================================================#
+# =============================================================================
+# Rocks'n'Diamonds Makefile (src)
+# -----------------------------------------------------------------------------
+# (c) 1995-2003 Holger Schemel <info@artsoft.org>
+# =============================================================================
+
+# -----------------------------------------------------------------------------
+# configuration
+# -----------------------------------------------------------------------------
.EXPORT_ALL_VARIABLES:
-ifndef PLATFORM # platform not specified -- try auto detection
+ifndef PLATFORM # no platform specified -- try auto detection
ifdef COMSPEC
PLATFORM = msdos
else
TARGET=sdl
endif
+ifeq ($(PLATFORM),os2)
+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)
PROFILING_FLAGS = -pg
endif
endif
ifeq ($(PLATFORM),cross-win32)
+EXTRA_LDFLAGS = -lshfolder -lwsock32
PROGNAME = ../$(PROGBASE).exe
TARGET = sdl
endif
ifeq ($(TARGET),sdl)
SYS_CFLAGS = -DTARGET_SDL $(shell sdl-config --cflags)
-SYS_LDFLAGS = -lSDL_image -lSDL_mixer $(shell sdl-config --libs)
+ifeq ($(PLATFORM),macosx)
+SYS_LDFLAGS = -lSDL_image -lSDL_mixer -lsmpeg $(shell sdl-config --libs)
+else
+SYS_LDFLAGS = -lSDL_image -lSDL_mixer -lSDL_net $(shell sdl-config --libs)
+endif
endif
ifeq ($(TARGET),allegro)
# PROFILING = $(PROFILING_FLAGS)
# OPTIONS = $(DEBUG) -Wall # only for debugging purposes
-OPTIONS = $(DEBUG) -O3 -Wall # only for debugging purposes
+# OPTIONS = $(DEBUG) -O3 -Wall # only for debugging purposes
+OPTIONS = $(DEBUG) -Wall # only for debugging purposes
# OPTIONS = $(DEBUG) -Wall -ansi -pedantic # only for debugging purposes
# OPTIONS = -O3 -Wall -ansi -pedantic
# OPTIONS = -O3 -Wall
OPTIONS = -O3 -Wall
endif
-CFLAGS = $(OPTIONS) $(SYS_CFLAGS) $(CONFIG)
-LDFLAGS = $(SYS_LDFLAGS) $(EXTRA_LDFLAGS) -lm
+CFLAGS = $(OPTIONS) $(SYS_CFLAGS) $(EXTRA_CFLAGS) $(CONFIG)
+LDFLAGS = $(SYS_LDFLAGS) $(EXTRA_LDFLAGS) -lm
SRCS = main.c \
conf_gfx.c \
conf_snd.c \
+ conf_mus.c \
+ conf_hlp.c \
init.c \
config.c \
events.c \
OBJS = main.o \
conf_gfx.o \
conf_snd.o \
+ conf_mus.o \
+ conf_hlp.o \
init.o \
config.o \
events.o \
network.o \
netserv.o
+CNFS = conf_gfx.h \
+ conf_snd.h \
+ conf_mus.h \
+ conf_chr.c \
+ conf_chr.h \
+ conf_cus.c \
+ conf_cus.h \
+ conf_grp.c \
+ conf_grp.h \
+ conf_e2g.c \
+ conf_esg.c \
+ conf_e2s.c \
+ conf_fnt.c \
+ conf_g2s.c \
+ conf_g2m.c
+
+CNFS_CMD = ../Scripts/create_element_defs.pl
+
TIMESTAMP_FILE = conftime.h
LIBDIR = libgame
endif
+# -----------------------------------------------------------------------------
+# build targets
+# -----------------------------------------------------------------------------
+
all: libgame_dir $(PROGNAME)
$(PROGNAME): $(LIBGAME) $(TIMESTAMP_FILE) $(OBJS) $(ICON)
$(LIBGAME):
@$(MAKE) -C $(LIBDIR)
+auto-conf:
+ @for i in $(CNFS); do \
+ echo "$(CNFS_CMD) $$i > $$i"; \
+ $(CNFS_CMD) $$i > $$i; \
+ done
+
conf_gfx.h: conf_gfx.c
- ../Scripts/create_element_defs.pl --graphics > conf_gfx.h
- ../Scripts/create_element_defs.pl --el2gfx > conf_e2g.c
- ../Scripts/create_element_defs.pl --chars > conf_chr.c
- ../Scripts/create_element_defs.pl --custom > conf_cus.c
+ @$(MAKE) auto-conf
conf_snd.h: conf_snd.c
- ../Scripts/create_element_defs.pl --sounds > conf_snd.h
+ @$(MAKE) auto-conf
+
+conf_mus.h: conf_mus.c
+ @$(MAKE) auto-conf
$(TIMESTAMP_FILE): $(SRCS) $(LIBGAME)
@date '+"[%Y-%m-%d %H:%M]"' \
clean: clean-obj clean-ico clean-bin
-#-----------------------------------------------------------------------------#
-# development only stuff #
-#-----------------------------------------------------------------------------#
+# -----------------------------------------------------------------------------
+# development only
+# -----------------------------------------------------------------------------
dist-clean: clean-obj