File: Makefile

package info (click to toggle)
wordwarvi 1.0.4-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 10,096 kB
  • sloc: ansic: 13,230; makefile: 129
file content (167 lines) | stat: -rw-r--r-- 5,108 bytes parent folder | download | duplicates (2)
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
PREFIX?=/usr
BINDIR=${PREFIX}/games
DATADIR=${PREFIX}/share/wordwarvi
MANDIR?=${PREFIX}/share/man
MANPAGEDIR=${MANDIR}/man6
PKG_CONFIG?=pkg-config

SCREENSAVERFLAG=
#SCREENSAVERFLAG=-DDO_INHIBIT_SCREENSAVER

# To compile withaudio, WITHAUDIO=yes, 
# for no audio support, change to WITHAUDIO=no, 
WITHAUDIO=yes
# WITHAUDIO=no

ifeq (${WITHAUDIO},yes)
SNDLIBS=`$(PKG_CONFIG) --libs portaudio-2.0 vorbisfile`
SNDFLAGS=-DWITHAUDIOSUPPORT `$(PKG_CONFIG) --cflags portaudio-2.0`
OGGOBJ=ogg_to_pcm.o
else
SNDLIBS=
SNDFLAGS=-DWWVIAUDIO_STUBS_ONLY
OGGOBJ=
endif

# "make OPENLASE=1" to compile support for openlase laser projector
# NOTE: this will cut a lot of standard stuff out of wordwarvi
# for performance reasons, and cut the frame rate to 20 fps,
# as openlase rendering is slow
#
# "make OPENLASE=1 OPENLASEGRAYSCALE=1" to compile for openlase
# but monochromatic, in case you don't have an RGB capable
# laser projector.
#
ifeq (${OPENLASE},1)
ifeq (${OPENLASEGRAYSCALE},1)
OPENLASECFLAG=-DOPENLASE -DOPENLASEGRAYSCALE
else
OPENLASECFLAG=-DOPENLASE
endif
OPENLASELIB=-lopenlase
OPENLASELIBDIR=-L.
else
OPENLASELIB=
OPENLASECFLAG=
OPENLASELIBDIR=
endif

CC ?= gcc
BUILD_CC ?= gcc

# DEBUG=-g
# DEBUG=
# PROFILE_FLAG=-pg
#PROFILE_FLAG=
#OPTIMIZE_FLAG=
# OPTIMIZE_FLAG=-O3
#OPTIMIZE_FLAG=-O3 -pedantic -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security
CFLAGS ?= -O3 -pedantic
OPTIMIZE_FLAG = ${CFLAGS} ${CPPFLAGS}
WARNFLAG=-pedantic -W -Wall

LDFLAGS += ${PROFILE_FLAG}

DEFINES=${SNDFLAGS} -DDATADIR=\"${DATADIR}/\"

all:	wordwarvi wordwarvi.6.gz

HAS_PORTAUDIO_2_0:
ifeq (${WITHAUDIO},yes)
	$(PKG_CONFIG) --print-errors --exists portaudio-2.0
else
endif

HAS_VORBISFILE:
ifeq (${WITHAUDIO},yes)
	$(PKG_CONFIG) --print-errors --exists vorbisfile
else
endif

joystick.o:	joystick.c joystick.h Makefile
	$(CC) ${DEBUG} ${PROFILE_FLAG} ${OPTIMIZE_FLAG} -pthread ${WARNFLAG} -c joystick.c

ogg_to_pcm.o:	ogg_to_pcm.c ogg_to_pcm.h Makefile
	$(CC) ${DEBUG} ${PROFILE_FLAG} ${OPTIMIZE_FLAG} `$(PKG_CONFIG) --cflags vorbisfile` \
		-pthread ${WARNFLAG} -c ogg_to_pcm.c

wwviaudio.o:	wwviaudio.c wwviaudio.h ogg_to_pcm.h my_point.h Makefile
	$(CC) ${WARNFLAG} ${DEBUG} ${PROFILE_FLAG} ${OPTIMIZE_FLAG} \
		${DEFINES} \
		-pthread `$(PKG_CONFIG) --cflags vorbisfile` \
		-c wwviaudio.c

rumble.o:	rumble.c rumble.h Makefile
	$(CC) ${DEBUG} ${PROFILE_FLAG} ${OPTIMIZE_FLAG} `$(PKG_CONFIG) --cflags vorbisfile` \
		-pthread ${WARNFLAG} -c rumble.c

wwvi_font.o:	wwvi_font.c wwvi_font.h my_point.h Makefile
	$(CC) ${DEBUG} ${PROFILE_FLAG} ${OPTIMIZE_FLAG} -pthread ${WARNFLAG} -c wwvi_font.c

stamp:	stamp.c
	$(BUILD_CC) -o stamp stamp.c

wordwarvi:	wordwarvi.c joystick.o rumble.o ${OGGOBJ} wwviaudio.o wwvi_font.o \
		Makefile version.h stamp levels.h rumble.h
	./stamp > stamp.h
	$(CC) ${DEBUG} ${OPENLASECFLAG} ${PROFILE_FLAG} ${OPTIMIZE_FLAG} ${SCREENSAVERFLAG} -pthread ${WARNFLAG}  ${DEFINES} \
		joystick.o \
		rumble.o \
		wwvi_font.o \
		${OGGOBJ} \
		wwviaudio.o \
		wordwarvi.c -o wordwarvi ${OPENLASELIBDIR} ${OPENLASELIB} -lm ${SNDLIBS} \
		`$(PKG_CONFIG) --cflags gtk+-2.0` `$(PKG_CONFIG) --libs gtk+-2.0 gthread-2.0` ${LDFLAGS}
	/bin/rm stamp.h

wordwarvi.6.gz:	wordwarvi.6
	gzip -c wordwarvi.6 > wordwarvi.6.gz

install: wordwarvi wordwarvi.6.gz
	mkdir -p $(DESTDIR)$(BINDIR)
	mkdir -p $(DESTDIR)$(DATADIR)/sounds
	mkdir -p $(DESTDIR)$(MANPAGEDIR)
	install -p -m 755 wordwarvi $(DESTDIR)$(BINDIR)
	install -p -m 644 sounds/*.ogg $(DESTDIR)$(DATADIR)/sounds
	install -p -m 644 wordwarvi.6.gz $(DESTDIR)$(MANPAGEDIR)

uninstall:
	/bin/rm -f $(DESTDIR)$(BINDIR)/wordwarvi
	/bin/rm -fr $(DESTDIR)${DATADIR}
	/bin/rm -f $(DESTDIR)${MANPAGEDIR}/wordwarvi.6.gz

CHECK_VERSION:
	@echo Checking VERSION string ${VERSION}... 1>&2
	@echo ${VERSION} | grep '[0-9][0-9]*[.][0-9][0-9]*' > /dev/null 2>&1
	@echo VERSION=${VERSION} which looks ok. 1>&2
	@echo Checking that ${VERSION} matches what is in version.h 1>&2
	@grep ${VERSION} version.h > /dev/null 2>&1
	@echo VERSION ${VERSION} matches cursory check of version.h 1>&2

tarball:	CHECK_VERSION
	mkdir -p d/wordwarvi-${VERSION}/sounds
	cp Makefile version.h ogg_to_pcm.c ogg_to_pcm.h levels.h rumble.c rumble.h \
		joystick.c joystick.h changelog.txt wordwarvi.c wordwarvi.6 \
		wwviaudio.c wwviaudio.h my_point.h wwvi_font.h wwvi_font.c \
		stamp.c README AUTHORS COPYING \
		AAA_HOW_TO_MAKE_NEW_LEVELS.txt \
		changelog.txt wordwarvi_hacking.html bigrocket.png \
		d/wordwarvi-${VERSION}
	cp sounds/*.ogg d/wordwarvi-${VERSION}/sounds
	cp sounds/Attribution.txt d/wordwarvi-${VERSION}/sounds
	mkdir -p d/wordwarvi-${VERSION}/icons
	cp icons/*.png icons/*.xcf d/wordwarvi-${VERSION}/icons
	chown -R root:root d;
	( cd d; tar cvf ../wordwarvi-${VERSION}.tar ./wordwarvi-${VERSION} )
	gzip wordwarvi-${VERSION}.tar

scan-build:
	make clean
	scan-build -o /tmp/wordwarvi-scan-build-output make CC=clang
	xdg-open /tmp/wordwarvi-scan-build-output/*/index.html

clean:
	rm -f ./wordwarvi ./wordwarvi-*.tar.gz wordwarvi.6.gz stamp.h stamp
	rm -f ./joystick.o  ./ogg_to_pcm.o  ./rumble.o  ./wwviaudio.o ./wwvi_font.o
	rm -fr ./d
	rm -fr /tmp/wordwarvi-scan-build-output