First cut of multi-player support
[tennix.git] / makefile
blobda8e79c2ccaba19c51247702fa59517639b93f10
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 = 1.0
30 UNAME = $(shell uname)
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
42 ifeq ($(USE_PYTHON),1)
43 CFLAGS += `python-config --includes` -DTENNIX_PYTHON
44 LIBS += `python-config --libs`
45 endif
47 ifeq ($(NONFREE_LOCATIONS),1)
48 CFLAGS += -DNONFREE_LOCATIONS
49 endif
51 ifeq ($(UPDRECTANGLE),1)
52 CFLAGS += -DDRAW_UPDATE_RECTANGLE
53 endif
55 ifeq ($(DELUXE),1)
56 CFLAGS += -DDELUXE_EDITION
57 endif
59 ifeq ($(DEBUG),1)
60 CFLAGS += -DDEBUG
61 endif
63 ifeq ($(MAEMO),1)
64 CFLAGS += -DMAEMO
65 endif
67 ifeq ($(UNAME),Darwin)
68 SDLLIBS=$$(sdl-config --prefix)/lib
69 LIBS += $$(sdl-config --static-libs) $(SDLLIBS)/libSDL_mixer.a $(SDLLIBS)/libSDL_image.a $(SDLLIBS)/libSDL_ttf.a $$(freetype-config --prefix)/lib/libfreetype.a
70 CFLAGS += $$(sdl-config --cflags) -lz
71 else
72 LIBS += $$(sdl-config --libs) -lSDL_mixer -lSDL_image -lSDL_ttf -lSDL_net
73 CFLAGS += $$(sdl-config --cflags)
74 endif
76 SRC = tennix.c game.c graphics.c input.c util.c sound.c animation.c network.c
77 OBJ = tennix.o game.o graphics.o input.o util.o sound.o animation.o archive-lib.o SDL_rotozoom.o network.o
78 ifeq ($(MSYSTEM),MINGW32)
79 OBJ += tennixres.o
80 endif
81 ifeq ($(USE_PYTHON),1)
82 OBJ += tennixpy.o
83 endif
85 TOARCHIVE=$(wildcard data/*.ogg data/*.ttf wildcard data/*.png voice/*.ogg *.py)
87 WIN32LIBS = *.dll
88 OSXAPP = Tennix.app
90 DATAFILES = README README.*
91 DATAFILES_OSX = $(DATAFILES) data/Tennix.icns
93 tennix: $(OBJ) tennix.tnx
94 $(CC) $(CFLAGS) -o tennix $(OBJ) $(LIBS)
95 test -f tennix.exe && upx tennix.exe || true
97 ChangeLog:
98 git log >ChangeLog
100 install: tennix
101 install -d -m 755 $(DESTDIR)$(BINDIR)
102 install -d -m 755 $(DESTDIR)$(DATAROOTDIR)/pixmaps
103 install -d -m 755 $(DESTDIR)$(DATAROOTDIR)/applications
104 install -d -m 755 $(DESTDIR)$(DATAROOTDIR)/man/man6
105 install -d -m 755 $(DESTDIR)$(DATAROOTDIR)/icons/hicolor/scalable/apps
106 install -d -m 755 $(DESTDIR)$(DATADIR)/tennix
107 install -m 755 tennix $(DESTDIR)$(BINDIR)/
108 install -m 644 tennix.6 $(DESTDIR)$(DATAROOTDIR)/man/man6/
109 install -m 644 data/icon.png $(DESTDIR)$(DATAROOTDIR)/pixmaps/tennix.png
110 install -m 644 data/icon.svg $(DESTDIR)$(DATAROOTDIR)/icons/hicolor/scalable/apps/tennix.svg
111 install -m 644 tennix.desktop $(DESTDIR)$(DATAROOTDIR)/applications/
112 install -m 644 tennix.tnx $(DESTDIR)$(DATADIR)/tennix/
114 tennix.o: tennix.c tennix.h game.h graphics.h input.h util.h animation.h sound.h locations.h util.h
115 graphics.o: graphics.c graphics.h tennix.h archive.h sound.h
116 game.o: game.c game.h graphics.h tennix.h sound.h input.h util.h network.h
117 sound.o: sound.c sound.h tennix.h archive.h graphics.h
118 input.o: input.c input.h tennix.h graphics.h game.h util.h tennixpy.h
119 util.o: util.c util.h tennix.h
120 animation.o: animation.c animation.h graphics.h tennix.h credits.h
121 tennixpy.o: tennix.c tennix.h game.h archive.h
122 network.o: network.c network.h game.h
123 SDL_rotozoom.o: SDL_rotozoom.c SDL_rotozoom.h
125 archive-lib.o: archive.c archive.h
126 $(CC) -c -o $@ $<
128 tennixar: archive dump
130 archive.o: archive.c archive.h
131 $(CC) $(CFLAGS) -DTENNIXAR_STANDALONE -c -o $@ $<
133 dump: archive
134 ln -s archive dump
136 tennix.tnx: archive $(TOARCHIVE)
137 rm -f tennix.tnx
138 ./archive $@ $(TOARCHIVE)
140 # Mac OS X-specific targets
141 release-osx: tennix tennix.tnx ChangeLog
142 mkdir -p $(OSXAPP)/Contents/{MacOS,/Resources}
143 cp -rpv tennix $(OSXAPP)/Contents/MacOS/Tennix
144 cp -rpv tennix.tnx $(DATAFILES_OSX) ChangeLog $(OSXAPP)/Contents/Resources/
145 sed -e 's/TENNIX_VERSION/$(RELEASE)/' osxapp.plist >$(OSXAPP)/Contents/Info.plist
146 echo 'APPL????' >$(OSXAPP)/Contents/PkgInfo
147 zip -r tennix-$(RELEASE)-macosx.zip $(OSXAPP)
148 # End Mac OS X-specific targets
150 # Windows-specific targets
151 release-win32: tennix ChangeLog
152 zip tennix-$(RELEASE)-win32.zip tennix.exe $(WIN32LIBS) $(DATAFILES) ChangeLog
154 tennix-installer.iss: tennix-installer.iss.in
155 sed tennix-installer.iss.in -e 's/{version}/$(RELEASE)/g' >tennix-installer.iss
157 release-win32-setup: tennix ChangeLog tennix-installer.iss
158 iscc tennix-installer.iss
160 tennixres.o: tennix.res
161 windres tennix.res tennixres.o
162 # End Windows-specific targets
164 release-bin: tennix ChangeLog
165 tar czvf tennix-$(RELEASE)-bin.tar.gz tennix $(DATAFILES) ChangeLog
167 release: distclean ChangeLog
168 mkdir -p .release-tmp/tennix-$(RELEASE)/
169 cp -rv * .release-tmp/tennix-$(RELEASE)/
170 rm -rf .release-tmp/tennix-$(RELEASE)/.git
171 tar czvf tennix-$(RELEASE).tar.gz -C .release-tmp tennix-$(RELEASE)
172 rm -rf .release-tmp
174 clean:
175 rm -f *.o tennix tennix.exe archive archive.exe dump dump.exe
176 rm -rf $(OSXAPP) tennix-*-macosx.zip
177 rm -f tennixres.o tennix-installer.iss tennix-*-win32-setup.exe
178 rm -f tennix.tnx
180 distclean: clean
181 rm -rf tennix-$(RELEASE).zip tennix-$(RELEASE)-bin.tar.gz ChangeLog .release-tmp tennix-$(RELEASE).tar.gz
183 .PHONY: distclean clean release-bin release-win32 release-win32-setup release-osx install tennixar