-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
77 lines (62 loc) · 3.24 KB
/
Makefile
File metadata and controls
77 lines (62 loc) · 3.24 KB
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
#--------------------------------------------------------------------------
# Makefile for antBASIC on the Raspberry Pi
#
# NOTICE You need to pre-install "libreadline-dev", "atp" and
# "ghostscript (includes ps2pdf)" packages before "make std|max".
#--------------------------------------------------------------------------
# PREP $ sudo apt install libreadline-dev atp ghostscript
#--------------------------------------------------------------------------
# BUILD $ make --> main applications only
# $ make std --> main applications plus PDFs
# $ make max --> main and test applications plus PDFS
# INSTALL $ sudo make install --> install main applications and MAN file
#--------------------------------------------------------------------------
# BAREMETALHACK.COM --> public domain
#--------------------------------------------------------------------------
CFLAGS := -Wall -Wextra
CFLAGS += -DREADLINE ### Build antBASIC with readline extension
CFLAGS += -DPI ### Build antBASIC targeted for Raspberry Pi
# CFLAGS += -DDEBUG ### Turn on in the case of debugging
LDLIBS := -lreadline ### Link with GNU Readline library
ATPFLAGS := -t 8 -date `date "+%Y-%m-%d"`
ATPFLAGS += -T A4 -M 1,1,2,2 cm ### Paper size and margin definition
#ATPFLAGS += -N ### With line number
GROFFFLAGS := -mandoc -Tps
GROFFFLAGS += -dpaper=a4 ### Paper size
TARGET_BIN := /usr/local/bin
TARGET_MAN := /usr/local/share/man/man1
TARGET_DOC := ./DOCUMENTS
HEADERS = byteword.h token.h bcode.h program.h container.h function.h eval.h basic.h debug.h escape.h
APPS = antbasic antcalib
TESTAPPS = test_token test_bcode test_prog test_eval test_assign
PDFS = $(TARGET_DOC)/antbasic_src.pdf $(TARGET_DOC)/antbasic_man.pdf
.SECONDEXPANSION:
min: antbasic antcalib
std: antbasic antcalib pdfs
max: test_token test_bcode test_prog test_eval test_assign antbasic antcalib pdfs
test_token : $$@.c $(HEADERS) token.c
gcc $(CFLAGS) -o $@ $(filter %.c, $^)
test_bcode: $$@.c $(HEADERS) token.c bcode.c
gcc $(CFLAGS) -o $@ $(filter %.c, $^)
test_prog: $$@.c $(HEADERS) token.c bcode.c program.c
gcc $(CFLAGS) -o $@ $(filter %.c, $^)
test_eval: $$@.c $(HEADERS) token.c bcode.c container.c function.c eval.c pi_gpio.c
gcc $(CFLAGS) -o $@ $(filter %.c, $^)
test_assign: $$@.c $(HEADERS) token.c bcode.c container.c function.c eval.c pi_gpio.c
gcc $(CFLAGS) -o $@ $(filter %.c, $^)
antbasic: $(HEADERS) main.c token.c bcode.c program.c container.c function.c eval.c basic.h basic.c pi_gpio.c main.c
gcc $(CFLAGS) -o $@ $(filter %.c, $^) -lreadline
antcalib: antcalib.c
gcc $(CFLAGS) -o $@ antcalib.c
pdfs:
atp $(ATPFLAGS) Makefile byteword.h debug.h escape.h token.h token.c test_token.c bcode.h bcode.c test_bcode.c program.h program.c test_prog.c container.h container.c function.h function.c eval.h eval.c test_eval.c test_assign.c basic.h basic.c pi_gpio.h pi_gpio.c main.c antcalib.c | ps2pdf - - > $(TARGET_DOC)/antbasic_src.pdf
groff $(GROFFFLAGS) antbasic.1 | ps2pdf - - > $(TARGET_DOC)/antbasic_man.pdf
install: antbasic antcalib
install -v -t $(TARGET_BIN) antbasic antcalib
install -v -D -t $(TARGET_MAN) antbasic.1
clean:
rm -f *.o $(APPS) $(TESTAPPS)
dist-clean:
rm -f *.o $(APPS) $(TESTAPPS) $(PDFS)
rm -f $(TARGET_BIN)/antbasic $(TARGET_BIN)/antcalib
rm -f $(TARGET_MAN)/antbasic.1