1 # Variations on Rockdodger
2 # Copyright (C) 2004 Joshua Grams <josh@qualdan.com>
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.
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.
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
18 DATA_PREFIX := /usr/share/vor
19 PROGRAM_PREFIX := /usr/games/bin
21 debug := $(if $(DEBUG),-DDEBUG=1)
22 paths := -DDATA_PREFIX=\"$(DATA_PREFIX)\"
23 sdl-cflags := $(shell sdl-config --cflags)
24 sdl-ldflags := $(shell sdl-config --libs)
26 ldflags := $(sdl-ldflags) -lSDL_image -lSDL_mixer
27 cflags := $(sdl-cflags) $(debug) $(paths) $(CFLAGS)
29 my_objects := args.o file.o rocks.o score.o shape.o sound.o
30 my_objects += $(if $(DEBUG),debug.o) main.o
32 objects := $(libs) $(my_objects)
34 rocks := 00 01 02 03 04 05 06 07 08 09
35 rocks += 10 11 12 13 14 15 16 17 18 19
36 rocks += 20 21 22 23 24 25 26 27 28 29
37 rocks += 30 31 32 33 34 35 36 37 38 39
38 rocks += 40 41 42 43 44 45 46 47 48 49
39 rocks := $(rocks:%=data/sprites/rock%.png)
40 graphics := data/sprites/ship.png data/indicators/life.png $(rocks)
43 INSTALL_PROGRAM := $(INSTALL) -o games -g games
44 INSTALL_DATA := $(INSTALL) -m 644
47 .PHONY: all clean maintainer-clean install uninstall
48 .PHONY: mkinstalldirs rminstalldirs
49 .PHONY: program program-clean install-program uninstall-program
50 .PHONY: data data-clean install-data uninstall-data
59 @echo compiling $@ from $<
60 @$(CC) $(cflags) -c -o $@ $<
62 $(my_objects): config.h
67 @echo linking $@ from $^
68 @$(CC) $(ldflags) -o $@ $^ $(LIBRARIES)
74 maintainer-clean: program-clean data-clean
83 if [ ! -d $(DATA_PREFIX) ]; then mkdir $(DATA_PREFIX); fi
84 if [ ! -d $(DATA_PREFIX)/banners ]; then mkdir $(DATA_PREFIX)/banners; fi
85 if [ ! -d $(DATA_PREFIX)/fonts ]; then mkdir $(DATA_PREFIX)/fonts; fi
86 if [ ! -d $(DATA_PREFIX)/icons ]; then mkdir $(DATA_PREFIX)/icons; fi
87 if [ ! -d $(DATA_PREFIX)/indicators ]; then mkdir $(DATA_PREFIX)/indicators; fi
88 if [ ! -d $(DATA_PREFIX)/music ]; then mkdir $(DATA_PREFIX)/music; fi
89 if [ ! -d $(DATA_PREFIX)/sounds ]; then mkdir $(DATA_PREFIX)/sounds; fi
90 if [ ! -d $(DATA_PREFIX)/sprites ]; then mkdir $(DATA_PREFIX)/sprites; fi
93 if [ -d $(DATA_PREFIX)/banners ]; then rmdir $(DATA_PREFIX)/banners; fi
94 if [ -d $(DATA_PREFIX)/fonts ]; then rmdir $(DATA_PREFIX)/fonts; fi
95 if [ -d $(DATA_PREFIX)/icons ]; then rmdir $(DATA_PREFIX)/icons; fi
96 if [ -d $(DATA_PREFIX)/indicators ]; then rmdir $(DATA_PREFIX)/indicators; fi
97 if [ -d $(DATA_PREFIX)/music ]; then rmdir $(DATA_PREFIX)/music; fi
98 if [ -d $(DATA_PREFIX)/sounds ]; then rmdir $(DATA_PREFIX)/sounds; fi
99 if [ -d $(DATA_PREFIX)/sprites ]; then rmdir $(DATA_PREFIX)/sprites; fi
100 if [ -d $(DATA_PREFIX) ]; then rmdir $(DATA_PREFIX); fi
102 install: all mkinstalldirs install-program install-data
104 install-program: program
105 $(INSTALL_PROGRAM) ./vor $(PROGRAM_PREFIX)
108 $(INSTALL_DATA) ./data/banners/* $(DATA_PREFIX)/banners/
109 $(INSTALL_DATA) ./data/fonts/* $(DATA_PREFIX)/fonts/
110 $(INSTALL_DATA) ./data/icons/* $(DATA_PREFIX)/icons/
111 $(INSTALL_DATA) ./data/indicators/* $(DATA_PREFIX)/indicators/
112 $(INSTALL_DATA) ./data/music/* $(DATA_PREFIX)/music/
113 $(INSTALL_DATA) ./data/sounds/* $(DATA_PREFIX)/sounds/
114 $(INSTALL_DATA) ./data/sprites/* $(DATA_PREFIX)/sprites/
116 uninstall: uninstall-program uninstall-data rminstalldirs
119 rm -f $(PROGRAM_PREFIX)/vor
122 rm -f $(DATA_PREFIX)/banners/*
123 rm -f $(DATA_PREFIX)/fonts/*
124 rm -f $(DATA_PREFIX)/icons/*
125 rm -f $(DATA_PREFIX)/indicators/*
126 rm -f $(DATA_PREFIX)/music/*
127 rm -f $(DATA_PREFIX)/sounds/*
128 rm -f $(DATA_PREFIX)/sprites/*
129 rm -f $(DATA_PREFIX)/scores