rnd-20031019-4-src
[rocksndiamonds.git] / src / Makefile
index 7c897097c3e0d525657834d0daaf69224d575b91..46a9ddd29df4b9bc7fbe225afb15fa1913ef2c5e 100644 (file)
@@ -1,11 +1,16 @@
-#=============================================================================#
-# 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
@@ -64,6 +69,7 @@ TARGET = allegro
 endif
 
 ifeq ($(PLATFORM),cross-win32)
+EXTRA_LDFLAGS = -lshfolder
 PROGNAME = ../$(PROGBASE).exe
 TARGET = sdl
 endif
@@ -75,8 +81,12 @@ endif
 
 ifeq ($(TARGET),sdl)
 SYS_CFLAGS  = -DTARGET_SDL $(shell sdl-config --cflags)
+ifeq ($(PLATFORM),macosx)
+SYS_LDFLAGS = -lSDL_image -lSDL_mixer -lsmpeg $(shell sdl-config --libs)
+else
 SYS_LDFLAGS = -lSDL_image -lSDL_mixer $(shell sdl-config --libs)
 endif
+endif
 
 ifeq ($(TARGET),allegro)
 SYS_CFLAGS = -DTARGET_ALLEGRO -I$(CROSS_PATH_MSDOS)/include
@@ -106,7 +116,8 @@ DEBUG = -DDEBUG -g
 # 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
@@ -153,6 +164,19 @@ OBJS =     main.o          \
        network.o       \
        netserv.o
 
+CNFS = conf_gfx.h      \
+       conf_snd.h      \
+       conf_chr.c      \
+       conf_chr.h      \
+       conf_cus.c      \
+       conf_cus.h      \
+       conf_e2g.c      \
+       conf_esg.c      \
+       conf_e2s.c      \
+       conf_fnt.c
+
+CNFS_CMD = ../Scripts/create_element_defs.pl
+
 TIMESTAMP_FILE = conftime.h
 
 LIBDIR = libgame
@@ -165,6 +189,10 @@ ICON = $(ICONBASE).o
 endif
 
 
+# -----------------------------------------------------------------------------
+# build targets
+# -----------------------------------------------------------------------------
+
 all: libgame_dir $(PROGNAME)
 
 $(PROGNAME): $(LIBGAME) $(TIMESTAMP_FILE) $(OBJS) $(ICON)
@@ -175,13 +203,17 @@ libgame_dir:
 $(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
+       @$(MAKE) auto-conf
 
 conf_snd.h: conf_snd.c
-       ../Scripts/create_element_defs.pl --sounds   > conf_snd.h
+       @$(MAKE) auto-conf
 
 $(TIMESTAMP_FILE): $(SRCS) $(LIBGAME)
        @date '+"[%Y-%m-%d %H:%M]"' \
@@ -211,9 +243,9 @@ clean-bin:
 clean: clean-obj clean-ico clean-bin
 
 
-#-----------------------------------------------------------------------------#
-# development only stuff                                                      #
-#-----------------------------------------------------------------------------#
+# -----------------------------------------------------------------------------
+# development only
+# -----------------------------------------------------------------------------
 
 dist-clean: clean-obj