-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile.in
176 lines (133 loc) · 5.29 KB
/
Makefile.in
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#############################################################################
# Don't touch these...
#############################################################################
this_makefile := ${lastword ${MAKEFILE_LIST}}
SHELL = @bash@ -o pipefail -o errexit -o nounset
.SECONDARY:
.DELETE_ON_ERROR:
#############################################################################
# things to set / override
#############################################################################
#HELP:Build file for @PACKAGE_NAME@ (@PACKAGE_TARNAME@)
#############################################################################
# dirs
srcdir = @srcdir@
builddir = @builddir@
publish_dir = ${builddir}/publish
#############################################################################
# COMMANDS
# Autoconf stuff
MKDIR_P = @MKDIR_P@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
SED = @SED@
# Unix commands
aspell = @aspell@
cat = @cat@
fgrep = @fgrep@
m4 = @m4@
sort = @sort@
# webb commands
process_doc = @process_doc@
#############################################################################
# files
dependencies_mk := ${builddir}/build/dependencies.mk
config_files = @config_files@
m4_required_files = ${srcdir}/src/macros.m4
m4_flags = --prefix-builtins --include=${builddir}/build ${m4_required_files}
doc_name = niem-json-spec
all_files = ${publish_dir}/${doc_name}.html \
${publish_dir}/${doc_name}.txt \
#############################################################################
# depend
#HELP:Variable 'depend':
#HELP: 'build': Build new dependencies file
#HELP: anything else: Include dependencies if they exist (the default)
depend = include-if-present
ifeq (${depend},build)
.DEFAULT_GOAL = depend
.PHONY: depend # Build dependencies file
depend: ${dependencies_mk}
${dependencies_mk}: ${builddir}/build/niem-json-spec.xml
@ ${MKDIR_P} ${dir $@}
${process_doc} --in=$< --out=$@ --format=makedepend
else
#HELP:Default target is "all". Targets include:
.DEFAULT_GOAL = all
# don't include if it doesn't exist, so that 'make clean' works w/o rebuilding dependencies
ifeq (${wildcard ${dependencies_mk}},${dependencies_mk})
include ${dependencies_mk}
endif
.PHONY: depend
depend:
@ echo "Run \"make depend=build\" to rebuild dependencies." >&2
endif
#############################################################################
# real targets
.PHONY: all # Build everything
all: ${all_files}
.PHONY: clean # Remove built files
clean:
${RM} ${all_files}
${RM} -r ${builddir}/build
.PHONY: distclean # Clean all build and configure products
distclean: clean
${RM} ${dependencies_mk} ${config_files} config.log config.status
#############################################################################
# build
${publish_dir}/%: ${builddir}/build/%
${MKDIR_P} ${dir $@}
${INSTALL_DATA} $< $@
${builddir}/build/${doc_name}.html: ${builddir}/build/${doc_name}.xml ${doc_html_required_files}
${process_doc} --format=html --in=$< --out=$@
${builddir}/build/${doc_name}.txt: ${builddir}/build/${doc_name}.xml ${doc_text_required_files}
${process_doc} --format=text --in=$< --out=$@
${builddir}/build/%: ${builddir}/build/%.m4 ${m4_required_files}
${MKDIR_P} ${dir $@}
${m4} ${m4_flags} $< > $@
@ if ${fgrep} MACRO_ $@; then echo found unexpanded macro in $@; false; fi
#############################################################################
# import from source
# import from src
${builddir}/build/%: ${srcdir}/src/%
${MKDIR_P} ${dir $@}
${INSTALL_DATA} $< $@
#############################################################################
# publish
#
# .PHONY: publish # Publish everything to $publish_dir (default @builddir@/publish)
# publish: ${publish_files}
#
# .PHONY: unpublish # Remove published files
# unpublish:
# ${RM} ${publish_files}
#############################################################################
# check spelling
.PHONY: spell # Check spelling of text doc
spell: ${builddir}/build/${doc_name}.txt
${cat} $< \
| ${aspell} --home-dir=${srcdir}/src -p aspell-exceptions.txt list \
| ${sort} -uf \
> ${builddir}/build/aspell-results.txt
if test -s ${builddir}/build/aspell-results.txt; then cat ${builddir}/build/aspell-results.txt; exit 1; fi
#############################################################################
# push to pages
pages_versions = v4.0alpha1 v4.0beta1 v4.0rc1 dev-4.0
.PHONY: pages # Make gh-pages
pages:
${RM} -R ${builddir}/build/gh-pages
git clone --local --branch gh-pages .git ${builddir}/build/gh-pages
git publish --verbose --force --target-dir=${builddir}/build/gh-pages --source-dir=publish ${pages_versions}
git -C ${builddir}/build/gh-pages status -u
@ [[ -z $$(git -C ${builddir}/build/gh-pages status --porcelain=v2) ]] || echo You should probably commit and clean up repo ${builddir}/build/gh-pages >&2
#############################################################################
# convenience targets
.PHONY: html # Build HTML output
html: ${builddir}/build/${doc_name}.html
#############################################################################
# make help: this must be the last target
.PHONY: help # Print this help
help:
@ ${SED} -e '/^\.PHONY:/s/^\.PHONY: *\([^ #]*\) *\#\( *\)\([^ ].*\)/\2\1: \3/p;/^[^#]*#HELP:/s/[^#]*#HELP:\(.*\)/\1/p;d' ${this_makefile}
# don't put anything after this