# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-VERSION=0.4.2
-PACKAGENAME=rockdodger
-NEWD=$(PACKAGENAME)-$(VERSION)
-TMP=/tmp
-OPTIONS=-DVERSION=\"$(VERSION)\"
-SOUNDSOURCE=sound
+debug := $(if $(DEBUG),1,0)
+ldflags := $(shell sdl-config --libs) -lSDL_image -lSDL_mixer
+cflags := $(shell sdl-config --cflags) -Wall -DDEBUG=$(debug) -ggdb
-SOUNDLIBRARIES=-lSDL_mixer
+my_objects := file.o score.o shape.o sound.o main.o $(if $(DEBUG),debug.o)
+libs := SFont.o
+objects := $(libs) $(my_objects)
-LIBRARIES=`sdl-config --libs` -lSDL_image $(SOUNDLIBRARIES)
+rocks := 00 01 02 03 04 05 06 07 08 09
+rocks += 10 11 12 13 14 15 16 17 18 19
+rocks += 20 21 22 23 24 25 26 27 28 29
+rocks += 30 31 32 33 34 35 36 37 38 39
+rocks += 40 41 42 43 44 45 46 47 48 49
+
+graphics := data/sprites/ship.png data/indicators/life.png $(rocks:%=data/sprites/rock%.png)
INSTALL = install
INSTALL_PROGRAM = $(INSTALL) -o games -g games
INSTALL_DATA = $(INSTALL) -m 644
-DATA_PREFIX = /usr/share/rockdodger
+DATA_PREFIX = /usr/share/vor
PROGRAM_PREFIX = /usr/games/bin
-all: rd
-.c.o:
- cc -c -g $? `sdl-config --cflags` $(OPTIONS)
+all: vor $(graphics)
+
+%.o: %.c
+ $(CC) $(cflags) -c -o $@ $<
+
+$(my_objects): config.h
+
+main.o file.o: file.h
+
+vor: $(objects)
+ $(CC) $(ldflags) -o $@ $^ $(LIBRARIES)
-rd: SFont.o $(SOUNDSOURCE).o main.o
- cc -o rd $+ $(LIBRARIES)
+include gfx.mk
clean:
- rm -f *.o rd
+ rm -f *.o vor $(graphics)
install: all
if [ ! -d $(DATA_PREFIX) ]; then mkdir $(DATA_PREFIX); fi
if [ ! -d $(DATA_PREFIX)/sounds ]; then mkdir $(DATA_PREFIX)/sounds; fi
if [ ! -d $(DATA_PREFIX)/sprites ]; then mkdir $(DATA_PREFIX)/sprites; fi
- $(INSTALL_PROGRAM) ./rd $(PROGRAM_PREFIX)
+ $(INSTALL_PROGRAM) ./vor $(PROGRAM_PREFIX)
$(INSTALL_DATA) ./data/banners/* $(DATA_PREFIX)/banners/
$(INSTALL_DATA) ./data/fonts/* $(DATA_PREFIX)/fonts/
$(INSTALL_DATA) ./data/icons/* $(DATA_PREFIX)/icons/
$(INSTALL_DATA) ./data/music/* $(DATA_PREFIX)/music/
$(INSTALL_DATA) ./data/sounds/* $(DATA_PREFIX)/sounds/
$(INSTALL_DATA) ./data/sprites/* $(DATA_PREFIX)/sprites/
- touch $(DATA_PREFIX)/.highscore
- chmod a+rw $(DATA_PREFIX)/.highscore
+ touch $(DATA_PREFIX)/scores
+ chmod a+rw $(DATA_PREFIX)/scores
uninstall:
- rm -f $(PROGRAM_PREFIX)/rd
+ rm -f $(PROGRAM_PREFIX)/vor
rm -f $(DATA_PREFIX)/banners/*
rm -f $(DATA_PREFIX)/fonts/*
rm -f $(DATA_PREFIX)/icons/*
rm -f $(DATA_PREFIX)/music/*
rm -f $(DATA_PREFIX)/sounds/*
rm -f $(DATA_PREFIX)/sprites/*
- rm -f $(DATA_PREFIX)/.highscore
+ rm -f $(DATA_PREFIX)/scores $(DATA_PREFIX)/.highscore
if [ -d $(DATA_PREFIX)/banners ]; then rmdir $(DATA_PREFIX)/banners; fi
if [ -d $(DATA_PREFIX)/fonts ]; then rmdir $(DATA_PREFIX)/fonts; fi