a/Makefile b/Makefile
1
C2IEC=c2iec
1
C2IEC=c2iec
2
TESTS=$(patsubst %.c, %.test, $(wildcard test/*.c))
2
TESTS=$(patsubst %.c, %.test, $(wildcard test/*.c))
3
TEST_LOGS=$(patsubst %.c, %.test.log, $(wildcard test/*.c))
3
TEST_LOGS=$(patsubst %.c, %.test.log, $(wildcard test/*.c))
4
4
5
# if parameter "DEBUG" is set, we set debug flags for lex/yacc
6
ifneq (${DEBUG},)
7
DEBUG_FLAGS += -d
8
endif
9
5
all: ${C2IEC}
10
all: ${C2IEC}
6
11
7
${C2IEC}: lex.yy.c y.tab.c
12
${C2IEC}: lex.yy.c y.tab.c
8
    gcc -o $@ $^
13
    gcc -o $@ $^
9
14
10
lex.yy.c: ${C2IEC}.l
15
lex.yy.c: ${C2IEC}.l
11
    flex -d $^
16
    flex ${DEBUG_FLAGS} $^
12
17
13
y.tab.c: ${C2IEC}.y
18
y.tab.c: ${C2IEC}.y
14
    yacc -d $^
19
    yacc ${DEBUG_FLAGS} $^
15
20
16
y.dot: ${C2IEC}.y
21
y.dot: ${C2IEC}.y
17
    yacc -g $^
22
    yacc -g $^
18
23
19
commit: ${TEST_LOGS}
24
commit: ${TEST_LOGS}
20
    for i in ${TEST_LOGS}; do \
25
    for i in ${TEST_LOGS}; do \
21
        cp $$i $$(dirname $$i)/$$(basename $$i .log).expected; \
26
        cp $$i $$(dirname $$i)/$$(basename $$i .log).expected; \
22
    done
27
    done
23
clean:
28
clean:
24
    rm -f ${C2IEC}
29
    rm -f ${C2IEC}
25
    rm -f ${TEST_LOGS}
30
    rm -f ${TEST_LOGS}
31
    rm -f lex.yy.c
32
    rm -f y.tab.c
26
33
27
.PHONY: test
34
.PHONY: test
28
test: ${TESTS}
35
test: ${TESTS}
29
36
30
%.test: %.test.log
37
%.test: %.test.log
...
...
44
51