-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
63 lines (48 loc) · 1.41 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
-include config.mak
GCC ?= gcc
CFLAGS ?= -O2 -g -Wall -Wcast-align
SYNC ?= -s
all: stubforth
config.h: .rev.h
.rev.h: .git/* .
echo -n \#define REVISION \" > $@
echo -n $$(git describe --always --dirty) >> $@
echo '"' >> $@
echo -n \#define COMPILER \" >> $@
echo -n "$$($(GCC) --version|sed q)" >> $@
echo '"' >> $@
stubforth.o: stubforth.c *.h Makefile *.m4 config.h symbols.h platform.h
$(GCC) $(CFLAGS) -o $@ -c $<
stubforth.s: stubforth.c *.h Makefile *.m4 config.h symbols.h platform.h
$(GCC) $(CFLAGS) -o $@ -S $<
stubforth: stubforth.o
$(GCC) $(CFLAGS) -o $@ $<
%.size: % size.sh
. ./size.sh $<
strip $<
ls -l $<
size $<
%.c: %.c.m4 Makefile *.m4
m4 $(SYNC) $< > $@
check: stubforth
expect test.tcl
clean:
rm -f symbols.h symbols.4th symbols.gdb
rm -f TAGS
rm -f *grind.out.* stubforth
rm -f .rev.h *.o *.s stubforth.c
rm -f *.vcg
symbols.%: symto%.m4 symbols.m4
m4 $< > $@
dev: symbols.gdb TAGS
TAGS: .
ctags-exuberant -e --langdef=forth --langmap=forth:.4th.m4 \
--regex-forth='/: *([^ ]+)/\1/' \
--regex-forth='/(primary|secondary|constant|master)\([^,]+, ([^,\)]+)/\2/' \
--regex-forth='/(primary|secondary|constant|master)\(([a-z0-9_]+)/\2/' \
*.4th *.c.m4 *.m4
shopt -s nullglob; ctags-exuberant -e -a --language-force=c *.c *.h *.m4
%.o : %.4th
$(OBJCOPY) -I binary -B arm -O elf32-littlearm \
--rename-section .data=.rodata,alloc,load,readonly,data,contents \
$< $@