JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
hmm...apparently you can't strdup a NULL pointer :)
[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 ldflags := $(shell sdl-config --libs) -lSDL_image -lSDL_mixer
19 cflags := $(shell sdl-config --cflags) -Wall
20
21 my_objects := file.o score.o sound.o main.o
22 libs := SFont.o
23 objects := $(libs) $(my_objects)
24
25 INSTALL = install
26 INSTALL_PROGRAM = $(INSTALL) -o games -g games
27 INSTALL_DATA = $(INSTALL) -m 644
28
29 DATA_PREFIX = /usr/share/vor
30 PROGRAM_PREFIX = /usr/games/bin
31
32 all: vor
33
34 %.o: %.c
35         $(CC) $(cflags) -c -o $@ $<
36
37 $(my_objects): config.h
38
39 main.o file.o: file.h
40
41 vor: $(objects)
42         $(CC) $(ldflags) -o $@ $^ $(LIBRARIES)
43
44 clean:
45         rm -f *.o vor
46
47 install:        all
48         if [ ! -d $(DATA_PREFIX) ]; then mkdir $(DATA_PREFIX); fi
49         if [ ! -d $(DATA_PREFIX)/banners ]; then mkdir $(DATA_PREFIX)/banners; fi
50         if [ ! -d $(DATA_PREFIX)/fonts ]; then mkdir $(DATA_PREFIX)/fonts; fi
51         if [ ! -d $(DATA_PREFIX)/icons ]; then mkdir $(DATA_PREFIX)/icons; fi
52         if [ ! -d $(DATA_PREFIX)/indicators ]; then mkdir $(DATA_PREFIX)/indicators; fi
53         if [ ! -d $(DATA_PREFIX)/music ]; then mkdir $(DATA_PREFIX)/music; fi
54         if [ ! -d $(DATA_PREFIX)/sounds ]; then mkdir $(DATA_PREFIX)/sounds; fi
55         if [ ! -d $(DATA_PREFIX)/sprites ]; then mkdir $(DATA_PREFIX)/sprites; fi
56
57         $(INSTALL_PROGRAM) ./vor $(PROGRAM_PREFIX)
58         $(INSTALL_DATA) ./data/banners/* $(DATA_PREFIX)/banners/
59         $(INSTALL_DATA) ./data/fonts/* $(DATA_PREFIX)/fonts/
60         $(INSTALL_DATA) ./data/icons/* $(DATA_PREFIX)/icons/
61         $(INSTALL_DATA) ./data/indicators/* $(DATA_PREFIX)/indicators/
62         $(INSTALL_DATA) ./data/music/* $(DATA_PREFIX)/music/
63         $(INSTALL_DATA) ./data/sounds/* $(DATA_PREFIX)/sounds/
64         $(INSTALL_DATA) ./data/sprites/* $(DATA_PREFIX)/sprites/
65         touch $(DATA_PREFIX)/scores
66         chmod a+rw $(DATA_PREFIX)/scores
67
68 uninstall:
69         rm -f $(PROGRAM_PREFIX)/vor
70         rm -f $(DATA_PREFIX)/banners/*
71         rm -f $(DATA_PREFIX)/fonts/*
72         rm -f $(DATA_PREFIX)/icons/*
73         rm -f $(DATA_PREFIX)/indicators/*
74         rm -f $(DATA_PREFIX)/music/*
75         rm -f $(DATA_PREFIX)/sounds/*
76         rm -f $(DATA_PREFIX)/sprites/*
77         rm -f $(DATA_PREFIX)/scores $(DATA_PREFIX)/.highscore
78
79         if [ -d $(DATA_PREFIX)/banners ]; then rmdir $(DATA_PREFIX)/banners; fi
80         if [ -d $(DATA_PREFIX)/fonts ]; then rmdir $(DATA_PREFIX)/fonts; fi
81         if [ -d $(DATA_PREFIX)/icons ]; then rmdir $(DATA_PREFIX)/icons; fi
82         if [ -d $(DATA_PREFIX)/indicators ]; then rmdir $(DATA_PREFIX)/indicators; fi
83         if [ -d $(DATA_PREFIX)/music ]; then rmdir $(DATA_PREFIX)/music; fi
84         if [ -d $(DATA_PREFIX)/sounds ]; then rmdir $(DATA_PREFIX)/sounds; fi
85         if [ -d $(DATA_PREFIX)/sprites ]; then rmdir $(DATA_PREFIX)/sprites; fi
86         if [ -d $(DATA_PREFIX) ]; then rmdir $(DATA_PREFIX); fi