-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
64 lines (48 loc) · 1.7 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
.PHONY: clean test install uninstall code_install vim_install
ifeq (${DEBUG}, 1)
LFLAGS += --debug --trace
CXXFLAGS += -Wall -Wextra -Wpedantic
CXXFLAGS += -DDEBUG -O0 -ggdb -fno-inline
WRAP := valgrind --track-origins=yes --leak-check=full --show-leak-kinds=all
else
CXXFLAGS += -std=c++17 -O3 -fno-stack-protector -fno-exceptions -fno-rtti
endif
OUT := contra
SOURCE.d := source/
OBJECT.d := object/
TEST.d := test/
INSTALL.d := /bin/
SOURCE := main.cpp from_xml_to_csml.cpp from_csml_to_xml.cpp cli.cpp html_special.cpp
OBJECT := $(addprefix ${OBJECT.d}/,${SOURCE})
OBJECT := ${OBJECT:.cpp=.o}
OBJECT := ${OBJECT:.c=.o}
DIFF := diff --side-by-side --report-identical-files --expand-tabs --ignore-trailing-space --color=always
%.cpp: %.l
${LEX} --prefix=$(basename $(notdir $<))_ ${LFLAGS} -o $@ $<
${OBJECT.d}/%.o: ${SOURCE.d}/%.cpp
${COMPILE.cpp} -o $@ $<
${OUT}: ${OBJECT}
${LINK.cpp} -o $@ ${OBJECT} ${LDLIBS}
install: ${OUT}
cp ${OUT} ${INSTALL.d}/${OUT}
uninstall:
${RM} ${INSTALL.d}/${OUT}
vim_install:
cp plugin/contra.vim ~/.vim/plugin/
code_install: code
code --install-extension plugin/vscode/*.vsix
code:
cd plugin/vscode/; \
yarn package
test: ${OUT}
${DIFF} <(bat ${TEST.d}/draft.html) <(${WRAP} ./${OUT} -s 'html' -c ${TEST.d}/draft.csml)
${DIFF} <(bat ${TEST.d}/draft.csml) <(${WRAP} ./${OUT} -s 'html' -x ${TEST.d}/draft.html)
${DIFF} <(bat ${TEST.d}/complex.html) <(${WRAP} ./${OUT} -s 'html' -c ${TEST.d}/complex.csml)
${DIFF} <(bat ${TEST.d}/complex.csml) <(${WRAP} ./${OUT} -s 'html' -x ${TEST.d}/complex.html)
clean:
-rm ${OUT}
-rm ${OBJECT}
docs:
for i in documentation/*.md; do \
kramdown-man "$$i" -o documentation/manual/$$(basename -s .md $$i) ; \
done