Fix sound panning for ground hit
[tennix.git] / makefile
blob1019a06477acf35736d5e1b6c9f3760f70712979
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)\"
40 ifeq ($(UPDRECTANGLE),1)
41 CFLAGS += -DDRAW_UPDATE_RECTANGLE
42 endif
44 ifeq ($(DELUXE),1)
45 CFLAGS += -DDELUXE_EDITION
46 endif
48 ifeq ($(DEBUG),1)
49 CFLAGS += -DDEBUG
50 endif
52 ifeq ($(MAEMO),1)
53 CFLAGS += -DMAEMO
54 endif
56 ifeq ($(TARGET),cocoa)
57 LIBS += SDLmain.m -framework SDL -framework Cocoa -framework SDL_image -framework SDL_mixer -framework SDL_ttf
58 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
59 else
60 LIBS += $$(sdl-config --libs) -lSDL_mixer -lSDL_image -lSDL_ttf
61 CFLAGS += $$(sdl-config --cflags)
62 endif
64 SRC = tennix.c game.c graphics.c input.c util.c sound.c
65 OBJ = tennix.o game.o graphics.o input.o util.o sound.o archive-lib.o SDL_rotozoom.o
66 ifeq ($(MSYSTEM),MINGW32)
67 OBJ += tennixres.o
68 endif
70 TOARCHIVE=$(wildcard data/*.ogg data/*.ttf wildcard data/*.png voice/*.ogg)
72 WIN32LIBS = *.dll
73 OSXAPP = Tennix.app
75 DATAFILES = README README.*
76 ifeq ($(TARGET),cocoa)
77 DATAFILES += data/Tennix.icns
78 endif
80 tennix: $(OBJ) tennix.tnx
81 $(CC) $(CFLAGS) -o tennix $(OBJ) $(LIBS)
82 test -f tennix.exe && upx tennix.exe || true
84 ChangeLog:
85 git log >ChangeLog
87 install: tennix
88 install -d -m 755 $(DESTDIR)$(BINDIR)
89 install -d -m 755 $(DESTDIR)$(DATAROOTDIR)/pixmaps
90 install -d -m 755 $(DESTDIR)$(DATAROOTDIR)/applications
91 install -d -m 755 $(DESTDIR)$(DATAROOTDIR)/man/man6
92 install -d -m 755 $(DESTDIR)$(DATAROOTDIR)/icons/hicolor/scalable/apps
93 install -d -m 755 $(DESTDIR)$(DATADIR)/tennix
94 install -m 755 tennix $(DESTDIR)$(BINDIR)/
95 install -m 644 tennix.6 $(DESTDIR)$(DATAROOTDIR)/man/man6/
96 install -m 644 data/icon.png $(DESTDIR)$(DATAROOTDIR)/pixmaps/tennix.png
97 install -m 644 data/icon.svg $(DESTDIR)$(DATAROOTDIR)/icons/hicolor/scalable/apps/tennix.svg
98 install -m 644 tennix.desktop $(DESTDIR)$(DATAROOTDIR)/applications/
99 install -m 644 tennix.tnx $(DESTDIR)$(DATADIR)/tennix/
101 tennix.o: tennix.c tennix.h game.h graphics.h input.h util.h sound.h locations.h util.h
102 graphics.o: graphics.c graphics.h tennix.h archive.h sound.h
103 game.o: game.c game.h graphics.h tennix.h sound.h input.h util.h
104 sound.o: sound.c sound.h tennix.h archive.h graphics.h
105 input.o: input.c input.h
106 util.o: util.c util.h
107 SDL_rotozoom.o: SDL_rotozoom.c SDL_rotozoom.h
109 archive-lib.o: archive.c archive.h
110 $(CC) -c -o $@ $<
112 tennixar: archive dump
114 archive.o: archive.c archive.h
115 $(CC) $(CFLAGS) -DTENNIXAR_STANDALONE -c -o $@ $<
117 dump: archive
118 ln -s archive dump
120 tennix.tnx: archive $(TOARCHIVE)
121 rm -f tennix.tnx
122 ./archive $@ $(TOARCHIVE)
124 # Mac OS X-specific targets
125 release-osx: tennix ChangeLog
126 mkdir -p $(OSXAPP)/Contents/{MacOS,/Resources}
127 cp -rpv tennix $(OSXAPP)/Contents/MacOS/Tennix
128 cp -rpv $(DATAFILES) ChangeLog $(OSXAPP)/Contents/Resources/
129 sed -e 's/TENNIX_VERSION/$(RELEASE)/' osxapp.plist >$(OSXAPP)/Contents/Info.plist
130 echo 'APPL????' >$(OSXAPP)/Contents/PkgInfo
131 zip -r tennix-$(RELEASE)-macosx.zip $(OSXAPP)
132 # End Mac OS X-specific targets
134 # Windows-specific targets
135 release-win32: tennix ChangeLog
136 zip tennix-$(RELEASE)-win32.zip tennix.exe $(WIN32LIBS) $(DATAFILES) ChangeLog
138 tennix-installer.iss: tennix-installer.iss.in
139 sed tennix-installer.iss.in -e 's/{version}/$(RELEASE)/g' >tennix-installer.iss
141 release-win32-setup: tennix ChangeLog tennix-installer.iss
142 iscc tennix-installer.iss
144 tennixres.o: tennix.res
145 windres tennix.res tennixres.o
146 # End Windows-specific targets
148 release-bin: tennix ChangeLog
149 tar czvf tennix-$(RELEASE)-bin.tar.gz tennix $(DATAFILES) ChangeLog
151 release: distclean ChangeLog
152 mkdir -p .release-tmp/tennix-$(RELEASE)/
153 cp -rv * .release-tmp/tennix-$(RELEASE)/
154 rm -rf .release-tmp/tennix-$(RELEASE)/.git
155 tar czvf tennix-$(RELEASE).tar.gz -C .release-tmp tennix-$(RELEASE)
156 rm -rf .release-tmp
158 clean:
159 rm -f *.o tennix tennix.exe archive archive.exe dump dump.exe
160 rm -rf $(OSXAPP) tennix-*-macosx.zip
161 rm -f tennixres.o tennix-installer.iss tennix-*-win32-setup.exe
162 rm -f tennix.tnx
164 distclean: clean
165 rm -rf tennix-$(RELEASE).zip tennix-$(RELEASE)-bin.tar.gz ChangeLog .release-tmp tennix-$(RELEASE).tar.gz
167 .PHONY: distclean clean release-bin release-win32 release-win32-setup release-osx install tennixar