forked from howerj/dbcc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
82 lines (62 loc) · 1.73 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
LDFLAGS = -lm
CFLAGS = -std=c99 -Wall -Wextra -g -O2 -pedantic -fwrapv -DDBCC_VERSION="\"v1.2.2\""
RM := rm
OUTDIR := out
SOURCES := ${wildcard *.c}
MDS := ${wildcard *.md}
HTMLS := ${MDS:%.md=%.html}
PDFS := ${MDS:%.md=%.pdf}
MANS := ${MDS:%.md=%.1}
DBCS := ${wildcard *.dbc}
OBJECTS := ${SOURCES:%.c=%.o}
LIBOBJS := $(filter-out main.o, $(OBJECTS))
DEPS := ${SOURCES:%.c=%.d}
XMLS := ${DBCS:%.dbc=${OUTDIR}/%.xml}
XHTMLS := ${XMLS:%.xml=%.xhtml}
CODECS := ${DBCS:%.dbc=${OUTDIR}/%.c}
CFLAGS += -MMD
TARGET := dbcc
.PHONY: doc all run clean test
all: ${TARGET}
%.o: %.c
${CC} ${CFLAGS} ${INCLUDES} $< -c -o $@
%.1: %.md
pandoc --standalone --to man -o$@ $<
%.html: %.md
pandoc -o $@ $<
%.pdf: %.md
pandoc -o $@ $<
lib${TARGET}.a: ${OBJECTS}
ar rcs $@ ${OBJECTS}
ranlib $@
${TARGET}: ${OBJECTS}
${CC} ${CFLAGS} $^ ${LDFLAGS} -o $@
${OUTDIR}/%.c: %.dbc ${TARGET}
./${TARGET} ${DBCCFLAGS} -o ${OUTDIR} $<
${OUTDIR}/%.xml: %.dbc ${TARGET}
./${TARGET} ${DBCCFLAGS} -x -o ${OUTDIR} $<
xmllint --noout --schema dbcc.xsd $@
${OUTDIR}/%.csv: %.dbc ${TARGET}
./${TARGET} ${DBCCFLAGS} -C -o ${OUTDIR} $<
${OUTDIR}/%.json: %.dbc ${TARGET}
./${TARGET} ${DBCCFLAGS} -j -o ${OUTDIR} $<
%.xhtml: %.xml dbcc.xslt
xsltproc --output $@ dbcc.xslt $<
run: ${XMLS} ${CODECS} ${XHTMLS}
TESTS=${OUTDIR}/ex1.c \
${OUTDIR}/ex2.c \
${OUTDIR}/double_signal.c \
${OUTDIR}/float_signal.c \
${OUTDIR}/ex1.xml \
${OUTDIR}/ex2.xml \
${OUTDIR}/ex1.csv \
${OUTDIR}/ex2.csv \
${OUTDIR}/ex1.json \
${OUTDIR}/ex2.json \
${OUTDIR}/enum.c
test: ${TESTS}
make -C ${OUTDIR}
doc: ${HTMLS} ${MANS} ${PDFS}
-include ${DEPS}
clean:
${RM} -f *.o *.d *.out ${TARGET} *.htm vgcore.* core