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