-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (41 loc) · 1.49 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
59
60
61
62
63
DEFINES = '{$$MODE OBJFPC} {$$COPERATORS ON} {$$TYPEDADDRESS ON} {$$INLINE ON} {$$MACRO ON}'
FLAGS += -vewn -Xs -XX -CX -OrG3
GPROF += -vewnh -gl -pg
PREFIX ?= /usr
DESTDIR ?=
BENCHMARKS = $(addprefix benchmark/,$(shell ls benchmark/))
TESTS = $(addprefix test/,$(shell ls test/))
# -- variables end
.PHONY: all clean install test $(BENCHMARKS) $(TESTS)
all: build/awful
clean:
rm -rf build/ bin/
install: build/awful build/awful-cgi
cp ./build/awful "$(DESTDIR)$(PREFIX)/bin/awful"
cp ./build/awful-cgi "$(DESTDIR)$(PREFIX)/bin/awful-cgi"
cp -p ./awful.man "$(DESTDIR)$(PREFIX)/share/man/man1/awful"
benchmark: $(BENCHMARKS)
test: $(TESTS)
# -- PHONY targets end
bin/awful: build/awful
mkdir -p bin/
cp -a "$<" "$@"
bin/awful-cgi: build/awful-cgi
mkdir -p bin/
cp -a "$<" "$@"
build/awful: src/defines.inc src/gitsha.inc
mkdir -p build/
fpc $(FLAGS) src/awful.pas -o'build/awful'
build/awful-cgi: src/defines.inc src/gitsha.inc
mkdir -p build/
echo '{$$DEFINE CGI}' >> src/defines.inc
fpc $(FLAGS) src/awful.pas -o'build/awful-cgi'
src/defines.inc:
echo $(DEFINES) > src/defines.inc
src/gitsha.inc:
echo "'`git rev-parse HEAD`'" > src/gitsha.inc
test/*: bin/awful
bin/awful -i "$@/input.txt" -o "$@/result.txt" "$@/test.yuk"
diff --ignore-trailing-space "$@/result.txt" "$@/output.txt"
benchmark/*: bin/awful
/bin/time bin/awful -i "$@/input.txt" -o "/dev/null" "$@/script.yuk" -- "$$(wc -l "$@/input.txt" | cut -f1 '-d ')"