Update TODO list, release targets
[tennix.git] / makefile
blob9e4f0bb02ad73c9db4266cc53cd01d042dd1785c
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 animation.c
65 OBJ = tennix.o game.o graphics.o input.o util.o sound.o animation.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 animation.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 tennix.h graphics.h game.h util.h
106 util.o: util.c util.h tennix.h
107 animation.o: animation.c animation.h graphics.h tennix.h
108 SDL_rotozoom.o: SDL_rotozoom.c SDL_rotozoom.h
110 archive-lib.o: archive.c archive.h
111 $(CC) -c -o $@ $<
113 tennixar: archive dump
115 archive.o: archive.c archive.h
116 $(CC) $(CFLAGS) -DTENNIXAR_STANDALONE -c -o $@ $<
118 dump: archive
119 ln -s archive dump
121 tennix.tnx: archive $(TOARCHIVE)
122 rm -f tennix.tnx
123 ./archive $@ $(TOARCHIVE)
125 # Mac OS X-specific targets
126 release-osx: tennix ChangeLog
127 mkdir -p $(OSXAPP)/Contents/{MacOS,/Resources}
128 cp -rpv tennix $(OSXAPP)/Contents/MacOS/Tennix
129 cp -rpv $(DATAFILES) ChangeLog $(OSXAPP)/Contents/Resources/
130 sed -e 's/TENNIX_VERSION/$(RELEASE)/' osxapp.plist >$(OSXAPP)/Contents/Info.plist
131 echo 'APPL????' >$(OSXAPP)/Contents/PkgInfo
132 zip -r tennix-$(RELEASE)-macosx.zip $(OSXAPP)
133 # End Mac OS X-specific targets
135 # Windows-specific targets
136 release-win32: tennix ChangeLog
137 zip tennix-$(RELEASE)-win32.zip tennix.exe $(WIN32LIBS) $(DATAFILES) ChangeLog
139 tennix-installer.iss: tennix-installer.iss.in
140 sed tennix-installer.iss.in -e 's/{version}/$(RELEASE)/g' >tennix-installer.iss
142 release-win32-setup: tennix ChangeLog tennix-installer.iss
143 iscc tennix-installer.iss
145 tennixres.o: tennix.res
146 windres tennix.res tennixres.o
147 # End Windows-specific targets
149 release-bin: tennix ChangeLog
150 tar czvf tennix-$(RELEASE)-bin.tar.gz tennix $(DATAFILES) ChangeLog
152 release: distclean ChangeLog
153 mkdir -p .release-tmp/tennix-$(RELEASE)/
154 cp -rv * .release-tmp/tennix-$(RELEASE)/
155 rm -rf .release-tmp/tennix-$(RELEASE)/.git
156 tar czvf tennix-$(RELEASE).tar.gz -C .release-tmp tennix-$(RELEASE)
157 rm -rf .release-tmp
159 clean:
160 rm -f *.o tennix tennix.exe archive archive.exe dump dump.exe
161 rm -rf $(OSXAPP) tennix-*-macosx.zip
162 rm -f tennixres.o tennix-installer.iss tennix-*-win32-setup.exe
163 rm -f tennix.tnx
165 distclean: clean
166 rm -rf tennix-$(RELEASE).zip tennix-$(RELEASE)-bin.tar.gz ChangeLog .release-tmp tennix-$(RELEASE).tar.gz
168 .PHONY: distclean clean release-bin release-win32 release-win32-setup release-osx install tennixar