File: makefile

package info (click to toggle)
tennix 1.1-2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 6,720 kB
  • sloc: ansic: 2,906; cpp: 2,333; python: 275; objc: 245; makefile: 125
file content (180 lines) | stat: -rw-r--r-- 5,594 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180

#
# Tennix! SDL Port
# Copyright (C) 2003, 2007, 2008, 2009 Thomas Perl <thp@thpinfo.com>
# 
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
# MA  02110-1301, USA.
#

CC = g++


ifeq ($(MKCALLGRAPH),1)
  CC        =  nccgen -ncgcc -ncld -ncfabs
  LD        =  nccld
endif

RELEASE = 1.1.1

PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
DATAROOTDIR ?= $(PREFIX)/share
DATADIR ?= $(DATAROOTDIR)/games

CFLAGS += -W -Wall -DVERSION=\"$(RELEASE)\" -O2 -DPREFIX=\"$(PREFIX)\"
CXXFLAGS += $(CFLAGS)

USE_PYTHON ?= 1

ifeq ($(USE_PYTHON),1)
  PYTHON_INCLUDES := $(shell python-config --includes)
  PYTHON_LIBS := $(shell python-config --libs)
  CFLAGS += $(PYTHON_INCLUDES) -DTENNIX_PYTHON
  LIBS += $(PYTHON_LIBS)
endif

ifeq ($(NONFREE_LOCATIONS),1)
  CFLAGS += -DNONFREE_LOCATIONS
endif

ifeq ($(UPDRECTANGLE),1)
  CFLAGS += -DDRAW_UPDATE_RECTANGLE
endif

ifeq ($(DELUXE),1)
  CFLAGS += -DDELUXE_EDITION
endif

ifeq ($(DEBUG),1)
  CFLAGS += -DDEBUG
endif

ifeq ($(MAEMO),1)
  CFLAGS += -DMAEMO
endif

SDL_LIBS := $(shell sdl-config --libs)
SDL_CFLAGS := $(shell sdl-config --cflags)

LIBS += $(SDL_LIBS) -lSDL_mixer -lSDL_image -lSDL_ttf -lSDL_net
CFLAGS += $(SDL_CFLAGS)

OBJ = tennix.o game.o graphics.o input.o util.o sound.o animation.o archive.o SDL_rotozoom.o network.o

ifeq ($(MSYSTEM),MINGW32)
  OBJ += tennixres.o
endif
ifeq ($(USE_PYTHON),1)
  OBJ += tennixpy.o
endif

TOARCHIVE=$(wildcard data/*.ogg data/*.ttf wildcard data/*.png voice/*.ogg *.py)

WIN32LIBS = *.dll
OSXAPP = Tennix.app

DATAFILES = README README.*
DATAFILES_OSX = $(DATAFILES) data/Tennix.icns

tennix: $(OBJ) tennix.tnx
	$(CC) $(CFLAGS)   -o tennix $(OBJ) $(LIBS)
	test -f tennix.exe && upx tennix.exe || true 

ChangeLog:
	git log >ChangeLog

install: tennix
	install -d -m 755 $(DESTDIR)$(BINDIR)
	install -d -m 755 $(DESTDIR)$(DATAROOTDIR)/pixmaps
	install -d -m 755 $(DESTDIR)$(DATAROOTDIR)/applications
	install -d -m 755 $(DESTDIR)$(DATAROOTDIR)/man/man6
	install -d -m 755 $(DESTDIR)$(DATAROOTDIR)/icons/hicolor/scalable/apps
	install -d -m 755 $(DESTDIR)$(DATADIR)/tennix
	install -m 755 tennix $(DESTDIR)$(BINDIR)/
	install -m 644 tennix.6 $(DESTDIR)$(DATAROOTDIR)/man/man6/
	install -m 644 data/icon.png $(DESTDIR)$(DATAROOTDIR)/pixmaps/tennix.png
	install -m 644 data/icon.svg $(DESTDIR)$(DATAROOTDIR)/icons/hicolor/scalable/apps/tennix.svg
	install -m 644 tennix.desktop $(DESTDIR)$(DATAROOTDIR)/applications/
	install -m 644 tennix.tnx $(DESTDIR)$(DATADIR)/tennix/

archive.o: archive.cc archive.cc
tennix.o: tennix.cc tennix.h game.h graphics.h input.h util.h animation.h sound.h locations.h util.h archive.hh
graphics.o: graphics.cc graphics.h tennix.h archive.hh sound.h
game.o: game.c game.h graphics.h tennix.h sound.h input.h util.h network.h
sound.o: sound.cc sound.h tennix.h archive.hh graphics.h
input.o: input.c input.h tennix.h graphics.h game.h util.h tennixpy.h archive.hh
util.o: util.c util.h tennix.h
animation.o: animation.c animation.h graphics.h tennix.h credits.h
tennixpy.o: tennixpy.cc tennix.h game.h archive.hh
network.o: network.c network.h game.h
SDL_rotozoom.o: SDL_rotozoom.c SDL_rotozoom.h

tennixar: archive dump

archive: archivetool.cc archive.o archive.hh

dump: archive
	ln -s archive dump

tennix.tnx: archive $(TOARCHIVE)
	rm -f tennix.tnx
	./archive $@ $(TOARCHIVE)

# Mac OS X-specific targets
release-osx: tennix tennix.tnx ChangeLog
	mkdir -p $(OSXAPP)/Contents/{MacOS,/Resources}
	cp -rpv tennix $(OSXAPP)/Contents/MacOS/Tennix
	cp -rpv tennix.tnx $(DATAFILES_OSX) ChangeLog $(OSXAPP)/Contents/Resources/
	sed -e 's/TENNIX_VERSION/$(RELEASE)/' osxapp.plist >$(OSXAPP)/Contents/Info.plist
	echo 'APPL????' >$(OSXAPP)/Contents/PkgInfo
	zip -r tennix-$(RELEASE)-macosx.zip $(OSXAPP)
# End Mac OS X-specific targets

# Windows-specific targets
release-win32: tennix ChangeLog
	zip tennix-$(RELEASE)-win32.zip tennix.exe $(WIN32LIBS) $(DATAFILES) ChangeLog

tennix-installer.iss: tennix-installer.iss.in
	sed tennix-installer.iss.in -e 's/{version}/$(RELEASE)/g' >tennix-installer.iss

release-win32-setup: tennix ChangeLog tennix-installer.iss
	iscc tennix-installer.iss

tennixres.o: tennix.res
	windres tennix.res tennixres.o
# End Windows-specific targets

release-bin: tennix ChangeLog
	tar czvf tennix-$(RELEASE)-bin.tar.gz tennix $(DATAFILES) ChangeLog

release: distclean ChangeLog
	mkdir -p .release-tmp/tennix-$(RELEASE)/
	cp -rv * .release-tmp/tennix-$(RELEASE)/
	rm -rf .release-tmp/tennix-$(RELEASE)/.git
	tar czvf tennix-$(RELEASE).tar.gz -C .release-tmp tennix-$(RELEASE)
	rm -rf .release-tmp

clean:
	rm -f *.o tennix tennix.exe archive archive.exe dump dump.exe
	rm -rf $(OSXAPP) tennix-*-macosx.zip
	rm -f tennixres.o tennix-installer.iss tennix-*-win32-setup.exe
	rm -f tennix.tnx

distclean: clean
	rm -rf tennix-$(RELEASE).zip tennix-$(RELEASE)-bin.tar.gz ChangeLog .release-tmp tennix-$(RELEASE).tar.gz

.PHONY: distclean clean release-bin release-win32 release-win32-setup release-osx install tennixar