Use SDL_ttf for font rendering; drop old font code
[tennix.git] / makefile
blob3a1a2acb28071b7e4d32e8381b69b190f52ef9df
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 -mfpu=vfp -mfloat-abi=softfp -mcpu=arm1136j-s
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
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
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
108 archive-lib.o: archive.c archive.h
109 $(CC) -c -o $@ $<
111 tennixar: archive dump
113 archive.o: archive.c archive.h
114 $(CC) $(CFLAGS) -DTENNIXAR_STANDALONE -c -o $@ $<
116 dump: archive
117 ln -s archive dump
119 tennix.tnx: archive $(TOARCHIVE)
120 rm -f tennix.tnx
121 ./archive $@ $(TOARCHIVE)
123 # Mac OS X-specific targets
124 release-osx: tennix ChangeLog
125 mkdir -p $(OSXAPP)/Contents/{MacOS,/Resources}
126 cp -rpv tennix $(OSXAPP)/Contents/MacOS/Tennix
127 cp -rpv $(DATAFILES) ChangeLog $(OSXAPP)/Contents/Resources/
128 sed -e 's/TENNIX_VERSION/$(RELEASE)/' osxapp.plist >$(OSXAPP)/Contents/Info.plist
129 echo 'APPL????' >$(OSXAPP)/Contents/PkgInfo
130 zip -r tennix-$(RELEASE)-macosx.zip $(OSXAPP)
131 # End Mac OS X-specific targets
133 # Windows-specific targets
134 release-win32: tennix ChangeLog
135 zip tennix-$(RELEASE)-win32.zip tennix.exe $(WIN32LIBS) $(DATAFILES) ChangeLog
137 tennix-installer.iss: tennix-installer.iss.in
138 sed tennix-installer.iss.in -e 's/{version}/$(RELEASE)/g' >tennix-installer.iss
140 release-win32-setup: tennix ChangeLog tennix-installer.iss
141 iscc tennix-installer.iss
143 tennixres.o: tennix.res
144 windres tennix.res tennixres.o
145 # End Windows-specific targets
147 release-bin: tennix ChangeLog
148 tar czvf tennix-$(RELEASE)-bin.tar.gz tennix $(DATAFILES) ChangeLog
150 release: distclean ChangeLog
151 mkdir -p .release-tmp/tennix-$(RELEASE)/
152 cp -rv * .release-tmp/tennix-$(RELEASE)/
153 rm -rf .release-tmp/tennix-$(RELEASE)/.git
154 tar czvf tennix-$(RELEASE).tar.gz -C .release-tmp tennix-$(RELEASE)
155 rm -rf .release-tmp
157 clean:
158 rm -f *.o tennix tennix.exe archive archive.exe dump dump.exe
159 rm -rf $(OSXAPP) tennix-*-macosx.zip
160 rm -f tennixres.o tennix-installer.iss tennix-*-win32-setup.exe
161 rm -f tennix.tnx
163 distclean: clean
164 rm -rf tennix-$(RELEASE).zip tennix-$(RELEASE)-bin.tar.gz ChangeLog .release-tmp tennix-$(RELEASE).tar.gz
166 .PHONY: distclean clean release-bin release-win32 release-win32-setup release-osx install tennixar