JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
now using netpbm stuff to generate proper ship image.
[vor.git] / Makefile
index 25b8200..4c95ae4 100644 (file)
--- a/Makefile
+++ b/Makefile
 #   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.1
-PACKAGENAME=vor
-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)
 
-SOUNDLIBRARIES=-lSDL_mixer
-
-LIBRARIES=`sdl-config --libs` -lSDL_image $(SOUNDLIBRARIES)
+my_objects := file.o score.o sound.o main.o $(if $(DEBUG),debug.o)
+libs := SFont.o
+objects := $(libs) $(my_objects)
 
 INSTALL = install
 INSTALL_PROGRAM = $(INSTALL) -o games -g games
@@ -33,16 +30,30 @@ INSTALL_DATA = $(INSTALL) -m 644
 DATA_PREFIX = /usr/share/vor
 PROGRAM_PREFIX = /usr/games/bin
 
-all: vor
+all: vor data/sprites/ship.png
+
+%.o: %.c
+       $(CC) $(cflags) -c -o $@ $<
+
+$(my_objects): config.h
+
+main.o file.o: file.h
+
+vor: $(objects)
+       $(CC) $(ldflags) -o $@ $^ $(LIBRARIES)
 
-.c.o:
-       cc -c -g $? `sdl-config --cflags` $(OPTIONS)
+pnmoutline: pnmoutline.c
+       $(CC) -lnetpbm -o $@ $<
 
-vor:   SFont.o $(SOUNDSOURCE).o main.o
-       cc -o $@ $+ $(LIBRARIES)
+data/sprites/ship.png: ship.pov pnmoutline Makefile
+       povray -GA -D +A +UA +W32 +H32 $< >/dev/null 2>/dev/null
+       pngtopnm ship.png >ship.pnm
+       ./pnmoutline <ship.pnm >data/sprites/ship.pnm
+       pnmtopng -transparent =white data/sprites/ship.pnm >$@
+       rm ship.png ship.pnm data/sprites/ship.pnm
 
 clean:
-       rm -f *.o vor
+       rm -f *.o vor pnmoutline data/sprites/ship.png
 
 install:       all
        if [ ! -d $(DATA_PREFIX) ]; then mkdir $(DATA_PREFIX); fi
@@ -62,8 +73,8 @@ install:      all
        $(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)/vor
@@ -74,7 +85,7 @@ uninstall:
        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