JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
font.c: don't assume 3 bytes per pixel
[vor.git] / Makefile.in
1 #   Variations on Rockdodger
2 #   Copyright (C) 2004  Joshua Grams <josh@qualdan.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
19 SHELL = /bin/sh
20 VPATH = @srcdir@
21
22 srcdir = @srcdir@
23 prefix = @prefix@
24 exec_prefix = @exec_prefix@
25 datarootdir = @datarootdir@
26 datadir = @datadir@
27 pkgdatadir = $(datadir)/@PACKAGE_TARNAME@
28 bindir = @bindir@
29
30 CC = @CC@
31 CPPFLAGS = @CPPFLAGS@
32 CFLAGS = $(CPPFLAGS) @CFLAGS@
33 LDFLAGS = @LDFLAGS@
34 LIBS = @LIBS@
35 INSTALL = @INSTALL@
36
37
38 exe_name = @PACKAGE_TARNAME@@EXEEXT@
39
40
41
42 paths := -DDATA_PREFIX=\"$(pkgdatadir)\"
43 SDL_CFLAGS := @SDL_CFLAGS@
44 SDL_LIBS := @SDL_LIBS@
45
46 ldflags := $(SDL_LIBS) -lSDL_image -lSDL_mixer $(LDFLAGS)
47 cflags := -I. $(SDL_CFLAGS) $(paths) $(CFLAGS)
48
49 my_objects := args.@OBJEXT@ dust.@OBJEXT@ file.@OBJEXT@ mt.@OBJEXT@ rocks.@OBJEXT@ score.@OBJEXT@ sprite.@OBJEXT@ sound.@OBJEXT@ autopilot.@OBJEXT@
50 my_objects += main.@OBJEXT@
51 libs := font.@OBJEXT@
52 objects := $(libs) $(my_objects)
53
54 rocks := 00 01 02 03 04 05 06 07 08 09
55 rocks += 10 11 12 13 14 15 16 17 18 19
56 rocks += 20 21 22 23 24 25 26 27 28 29
57 rocks += 30 31 32 33 34 35 36 37 38 39
58 rocks += 40 41 42 43 44 45 46 47 48 49
59 rocks := $(rocks:%=data/rock%.png)
60 graphics := data/ship.png data/icon.png data/life.png data/font.png $(rocks)
61
62 INSTALL := install
63 INSTALL_PROGRAM := $(INSTALL)
64 INSTALL_DATA := $(INSTALL) -m 644
65
66
67 .PHONY: all clean maintainer-clean install uninstall
68 .PHONY: mkinstalldirs rminstalldirs
69 .PHONY: program program-clean install-program uninstall-program
70 .PHONY: data data-clean install-data uninstall-data
71 .PHONY: build-dir-data-link
72
73 .INTERMEDIATE: font_guts font_guts.pov
74
75 all: program data
76
77 data: $(graphics) build-dir-data-link
78
79 # symbolic link to data dir so you can run the game from the build dir:
80 build-dir-data-link:
81         test -e data || ln -s $(srcdir)/data
82
83 program: $(exe_name) @PACKAGE_TARNAME@.desktop
84
85 %.@OBJEXT@: %.c
86         $(CC) $(cflags) -c -o $@ $<
87
88 $(my_objects): vorconfig.h
89
90 font.@OBJEXT@: font.h
91
92 args.@OBJEXT@: args.h config.h
93
94 dust.@OBJEXT@: globals.h dust.h float.h mt.h
95
96 file.@OBJEXT@: file.h common.h
97
98 main.@OBJEXT@: args.h common.h config.h dust.h file.h float.h globals.h mt.h rocks.h score.h sprite.h sound.h autopilot.h
99
100 mt.@OBJEXT@: mt.h
101
102 rocks.@OBJEXT@: rocks.h common.h file.h globals.h mt.h sprite.h
103
104 score.@OBJEXT@: score.h common.h file.h
105
106 sound.@OBJEXT@: sound.h args.h common.h
107
108 sprite.@OBJEXT@: sprite.h common.h
109
110 @PACKAGE_TARNAME@.desktop: @PACKAGE_TARNAME@.desktop.in
111         sed -e "s|EXE_NAME|$(exe_name)|g" -e "s|DISPLAY_NAME|@PACKAGE_NAME@|g" -e "s|ICON_PATH|$(pkgdatadir)|g" $< > $@ || sh -c "rm $@; false"
112
113 $(exe_name): $(objects)
114         $(CC) $^ $(ldflags) -o $@
115
116 include $(srcdir)/gfx.mk
117
118 tags: *.c *.h
119         exuberant-ctags *.c *.h /usr/include/SDL/*
120
121 clean: program-clean
122         rm -f tags
123
124 distclean: clean
125         rm -f Makefile config.h config.log config.status
126
127 maintainer-clean: distclean
128         @echo 'This command is intended for maintainers to use; it'
129         @echo 'deletes files that may need special tools to rebuild.'
130         rm -f $(graphics) font_guts font_guts.pov
131
132 program-clean:
133         rm -f *.@OBJEXT@ $(exe_name) @PACKAGE_TARNAME@.desktop
134
135 mkinstalldirs:
136         if [ ! -d $(DESTDIR)$(pkgdatadir) ]; then mkdir -p $(DESTDIR)$(pkgdatadir); fi
137         if [ ! -d $(DESTDIR)$(bindir) ]; then mkdir -p $(DESTDIR)$(bindir); fi
138
139 rminstalldirs: uninstall-data
140         if [ -d $(DESTDIR)$(pkgdatadir) ]; then rmdir $(DESTDIR)$(pkgdatadir); fi
141
142
143 install-desktop-file-note: @PACKAGE_TARNAME@.desktop install-files
144         @echo
145         @echo "If you've installed system wide, you may want to run: make install-desktop-file"
146         @echo '(as root) to install a menu entry for @PACKAGE_NAME@'
147
148 install-desktop-file: @PACKAGE_TARNAME@.desktop
149         desktop-file-install @PACKAGE_TARNAME@.desktop
150
151 install-files: all mkinstalldirs install-program install-data
152
153 install: install-files install-desktop-file-note
154
155 install-program: program
156         $(INSTALL_PROGRAM) ./$(exe_name) $(DESTDIR)$(bindir)/
157
158 install-data: data mkinstalldirs
159         $(INSTALL_DATA) $(srcdir)/data/*.png $(DESTDIR)$(pkgdatadir)/
160         $(INSTALL_DATA) $(srcdir)/data/*.wav $(DESTDIR)$(pkgdatadir)/
161         $(INSTALL_DATA) $(srcdir)/data/*.xm $(DESTDIR)$(pkgdatadir)/
162         @echo
163         @echo "$(pkgdatadir)/icon.png (48x48) or ship.png (32x32) make good icons."
164         @echo
165
166 uninstall: uninstall-program uninstall-data rminstalldirs
167
168 uninstall-program:
169         rm -f $(DESTDIR)$(bindir)/$(exe_name)
170
171 uninstall-data:
172         rm -f $(DESTDIR)$(pkgdatadir)/*.png
173         rm -f $(DESTDIR)$(pkgdatadir)/*.wav
174         rm -f $(DESTDIR)$(pkgdatadir)/*.xm