1# This just shortcuts stuff through to cmake
2all build ctwm man man-html man-all install clean: build/Makefile
3	( cd build && ${MAKE} ${@} )
4
5CMAKE?=cmake
6build/Makefile cmake: CMakeLists.txt
7	( mkdir -p build && cd build && \
8		${CMAKE} -DCMAKE_C_FLAGS:STRING="${CFLAGS}" ${CMAKE_EXTRAS} .. )
9
10allclean distclean:
11	rm -rf build/*
12
13
14
15#
16# The below targets are mostly only of interest to developers
17#
18
19# Add'l thunks to cmake
20.PHONY: tags
21man-pdf doxygen doxyclean tags: build/Makefile
22	( cd build && ${MAKE} ${@} )
23
24# Make sure everything's build before running tests
25.PHONY: test
26test: build/Makefile
27	( cd build && ${MAKE} test_bins )
28	( cd build && ${MAKE} CTEST_OUTPUT_ON_FAILURE=1 ${@} )
29
30# Reindent files
31indent:
32	astyle -n --options=tools/ctwm.astyle *.[ch] tests/*/*.[ch]
33
34
35# Build documentation files
36DOC_FILES=README.html CHANGES.html
37docs: ${DOC_FILES}
38docs_clean doc_clean:
39	rm -f ${DOC_FILES}
40
41.SUFFIXES: ${.SUFFIXES} .html .md
42.md.html:
43	multimarkdown -afo ${@} ${<}
44
45
46# asciidoc files
47UMAN=doc/manual
48adocs:
49	(cd ${UMAN} && make all_set_version)
50adocs_pregen:
51	(cd ${UMAN} && make all)
52adoc_clean:
53	(cd ${UMAN} && make clean)
54
55
56#
57# Pre-build some files for tarballs
58#
59GEN=gen
60${GEN}:
61	mkdir -p ${GEN}
62
63# All the generated source files
64_RELEASE_FILES=gram.tab.c gram.tab.h lex.c version.c.in ctwm.1 ctwm.1.html
65RELEASE_FILES=${_RELEASE_FILES:%=${GEN}/%}
66
67# Build those, the .html versions of the above docs, and the HTML/man
68# versions of the manual
69release_files: ${GEN} build/MKTAR_GENFILES ${RELEASE_FILES} ${DOC_FILES}
70release_clean: doc_clean adoc_clean
71	rm -rf ${GEN}
72
73# Stuff for thunking to cmake
74build/MKTAR_GENFILES: build/Makefile
75	(cd build ; make mktar_genfiles)
76
77# The config grammar
78${GEN}/gram.tab.c: ${GEN}/gram.tab.h
79${GEN}/gram.tab.h: ${GEN} gram.y build/MKTAR_GENFILES
80	cp build/gram.tab.[ch] ${GEN}/
81
82${GEN}/lex.c: ${GEN} lex.l build/MKTAR_GENFILES
83	cp build/lex.c ${GEN}/
84
85# Setup version file
86${GEN}/version.c.in: ${GEN} version.c.in .bzr/checkout/dirstate
87	env BZR_CMD=brz tools/rewrite_version_bzr.sh < version.c.in \
88			> ${GEN}/version.c.in
89
90# Generate pregen'd manuals
91${GEN}/ctwm.1: ${UMAN}/ctwm.1
92${GEN}/ctwm.1.html: ${UMAN}/ctwm.1.html
93${GEN}/ctwm.1 ${GEN}/ctwm.1.html:
94	cp ${UMAN}/ctwm.1 ${UMAN}/ctwm.1.html ${GEN}/
95${UMAN}/ctwm.1 ${UMAN}/ctwm.1.html:
96	(cd ${UMAN} && make clean all)
97
98
99# Thunk through to gen'ing tarball
100tar:
101	tools/mk_tar.sh
102