JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
fixed makebangdots to check surface's colorkey.
[vor.git] / Makefile
1 #   Rock Dodger! Avoid the rocks as long as you can!
2 #   Copyright (C) 2001  Paul Holt <pad@pcholt.com>
3
4 #   This program is free software; you can redistribute it and/or modify
5 #   it under the terms of the GNU General Public License as published by
6 #   the Free Software Foundation; either version 2 of the License, or
7 #   (at your option) any later version.
8
9 #   This program is distributed in the hope that it will be useful,
10 #   but WITHOUT ANY WARRANTY; without even the implied warranty of
11 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 #   GNU General Public License for more details.
13
14 #   You should have received a copy of the GNU General Public License
15 #   along with this program; if not, write to the Free Software
16 #   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
18 debug := $(if $(DEBUG),1,0)
19 ldflags := $(shell sdl-config --libs) -lSDL_image -lSDL_mixer
20 cflags := $(shell sdl-config --cflags) -Wall -DDEBUG=$(debug)
21
22 my_objects := file.o score.o sound.o main.o $(if $(DEBUG),debug.o)
23 libs := SFont.o
24 objects := $(libs) $(my_objects)
25
26 INSTALL = install
27 INSTALL_PROGRAM = $(INSTALL) -o games -g games
28 INSTALL_DATA = $(INSTALL) -m 644
29
30 DATA_PREFIX = /usr/share/vor
31 PROGRAM_PREFIX = /usr/games/bin
32
33 all: vor data/sprites/ship.png
34
35 %.o: %.c
36         $(CC) $(cflags) -c -o $@ $<
37
38 $(my_objects): config.h
39
40 main.o file.o: file.h
41
42 vor: $(objects)
43         $(CC) $(ldflags) -o $@ $^ $(LIBRARIES)
44
45 pnmoutline: pnmoutline.c
46         $(CC) -lnetpbm -o $@ $<
47
48 data/sprites/ship.png: ship.pov pnmoutline Makefile
49         povray -GA -D +A +UA +W32 +H32 $< >/dev/null 2>/dev/null
50         pngtopnm ship.png >ship.pnm
51         ./pnmoutline <ship.pnm >data/sprites/ship.pnm
52         pnmtopng -transparent =white data/sprites/ship.pnm >$@
53         rm ship.png ship.pnm data/sprites/ship.pnm
54
55 clean:
56         rm -f *.o vor pnmoutline data/sprites/ship.png
57
58 install:        all
59         if [ ! -d $(DATA_PREFIX) ]; then mkdir $(DATA_PREFIX); fi
60         if [ ! -d $(DATA_PREFIX)/banners ]; then mkdir $(DATA_PREFIX)/banners; fi
61         if [ ! -d $(DATA_PREFIX)/fonts ]; then mkdir $(DATA_PREFIX)/fonts; fi
62         if [ ! -d $(DATA_PREFIX)/icons ]; then mkdir $(DATA_PREFIX)/icons; fi
63         if [ ! -d $(DATA_PREFIX)/indicators ]; then mkdir $(DATA_PREFIX)/indicators; fi
64         if [ ! -d $(DATA_PREFIX)/music ]; then mkdir $(DATA_PREFIX)/music; fi
65         if [ ! -d $(DATA_PREFIX)/sounds ]; then mkdir $(DATA_PREFIX)/sounds; fi
66         if [ ! -d $(DATA_PREFIX)/sprites ]; then mkdir $(DATA_PREFIX)/sprites; fi
67
68         $(INSTALL_PROGRAM) ./vor $(PROGRAM_PREFIX)
69         $(INSTALL_DATA) ./data/banners/* $(DATA_PREFIX)/banners/
70         $(INSTALL_DATA) ./data/fonts/* $(DATA_PREFIX)/fonts/
71         $(INSTALL_DATA) ./data/icons/* $(DATA_PREFIX)/icons/
72         $(INSTALL_DATA) ./data/indicators/* $(DATA_PREFIX)/indicators/
73         $(INSTALL_DATA) ./data/music/* $(DATA_PREFIX)/music/
74         $(INSTALL_DATA) ./data/sounds/* $(DATA_PREFIX)/sounds/
75         $(INSTALL_DATA) ./data/sprites/* $(DATA_PREFIX)/sprites/
76         touch $(DATA_PREFIX)/scores
77         chmod a+rw $(DATA_PREFIX)/scores
78
79 uninstall:
80         rm -f $(PROGRAM_PREFIX)/vor
81         rm -f $(DATA_PREFIX)/banners/*
82         rm -f $(DATA_PREFIX)/fonts/*
83         rm -f $(DATA_PREFIX)/icons/*
84         rm -f $(DATA_PREFIX)/indicators/*
85         rm -f $(DATA_PREFIX)/music/*
86         rm -f $(DATA_PREFIX)/sounds/*
87         rm -f $(DATA_PREFIX)/sprites/*
88         rm -f $(DATA_PREFIX)/scores $(DATA_PREFIX)/.highscore
89
90         if [ -d $(DATA_PREFIX)/banners ]; then rmdir $(DATA_PREFIX)/banners; fi
91         if [ -d $(DATA_PREFIX)/fonts ]; then rmdir $(DATA_PREFIX)/fonts; fi
92         if [ -d $(DATA_PREFIX)/icons ]; then rmdir $(DATA_PREFIX)/icons; fi
93         if [ -d $(DATA_PREFIX)/indicators ]; then rmdir $(DATA_PREFIX)/indicators; fi
94         if [ -d $(DATA_PREFIX)/music ]; then rmdir $(DATA_PREFIX)/music; fi
95         if [ -d $(DATA_PREFIX)/sounds ]; then rmdir $(DATA_PREFIX)/sounds; fi
96         if [ -d $(DATA_PREFIX)/sprites ]; then rmdir $(DATA_PREFIX)/sprites; fi
97         if [ -d $(DATA_PREFIX) ]; then rmdir $(DATA_PREFIX); fi