Experimental Python-based AI bot framework
[tennix.git] / makefile
blobd66b76016653bdee7b2792854e8a78c37fbb33b1
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
78 TOARCHIVE=$(wildcard data/*.ogg data/*.ttf wildcard data/*.png voice/*.ogg)
80 WIN32LIBS = *.dll
81 OSXAPP = Tennix.app
83 DATAFILES = README README.*
84 ifeq ($(TARGET),cocoa)
85 DATAFILES += data/Tennix.icns
86 endif
88 tennix: $(OBJ) tennix.tnx
89 $(CC) $(CFLAGS) -o tennix $(OBJ) $(LIBS)
90 test -f tennix.exe && upx tennix.exe || true
92 ChangeLog:
93 git log >ChangeLog
95 install: tennix
96 install -d -m 755 $(DESTDIR)$(BINDIR)
97 install -d -m 755 $(DESTDIR)$(DATAROOTDIR)/pixmaps
98 install -d -m 755 $(DESTDIR)$(DATAROOTDIR)/applications
99 install -d -m 755 $(DESTDIR)$(DATAROOTDIR)/man/man6
100 install -d -m 755 $(DESTDIR)$(DATAROOTDIR)/icons/hicolor/scalable/apps
101 install -d -m 755 $(DESTDIR)$(DATADIR)/tennix
102 install -m 755 tennix $(DESTDIR)$(BINDIR)/
103 install -m 644 tennix.6 $(DESTDIR)$(DATAROOTDIR)/man/man6/
104 install -m 644 data/icon.png $(DESTDIR)$(DATAROOTDIR)/pixmaps/tennix.png
105 install -m 644 data/icon.svg $(DESTDIR)$(DATAROOTDIR)/icons/hicolor/scalable/apps/tennix.svg
106 install -m 644 tennix.desktop $(DESTDIR)$(DATAROOTDIR)/applications/
107 install -m 644 tennix.tnx $(DESTDIR)$(DATADIR)/tennix/
109 tennix.o: tennix.c tennix.h game.h graphics.h input.h util.h animation.h sound.h locations.h util.h
110 graphics.o: graphics.c graphics.h tennix.h archive.h sound.h
111 game.o: game.c game.h graphics.h tennix.h sound.h input.h util.h
112 sound.o: sound.c sound.h tennix.h archive.h graphics.h
113 input.o: input.c input.h tennix.h graphics.h game.h util.h
114 util.o: util.c util.h tennix.h
115 animation.o: animation.c animation.h graphics.h tennix.h
116 SDL_rotozoom.o: SDL_rotozoom.c SDL_rotozoom.h
118 archive-lib.o: archive.c archive.h
119 $(CC) -c -o $@ $<
121 tennixar: archive dump
123 archive.o: archive.c archive.h
124 $(CC) $(CFLAGS) -DTENNIXAR_STANDALONE -c -o $@ $<
126 dump: archive
127 ln -s archive dump
129 tennix.tnx: archive $(TOARCHIVE)
130 rm -f tennix.tnx
131 ./archive $@ $(TOARCHIVE)
133 # Mac OS X-specific targets
134 release-osx: tennix ChangeLog
135 mkdir -p $(OSXAPP)/Contents/{MacOS,/Resources}
136 cp -rpv tennix $(OSXAPP)/Contents/MacOS/Tennix
137 cp -rpv $(DATAFILES) ChangeLog $(OSXAPP)/Contents/Resources/
138 sed -e 's/TENNIX_VERSION/$(RELEASE)/' osxapp.plist >$(OSXAPP)/Contents/Info.plist
139 echo 'APPL????' >$(OSXAPP)/Contents/PkgInfo
140 zip -r tennix-$(RELEASE)-macosx.zip $(OSXAPP)
141 # End Mac OS X-specific targets
143 # Windows-specific targets
144 release-win32: tennix ChangeLog
145 zip tennix-$(RELEASE)-win32.zip tennix.exe $(WIN32LIBS) $(DATAFILES) ChangeLog
147 tennix-installer.iss: tennix-installer.iss.in
148 sed tennix-installer.iss.in -e 's/{version}/$(RELEASE)/g' >tennix-installer.iss
150 release-win32-setup: tennix ChangeLog tennix-installer.iss
151 iscc tennix-installer.iss
153 tennixres.o: tennix.res
154 windres tennix.res tennixres.o
155 # End Windows-specific targets
157 release-bin: tennix ChangeLog
158 tar czvf tennix-$(RELEASE)-bin.tar.gz tennix $(DATAFILES) ChangeLog
160 release: distclean ChangeLog
161 mkdir -p .release-tmp/tennix-$(RELEASE)/
162 cp -rv * .release-tmp/tennix-$(RELEASE)/
163 rm -rf .release-tmp/tennix-$(RELEASE)/.git
164 tar czvf tennix-$(RELEASE).tar.gz -C .release-tmp tennix-$(RELEASE)
165 rm -rf .release-tmp
167 clean:
168 rm -f *.o tennix tennix.exe archive archive.exe dump dump.exe
169 rm -rf $(OSXAPP) tennix-*-macosx.zip
170 rm -f tennixres.o tennix-installer.iss tennix-*-win32-setup.exe
171 rm -f tennix.tnx
173 distclean: clean
174 rm -rf tennix-$(RELEASE).zip tennix-$(RELEASE)-bin.tar.gz ChangeLog .release-tmp tennix-$(RELEASE).tar.gz
176 .PHONY: distclean clean release-bin release-win32 release-win32-setup release-osx install tennixar