JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
7a2fde712705a507aea28d32dacb48f328b32886
[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 shape.o sound.o main.o $(if $(DEBUG),debug.o)
23 libs := SFont.o
24 objects := $(libs) $(my_objects)
25
26 rocks := 00 01 02 03 04 05 06 07 08 09
27 rocks += 10 11 12 13 14 15 16 17 18 19
28 rocks += 20 21 22 23 24 25 26 27 28 29
29 rocks += 30 31 32 33 34 35 36 37 38 39
30 rocks += 40 41 42 43 44 45 46 47 48 49
31
32 graphics := data/sprites/ship.png data/indicators/life.png $(rocks:%=data/sprites/rock%.png)
33
34 INSTALL = install
35 INSTALL_PROGRAM = $(INSTALL) -o games -g games
36 INSTALL_DATA = $(INSTALL) -m 644
37
38 DATA_PREFIX = /usr/share/vor
39 PROGRAM_PREFIX = /usr/games/bin
40
41
42 all: vor $(graphics)
43
44 %.o: %.c
45         $(CC) $(cflags) -c -o $@ $<
46
47 $(my_objects): config.h
48
49 main.o file.o: file.h
50
51 vor: $(objects)
52         $(CC) $(ldflags) -o $@ $^ $(LIBRARIES)
53
54 pnmoutline: pnmoutline.c
55         $(CC) -lnetpbm -o $@ $<
56
57 include gfx.mk
58
59 clean:
60         rm -f *.o vor pnmoutline $(graphics)
61
62 install:        all
63         if [ ! -d $(DATA_PREFIX) ]; then mkdir $(DATA_PREFIX); fi
64         if [ ! -d $(DATA_PREFIX)/banners ]; then mkdir $(DATA_PREFIX)/banners; fi
65         if [ ! -d $(DATA_PREFIX)/fonts ]; then mkdir $(DATA_PREFIX)/fonts; fi
66         if [ ! -d $(DATA_PREFIX)/icons ]; then mkdir $(DATA_PREFIX)/icons; fi
67         if [ ! -d $(DATA_PREFIX)/indicators ]; then mkdir $(DATA_PREFIX)/indicators; fi
68         if [ ! -d $(DATA_PREFIX)/music ]; then mkdir $(DATA_PREFIX)/music; fi
69         if [ ! -d $(DATA_PREFIX)/sounds ]; then mkdir $(DATA_PREFIX)/sounds; fi
70         if [ ! -d $(DATA_PREFIX)/sprites ]; then mkdir $(DATA_PREFIX)/sprites; fi
71
72         $(INSTALL_PROGRAM) ./vor $(PROGRAM_PREFIX)
73         $(INSTALL_DATA) ./data/banners/* $(DATA_PREFIX)/banners/
74         $(INSTALL_DATA) ./data/fonts/* $(DATA_PREFIX)/fonts/
75         $(INSTALL_DATA) ./data/icons/* $(DATA_PREFIX)/icons/
76         $(INSTALL_DATA) ./data/indicators/* $(DATA_PREFIX)/indicators/
77         $(INSTALL_DATA) ./data/music/* $(DATA_PREFIX)/music/
78         $(INSTALL_DATA) ./data/sounds/* $(DATA_PREFIX)/sounds/
79         $(INSTALL_DATA) ./data/sprites/* $(DATA_PREFIX)/sprites/
80         touch $(DATA_PREFIX)/scores
81         chmod a+rw $(DATA_PREFIX)/scores
82
83 uninstall:
84         rm -f $(PROGRAM_PREFIX)/vor
85         rm -f $(DATA_PREFIX)/banners/*
86         rm -f $(DATA_PREFIX)/fonts/*
87         rm -f $(DATA_PREFIX)/icons/*
88         rm -f $(DATA_PREFIX)/indicators/*
89         rm -f $(DATA_PREFIX)/music/*
90         rm -f $(DATA_PREFIX)/sounds/*
91         rm -f $(DATA_PREFIX)/sprites/*
92         rm -f $(DATA_PREFIX)/scores $(DATA_PREFIX)/.highscore
93
94         if [ -d $(DATA_PREFIX)/banners ]; then rmdir $(DATA_PREFIX)/banners; fi
95         if [ -d $(DATA_PREFIX)/fonts ]; then rmdir $(DATA_PREFIX)/fonts; fi
96         if [ -d $(DATA_PREFIX)/icons ]; then rmdir $(DATA_PREFIX)/icons; fi
97         if [ -d $(DATA_PREFIX)/indicators ]; then rmdir $(DATA_PREFIX)/indicators; fi
98         if [ -d $(DATA_PREFIX)/music ]; then rmdir $(DATA_PREFIX)/music; fi
99         if [ -d $(DATA_PREFIX)/sounds ]; then rmdir $(DATA_PREFIX)/sounds; fi
100         if [ -d $(DATA_PREFIX)/sprites ]; then rmdir $(DATA_PREFIX)/sprites; fi
101         if [ -d $(DATA_PREFIX) ]; then rmdir $(DATA_PREFIX); fi