Add prototype definitions for floating-point math
[tennix.git] / makefile
blobdcb7151ecaa066d6fd98928fc5a6d7f6c39fec1f
3 # Tennix! SDL Port
4 # Copyright (C) 2003, 2007, 2008, 2009 Thomas Perl <thp@thpinfo.com>
5 #
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 # MA 02110-1301, USA.
23 ifeq ($(MKCALLGRAPH),1)
24 CC = nccgen -ncgcc -ncld -ncfabs
25 LD = nccld
26 endif
28 RELEASE = 0.7.0
30 TARGET ?= default
32 PREFIX ?= /usr/local
33 BINDIR ?= $(PREFIX)/bin
34 DATAROOTDIR ?= $(PREFIX)/share
35 DATADIR ?= $(DATAROOTDIR)/games
37 LIBS =
38 CFLAGS += -std=c99 -W -Wall -ansi -pedantic -Wcast-qual -Wwrite-strings -DVERSION=\"$(RELEASE)\" -O2 -DPREFIX=\"$(PREFIX)\" -g
40 USE_PYTHON ?= 1
41 PYTHON_VERSION = 2.5
43 ifeq ($(USE_PYTHON),1)
44 CFLAGS += -I/usr/include/python$(PYTHON_VERSION)/ -DTENNIX_PYTHON
45 LIBS += -lpython$(PYTHON_VERSION)
46 endif
48 ifeq ($(UPDRECTANGLE),1)
49 CFLAGS += -DDRAW_UPDATE_RECTANGLE
50 endif
52 ifeq ($(DELUXE),1)
53 CFLAGS += -DDELUXE_EDITION
54 endif
56 ifeq ($(DEBUG),1)
57 CFLAGS += -DDEBUG
58 endif
60 ifeq ($(MAEMO),1)
61 CFLAGS += -DMAEMO
62 endif
64 ifeq ($(TARGET),cocoa)
65 LIBS += SDLmain.m -framework SDL -framework Cocoa -framework SDL_image -framework SDL_mixer -framework SDL_ttf
66 CFLAGS += -I/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/SDL_image.framework/Headers -I/Library/Frameworks/SDL_mixer.framework/Headers -I/Library/Frameworks/SDL_ttf.framework/Headers -DMACOSX
67 else
68 LIBS += $$(sdl-config --libs) -lSDL_mixer -lSDL_image -lSDL_ttf
69 CFLAGS += $$(sdl-config --cflags)
70 endif
72 SRC = tennix.c game.c graphics.c input.c util.c sound.c animation.c
73 OBJ = tennix.o game.o graphics.o input.o util.o sound.o animation.o archive-lib.o SDL_rotozoom.o
74 ifeq ($(MSYSTEM),MINGW32)
75 OBJ += tennixres.o
76 endif
77 ifeq ($(USE_PYTHON),1)
78 OBJ += tennixpy.o
79 endif
81 TOARCHIVE=$(wildcard data/*.ogg data/*.ttf wildcard data/*.png voice/*.ogg *.py)
83 WIN32LIBS = *.dll
84 OSXAPP = Tennix.app
86 DATAFILES = README README.*
87 ifeq ($(TARGET),cocoa)
88 DATAFILES += data/Tennix.icns
89 endif
91 tennix: $(OBJ) tennix.tnx
92 $(CC) $(CFLAGS) -o tennix $(OBJ) $(LIBS)
93 test -f tennix.exe && upx tennix.exe || true
95 ChangeLog:
96 git log >ChangeLog
98 install: tennix
99 install -d -m 755 $(DESTDIR)$(BINDIR)
100 install -d -m 755 $(DESTDIR)$(DATAROOTDIR)/pixmaps
101 install -d -m 755 $(DESTDIR)$(DATAROOTDIR)/applications
102 install -d -m 755 $(DESTDIR)$(DATAROOTDIR)/man/man6
103 install -d -m 755 $(DESTDIR)$(DATAROOTDIR)/icons/hicolor/scalable/apps
104 install -d -m 755 $(DESTDIR)$(DATADIR)/tennix
105 install -m 755 tennix $(DESTDIR)$(BINDIR)/
106 install -m 644 tennix.6 $(DESTDIR)$(DATAROOTDIR)/man/man6/
107 install -m 644 data/icon.png $(DESTDIR)$(DATAROOTDIR)/pixmaps/tennix.png
108 install -m 644 data/icon.svg $(DESTDIR)$(DATAROOTDIR)/icons/hicolor/scalable/apps/tennix.svg
109 install -m 644 tennix.desktop $(DESTDIR)$(DATAROOTDIR)/applications/
110 install -m 644 tennix.tnx $(DESTDIR)$(DATADIR)/tennix/
112 tennix.o: tennix.c tennix.h game.h graphics.h input.h util.h animation.h sound.h locations.h util.h
113 graphics.o: graphics.c graphics.h tennix.h archive.h sound.h
114 game.o: game.c game.h graphics.h tennix.h sound.h input.h util.h
115 sound.o: sound.c sound.h tennix.h archive.h graphics.h
116 input.o: input.c input.h tennix.h graphics.h game.h util.h tennixpy.h
117 util.o: util.c util.h tennix.h
118 animation.o: animation.c animation.h graphics.h tennix.h
119 tennixpy.o: tennix.c tennix.h game.h archive.h
120 SDL_rotozoom.o: SDL_rotozoom.c SDL_rotozoom.h
122 archive-lib.o: archive.c archive.h
123 $(CC) -c -o $@ $<
125 tennixar: archive dump
127 archive.o: archive.c archive.h
128 $(CC) $(CFLAGS) -DTENNIXAR_STANDALONE -c -o $@ $<
130 dump: archive
131 ln -s archive dump
133 tennix.tnx: archive $(TOARCHIVE)
134 rm -f tennix.tnx
135 ./archive $@ $(TOARCHIVE)
137 # Mac OS X-specific targets
138 release-osx: tennix ChangeLog
139 mkdir -p $(OSXAPP)/Contents/{MacOS,/Resources}
140 cp -rpv tennix $(OSXAPP)/Contents/MacOS/Tennix
141 cp -rpv $(DATAFILES) ChangeLog $(OSXAPP)/Contents/Resources/
142 sed -e 's/TENNIX_VERSION/$(RELEASE)/' osxapp.plist >$(OSXAPP)/Contents/Info.plist
143 echo 'APPL????' >$(OSXAPP)/Contents/PkgInfo
144 zip -r tennix-$(RELEASE)-macosx.zip $(OSXAPP)
145 # End Mac OS X-specific targets
147 # Windows-specific targets
148 release-win32: tennix ChangeLog
149 zip tennix-$(RELEASE)-win32.zip tennix.exe $(WIN32LIBS) $(DATAFILES) ChangeLog
151 tennix-installer.iss: tennix-installer.iss.in
152 sed tennix-installer.iss.in -e 's/{version}/$(RELEASE)/g' >tennix-installer.iss
154 release-win32-setup: tennix ChangeLog tennix-installer.iss
155 iscc tennix-installer.iss
157 tennixres.o: tennix.res
158 windres tennix.res tennixres.o
159 # End Windows-specific targets
161 release-bin: tennix ChangeLog
162 tar czvf tennix-$(RELEASE)-bin.tar.gz tennix $(DATAFILES) ChangeLog
164 release: distclean ChangeLog
165 mkdir -p .release-tmp/tennix-$(RELEASE)/
166 cp -rv * .release-tmp/tennix-$(RELEASE)/
167 rm -rf .release-tmp/tennix-$(RELEASE)/.git
168 tar czvf tennix-$(RELEASE).tar.gz -C .release-tmp tennix-$(RELEASE)
169 rm -rf .release-tmp
171 clean:
172 rm -f *.o tennix tennix.exe archive archive.exe dump dump.exe
173 rm -rf $(OSXAPP) tennix-*-macosx.zip
174 rm -f tennixres.o tennix-installer.iss tennix-*-win32-setup.exe
175 rm -f tennix.tnx
177 distclean: clean
178 rm -rf tennix-$(RELEASE).zip tennix-$(RELEASE)-bin.tar.gz ChangeLog .release-tmp tennix-$(RELEASE).tar.gz
180 .PHONY: distclean clean release-bin release-win32 release-win32-setup release-osx install tennixar