-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
52 lines (36 loc) · 1.25 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
PREFIX = /usr/local
CFLAGS = -std=c11 -Wall -Werror -g
CFLAGS += -O2 -s -DNDEBUG -march=native -mtune=native -fomit-frame-pointer
CFLAGS += -flto -fdata-sections -ffunction-sections -Wl,--gc-sections
AMALG = skt.h skt.c
BINARIES = skt_sort skt_translit
SOURCES = $(wildcard src/*.h) $(wildcard src/*.c) $(wildcard src/gen/*.ic)
#--------------------------------------
# Abstract targets
#--------------------------------------
all: $(AMALG) $(BINARIES)
check: $(BINARIES)
cd test && ./test_translit.sh
cd test && ./test_sort.sh
clean:
rm -f $(BINARIES) lua/skt.so
install: $(BINARIES)
for file in $(BINARIES); do \
install -spm 0755 $$file $(PREFIX)/bin/$$file; \
done
uninstall:
for file in $(BINARIES); do \
rm -f $(PREFIX)/bin/$$file; \
done
.PHONY: all check clean install uninstall
#--------------------------------------
# Concrete targets
#--------------------------------------
skt.c: $(SOURCES)
scripts/mkamalg.py src/*.c > $@
skt.h: src/skt.h
cp $< $@
cmd/%.ih: cmd/%.hlp
scripts/mkcstring.py < $< > $@
%: cmd/%.c cmd/cmd.c cmd/kabak.c skt.c
$(CC) $(CFLAGS) $^ -o $@