-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
58 lines (48 loc) · 1.46 KB
/
Makefile
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
exe = ts3d
exe-dir = $(HOME)/bin
version-file = version
version = `cat $(version-file)`
tests = tests
windows-zip = ts3d.zip
data-dir = data
man-page = ts3d.6.gz
man-dir = /usr/share/man/man6
TS3D_ROOT ?= $(HOME)/.ts3d
TS3D_DATA ?= $(TS3D_ROOT)/data
exe-install = $(exe-dir)/$(exe)
man-install = $(man-dir)/$(man-page)
data-install = $(TS3D_DATA)
sources = src/*.c
headers = src/*.h
man-page-input = ts3d.6.in
cflags = -std=c99 -Wall -Wextra -Wpedantic -D_POSIX_C_SOURCE=200112L\
-DJSON_WITH_STDIO -DTS3D_VERSION="\"$(version)\"" ${CFLAGS}
linkage = -lm -lcurses
test-flags = -shared -fPIC -O0 -g3 -DCTF_TESTS_ENABLED
CC ?= cc
RM ?= rm -f
$(exe): $(sources) $(headers) $(version-file)
$(CC) $(cflags) -o $@ $(sources) $(linkage)
$(tests): $(sources) $(headers)
$(CC) $(cflags) $(test-flags) -o $@ $(sources) $(linkage)
$(windows-zip): $(exe)
./zip-windows
$(man-page): $(man-page-input) $(version-file)
sed "s/@@VERSION@@/$(version)/g" $< | gzip > $@
.PHONY: install
install: $(exe) $(man-page)
MAKEFILE=yes EXE="$(exe)" EXE_INSTALL="$(exe-install)" \
DATA_DIR="$(data-dir)" DATA_INSTALL="$(data-install)" \
MAN_PAGE="$(man-page)" MAN_INSTALL="$(man-install)" \
./installer install
.PHONY: uninstall
uninstall:
MAKEFILE=yes EXE_INSTALL="$(exe-install)" \
DATA_INSTALL="$(data-install)" MAN_INSTALL="$(man-install)" \
./installer uninstall
.PHONY: run-tests
run-tests: $(tests)
ceeteef -t8 $(tests)
.PHONY: clean
clean:
$(RM) $(exe) $(tests) $(windows-zip) $(man-page)