JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
fixed bug when you bounce off the left or right
[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) $(CFLAGS)
21
22 my_objects := file.o rocks.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 include gfx.mk
55
56 clean:
57         rm -f *.o vor $(graphics)
58
59 install:        all
60         if [ ! -d $(DATA_PREFIX) ]; then mkdir $(DATA_PREFIX); fi
61         if [ ! -d $(DATA_PREFIX)/banners ]; then mkdir $(DATA_PREFIX)/banners; fi
62         if [ ! -d $(DATA_PREFIX)/fonts ]; then mkdir $(DATA_PREFIX)/fonts; fi
63         if [ ! -d $(DATA_PREFIX)/icons ]; then mkdir $(DATA_PREFIX)/icons; fi
64         if [ ! -d $(DATA_PREFIX)/indicators ]; then mkdir $(DATA_PREFIX)/indicators; fi
65         if [ ! -d $(DATA_PREFIX)/music ]; then mkdir $(DATA_PREFIX)/music; fi
66         if [ ! -d $(DATA_PREFIX)/sounds ]; then mkdir $(DATA_PREFIX)/sounds; fi
67         if [ ! -d $(DATA_PREFIX)/sprites ]; then mkdir $(DATA_PREFIX)/sprites; fi
68
69         $(INSTALL_PROGRAM) ./vor $(PROGRAM_PREFIX)
70         $(INSTALL_DATA) ./data/banners/* $(DATA_PREFIX)/banners/
71         $(INSTALL_DATA) ./data/fonts/* $(DATA_PREFIX)/fonts/
72         $(INSTALL_DATA) ./data/icons/* $(DATA_PREFIX)/icons/
73         $(INSTALL_DATA) ./data/indicators/* $(DATA_PREFIX)/indicators/
74         $(INSTALL_DATA) ./data/music/* $(DATA_PREFIX)/music/
75         $(INSTALL_DATA) ./data/sounds/* $(DATA_PREFIX)/sounds/
76         $(INSTALL_DATA) ./data/sprites/* $(DATA_PREFIX)/sprites/
77         touch $(DATA_PREFIX)/scores
78         chmod a+rw $(DATA_PREFIX)/scores
79
80 uninstall:
81         rm -f $(PROGRAM_PREFIX)/vor
82         rm -f $(DATA_PREFIX)/banners/*
83         rm -f $(DATA_PREFIX)/fonts/*
84         rm -f $(DATA_PREFIX)/icons/*
85         rm -f $(DATA_PREFIX)/indicators/*
86         rm -f $(DATA_PREFIX)/music/*
87         rm -f $(DATA_PREFIX)/sounds/*
88         rm -f $(DATA_PREFIX)/sprites/*
89         rm -f $(DATA_PREFIX)/scores $(DATA_PREFIX)/.highscore
90
91         if [ -d $(DATA_PREFIX)/banners ]; then rmdir $(DATA_PREFIX)/banners; fi
92         if [ -d $(DATA_PREFIX)/fonts ]; then rmdir $(DATA_PREFIX)/fonts; fi
93         if [ -d $(DATA_PREFIX)/icons ]; then rmdir $(DATA_PREFIX)/icons; fi
94         if [ -d $(DATA_PREFIX)/indicators ]; then rmdir $(DATA_PREFIX)/indicators; fi
95         if [ -d $(DATA_PREFIX)/music ]; then rmdir $(DATA_PREFIX)/music; fi
96         if [ -d $(DATA_PREFIX)/sounds ]; then rmdir $(DATA_PREFIX)/sounds; fi
97         if [ -d $(DATA_PREFIX)/sprites ]; then rmdir $(DATA_PREFIX)/sprites; fi
98         if [ -d $(DATA_PREFIX) ]; then rmdir $(DATA_PREFIX); fi