-
Notifications
You must be signed in to change notification settings - Fork 14
/
Makefile
45 lines (31 loc) · 826 Bytes
/
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
# pl0c Makefile
CC ?= cc
CFLAGS ?= -g -O2 -DHAVE_STRTONUM
PREFIX ?= /usr/local
MANDIR ?= ${PREFIX}/man
PROG = pl0c
OBJS = pl0c.o
BOOTSTRAP = bootstrap
STAGE2 = stage2
all: final
bootstrap: ${OBJS}
${CC} ${LDFLAGS} -o ${BOOTSTRAP} ${OBJS}
stage2: bootstrap
./${BOOTSTRAP} < pl0c.pl0 | ${CC} ${CFLAGS} -o ${STAGE2} -x c -
stage3: stage2
./${STAGE2} < pl0c.pl0 | ${CC} ${CFLAGS} -o ${PROG} -x c -
final: stage3
cmp -s ${STAGE2} ${PROG}
nobootstrap:
${PROG} < pl0c.pl0 | ${CC} ${CFLAGS} -o ${PROG} -x c -
genbootstrap: final
./${PROG} < pl0c.pl0 | clang-format > pl0c.c
install:
install -d ${PREFIX}/bin
install -d ${MANDIR}/man1
install -c -s -m 755 ${PROG} ${PREFIX}/bin
install -c -m 444 ${PROG}.1 ${MANDIR}/man1
test:
cd tests && ./test.sh
clean:
rm -f ${PROG} ${BOOTSTRAP} ${STAGE2} ${OBJS} *.core