-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
56 lines (41 loc) · 1.45 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
PREFIX = /usr/local
CFLAGS = -DSB_PREFIX='"$(PREFIX)"' -DSB_DEBUG
CFLAGS += -std=c11 -g -Wall -Werror -pedantic
CFLAGS += -O2 -DNDEBUG -march=native -mtune=native -fomit-frame-pointer -s
CFLAGS += -flto -fdata-sections -ffunction-sections -Wl,--gc-sections
LDLIBS = -lm
AMALG = sabir.h sabir.c
#--------------------------------------
# Abstract targets
#--------------------------------------
all: $(AMALG) sabir example
clean:
rm -f sabir example vgcore* core test/*.tmp
check: sabir
test/test.py test/data/*
test/bad_utf8.sh
install: sabir sabir-train model.sb
install -spm 0755 sabir $(PREFIX)/bin/sabir
install -pm 0644 cmd/sabir.1 $(PREFIX)/share/man/man1
install -pm 0755 sabir-train $(PREFIX)/bin/sabir-train
install -pDm 0644 model.sb $(PREFIX)/share/sabir/model.sb
uninstall:
rm -f $(PREFIX)/bin/sabir
rm -f $(PREFIX)/share/man/man1/sabir.1
rm -f $(PREFIX)/bin/sabir-train
rm -f $(PREFIX)/share/sabir/model.sb
rmdir $(PREFIX)/share/sabir 2> /dev/null || true
.PHONY: all clean check install uninstall
#--------------------------------------
# Concrete targets
#--------------------------------------
cmd/%.ih: cmd/%.txt
cmd/mkcstring.py < $< > $@
sabir.h: src/api.h
cp $< $@
sabir.c: $(wildcard src/*.[hc] src/lib/*.[hc])
src/mkamalg.py src/*.c > $@
example: example.c $(AMALG)
$(CC) $(CFLAGS) $(LDLIBS) $< sabir.c src/lib/utf8proc.c -o $@
sabir: $(wildcard cmd/*) $(AMALG)
$(CC) $(CFLAGS) $(LDLIBS) cmd/*.c sabir.c src/lib/utf8proc.c -o $@