-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
93 lines (75 loc) · 2.35 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
include config.mk
all: options lili.c lili
options:
@echo lili build options:
@echo "CFLAGS = ${CFLAGS}"
@echo "LDFLAGS = ${LDFLAGS}"
@echo "CC = ${CC}"
lili.c: lili.lili
@echo tangling source from $^
@lili lili.lili
${OBJ}: config.mk
lili: lili.c
@echo building $@
@${CC} ${CFLAGS} ${LDFLAGS} -o $@ lili.c
lili.debug: lili.c
@echo building $@
@${CC} ${DEBUGFLAGS} ${LDFLAGS} -o $@ lili.c
clean:
@echo cleaning
@rm -f lili lili.debug ${OBJ} ${LIBOBJ} lili-${VERSION}.tar.gz
dist: clean lili.c
@echo creating dist tarball
@mkdir -p lili-${VERSION}
@cp -R Makefile config.mk lili.c lili.lili LICENSE lili-${VERSION}
@tar -cf lili-${VERSION}.tar lili-${VERSION}
@gzip lili-${VERSION}.tar
@rm -rf lili-${VERSION}
install: all
@echo installing executable file to ${DESTDIR}${prefix}/bin
@mkdir -p ${DESTDIR}${prefix}/bin
@cp -f lili ${DESTDIR}${prefix}/bin
@chmod 755 ${DESTDIR}${prefix}/bin/lili
uninstall:
@echo removing executable file from ${DESTDIR}${prefix}/bin
@rm -f ${DESTDIR}${prefix}/bin/lili
test_makes_file: lili
@mv lili.c lili.bak
@echo test lili produces lili.c
@./lili lili.lili
@test -f lili.c
@echo success
test_same_result: lili
@echo test lili produces the same result every time
@mv lili.c lili.bak
@./lili lili.lili
@mv lili.c lili.c1
@./lili lili.lili
@cmp lili.c lili.c1
@echo success
test_agrees_with_installed: lili
@echo test ./lili produces same result as system lili
@mv lili.c lili.bak
@./lili lili.lili
@mv lili.c lili.new
@lili lili.lili
@cmp lili.c lili.new
@echo success
test_indents: lili
@echo test ./lili produces correct indents
@./lili test/indents.lili
@cmp indents.out indents.expect
@echo success
test_single_invocations: lili
@echo test ./lili ignores multiple invocations
-./lili test/single_invocations.lili ; test $$? != 0 && echo success || echo failure
test_tangle_invocations: lili
@echo test ./lili ignores tangle invocations
-./lili test/tangle_invocations.lili ; test $$? != 0 && echo success || echo failure
test: test_makes_file test_same_result test_agrees_with_installed test_indents test_single_invocations test_tangle_invocations
@echo ran all tests
@mv lili.bak lili.c
@[ -f lili.new ] && rm lili.new
@[ -f lili.c1 ] && rm lili.c1
@rm -f *.out* *.expect*
.PHONY: all options clean dist install uninstall test test_makes_file test_same_result test_agrees_with_installed