-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
86 lines (64 loc) · 2.36 KB
/
Makefile
File metadata and controls
86 lines (64 loc) · 2.36 KB
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
#
# chmap: retreive information about Unicode characters
# https://github.com/lptstr/chmap
#
# (c) Kiëd Llaentenn and contributors
# See the LICENSE.md file for more information
#
include config.mk
BIN = chmap
VERSION = 1.1.0
PKGNAME = $(BIN)-$(shell uname -s)-$(shell uname -m)-$(VERSION)
SRC = src/utf8.c src/unicode.c src/util.c src/main.c
OBJ = $(SRC:.c=.o)
WARNING = -Wall -Wpedantic -Wextra -Wold-style-definition -Wformat=2 \
-Wmissing-prototypes -Winit-self -Wfloat-equal -Wstrict-prototypes \
-Wredundant-decls -Wendif-labels -Wstrict-aliasing=2 -Woverflow \
-Werror=implicit-function-declaration -Werror=return-type
INC = -I ~/local/include/ -I. -Isrc/
DEF = -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=1000 -DVERSION=\"$(VERSION)\"
CFLAGS = -std=c99 $(WARNING) $(DEF) $(INC)
LDFLAGS = -fuse-ld=$(LD) -L ~/local/lib -static
all: man/$(BIN).1 debug
.c.o:
@printf " %-8s%s\n" "CC" $@
$(CMD)$(CC) -c $< -o $(<:.c=.o) $(CFLAGS) $(CFLAGS_OPT)
debug: CFLAGS_OPT := $(DEBUG_CFLAGS)
debug: LDFLAGS_OPT := $(DEBUG_LDFLAGS)
debug: $(BIN)
release: CFLAGS_OPT := $(RELEASE_CFLAGS)
release: LDFLAGS_OPT := $(RELEASE_LDFLAGS)
release: $(BIN) man/$(BIN).1
src/main.o: src/range.c src/display.c
$(BIN): dat/charinfo.c $(OBJ)
@printf " %-8s%s\n" "CCLD" $@
$(CMD)$(CC) -o $@ $(OBJ) $(CFLAGS) $(CFLAGS_OPT) $(LDFLAGS) $(LDFLAGS_OPT)
dat/charinfo.c: tool/gencharsh.lua dat/UnicodeData.txt
@printf " %-8s%s\n" "GEN" $@
$(CMD)tool/gencharsh.lua < dat/UnicodeData.txt > $@
man/$(BIN).1: man/$(BIN).scd
@printf " %-8s%s\n" "SCDOC" $@
$(CMD)scdoc < $^ > $@
clean:
rm -rf $(BIN) $(OBJ) man/$(BIN).1
rm -rf *.xz $(PKGNAME)*
rm -rf dat/charinfo.c
dist: release man/$(BIN).1
$(CMD)mkdir $(PKGNAME)
$(CMD)cp $(BIN) $(PKGNAME)
$(CMD)cp man/$(BIN).1 $(PKGNAME)
$(CMD)cp tool/install.sh $(PKGNAME)
$(CMD)tar -cf - $(PKGNAME) | xz -qcT0 > $(PKGNAME).tar.xz
$(CMD)rm -rf $(PKGNAME)
install: $(BIN) man/$(BIN).1
install -Dm755 $(BIN) $(DESTDIR)/$(PREFIX)/bin/$(BIN)
install -Dm644 man/$(BIN).1 $(DESTDIR)/$(PREFIX)/share/man/man1/$(BIN).1
uninstall:
rm -f $(DESTDIR)/$(PREFIX)/bin/$(BIN)
rm -f $(DESTDIR)/$(PREFIX)/share/man/man1/$(BIN).1
check:
$(CMD)for i in tests/pilot_*.c; do \
cc -Isrc/ $$i -o $${i%%.c} -O0 -g || exit 1; \
done
$(CMD)find tests -name '*.sh' -perm -700 -exec '{}' \;
.PHONY: all debug release clean dist install uninstall check