~ctwm/ctwm/trunk

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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# This just shortcuts stuff through to cmake
all build ctwm man man-html man-all install clean: build/Makefile
	( cd build && ${MAKE} ${@} )

CMAKE?=cmake
build/Makefile cmake: CMakeLists.txt
	( mkdir -p build && cd build && \
		${CMAKE} -DCMAKE_C_FLAGS:STRING="${CFLAGS}" ${CMAKE_EXTRAS} .. )

allclean distclean:
	rm -rf build/*



#
# The below targets are mostly only of interest to developers
#

# Add'l thunks to cmake
.PHONY: tags
man-pdf doxygen doxyclean tags: build/Makefile
	( cd build && ${MAKE} ${@} )

# Make sure everything's build before running tests
.PHONY: test
test: build/Makefile
	( cd build && ${MAKE} test_bins )
	( cd build && ${MAKE} CTEST_OUTPUT_ON_FAILURE=1 ${@} )

# Reindent files
indent:
	astyle -n --options=tools/ctwm.astyle *.[ch] tests/*/*.[ch]


# Build documentation files
DOC_FILES=README.html CHANGES.html
docs: ${DOC_FILES}
docs_clean doc_clean:
	rm -f ${DOC_FILES}

.SUFFIXES: ${.SUFFIXES} .html .adoc
.adoc.html:
	asciidoctor -o ${@} ${<}


# asciidoc files
UMAN=doc/manual
adocs:
	(cd ${UMAN} && make all_set_version)
adocs_pregen:
	(cd ${UMAN} && make all)
adoc_clean:
	(cd ${UMAN} && make clean)


#
# Pre-build some files for tarballs
#
GEN=gen
${GEN}:
	mkdir -p ${GEN}

# All the generated source files
_RELEASE_FILES=gram.tab.c gram.tab.h lex.c version.c.in ctwm.1 ctwm.1.html
RELEASE_FILES=${_RELEASE_FILES:%=${GEN}/%}

# Build those, the .html versions of the above docs, and the HTML/man
# versions of the manual
release_files: ${GEN} build/MKTAR_GENFILES ${RELEASE_FILES} ${DOC_FILES}
release_clean: doc_clean adoc_clean
	rm -rf ${GEN}

# Stuff for thunking to cmake
build/MKTAR_GENFILES: build/Makefile
	(cd build ; make mktar_genfiles)

# The config grammar
${GEN}/gram.tab.c: ${GEN}/gram.tab.h
${GEN}/gram.tab.h: ${GEN} gram.y build/MKTAR_GENFILES
	cp build/gram.tab.[ch] ${GEN}/

${GEN}/lex.c: ${GEN} lex.l build/MKTAR_GENFILES
	cp build/lex.c ${GEN}/

# Setup version file
${GEN}/version.c.in: ${GEN} version.c.in .bzr/checkout/dirstate
	env BZR_CMD=brz tools/rewrite_version_bzr.sh < version.c.in \
			> ${GEN}/version.c.in

# Generate pregen'd manuals
${GEN}/ctwm.1: ${UMAN}/ctwm.1
${GEN}/ctwm.1.html: ${UMAN}/ctwm.1.html
${GEN}/ctwm.1 ${GEN}/ctwm.1.html:
	cp ${UMAN}/ctwm.1 ${UMAN}/ctwm.1.html ${GEN}/
${UMAN}/ctwm.1 ${UMAN}/ctwm.1.html:
	(cd ${UMAN} && make clean all)


# Thunk through to gen'ing tarball
tar:
	tools/mk_tar.sh