]> Lady’s Gitweb - Shushe/blob - GNUmakefile
Allow output wrapping to be disabled
[Shushe] / GNUmakefile
1 SHELL = /bin/sh
2
3 # ━ § BASIC INFORMATION ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
4 override define makefileinfo
5 ╭────────────────────────────╮
6 ╔╡ ⁌ ⛩️📰 书社 ∷ GNUmakefile ╞════════════════════════════════╗
7 ║╰────────────────────────────╯ ║
8 ╟┬ ¶ Prerequisites ───────────────────────────────────────────┬╢
9 ║│ │║
10 ║│ Requires G·N·U Make, at least version 3.81, a version of │║
11 ║│ uuencode with base64 support, and the various programs │║
12 ║│ offered by libxml2 and libxslt. Beyond this, only programs │║
13 ║│ required by Posix are used, altho there is a chance of │║
14 ║│ version incompatibilities. The full list of program │║
15 ║│ requirements is as follows :— │║
16 ║│ │║
17 ║│ • cat │║
18 ║│ • cp │║
19 ║│ • echo │║
20 ║│ • file │║
21 ║│ • find │║
22 ║│ • mkdir (requires support for `-p´) │║
23 ║│ • mv │║
24 ║│ • printf │║
25 ║│ • rm │║
26 ║│ • sed │║
27 ║│ • sleep │║
28 ║│ • test │║
29 ║│ • touch │║
30 ║│ • tr (requires support for `-d´) │║
31 ║│ • uuencode (requires support for `-m´ and `-r´) │║
32 ║│ • xmlcatalog (provided by libxml2) │║
33 ║│ • xmllint (provided by libxml2) │║
34 ║│ • xsltproc (provided by libxslt) │║
35 ║│ │║
36 ║│ In all cases, you can supply your own version of any │║
37 ║│ program `program´ by overriding the corresponding variable │║
38 ║│ `PROGRAM´ when calling Make. │║
39 ║╰────────────────────────────────────────────────────────────╯║
40 ╟┬ ¶ Usage ───────────────────────────────────────────────────┬╢
41 ║│ │║
42 ║│ • `make all´: Compile, but do not install, all files. │║
43 ║│ │║
44 ║│ • `make clean´: Remove `BUILDDIR´. │║
45 ║│ │║
46 ║│ • `make gone´: Remove installed files. │║
47 ║│ │║
48 ║│ • `make help´ (default): Print this message. │║
49 ║│ │║
50 ║│ • `make install´: Compile all files and install in │║
51 ║│ `DESTDIR´. │║
52 ║│ │║
53 ║│ • `make list´: List all recognized source files and their │║
54 ║│ classification (including media type and dependencies). │║
55 ║│ │║
56 ║│ Set `VERBOSE=1´ to see the text of commands as they are │║
57 ║│ executed. │║
58 ║│ │║
59 ║│ See `README.markdown´ for a more involved description of │║
60 ║│ the capabilities and configuration of this program. │║
61 ║╰────────────────────────────────────────────────────────────╯║
62 ╟┬ ¶ Copyright & License ─────────────────────────────────────┬╢
63 ║│ │║
64 ║│ Copyright © 2023–2024 Lady [@ Lady’s Computer]. │║
65 ║│ │║
66 ║│ This Source Code Form is subject to the terms of the │║
67 ║│ Mozilla Public License, v 2.0. If a copy of the M·P·L was │║
68 ║│ not distributed with this file, You can obtain one at │║
69 ║│ <http://mozilla.org/MPL/2.0/>. │║
70 ║╰────────────────────────────────────────────────────────────╯║
71 ╚══════════════════════════════════════════════════════════════╝
72 endef
73
74 # ━ § MAKE·FILE SETUP ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
75
76 # Programs needed to run this make·file.
77 #
78 # If these are not installed on your computer, or you need to use a
79 # different implementation, you can override the appropriate variable.
80 CAT := cat
81 CP := cp
82 ECHO := echo
83 FILE := file
84 FIND := find
85 MKDIR := mkdir
86 MV := mv
87 PRINTF := printf
88 RM := rm
89 SED := sed
90 SLEEP := sleep
91 TEST := test
92 TOUCH := touch
93 TR := tr
94 UUENCODE := uuencode
95 XMLCATALOG := xmlcatalog
96 XMLLINT := xmllint
97 XSLTPROC := xsltproc
98
99 # The directory which contains the source files.
100 SRCDIR := sources
101
102 # The directory which contains “includes”: Files which may be included
103 # in other files but for which no final output will be generated.
104 #
105 # This can be inside of `SOURCES_DIRECTORY´ if desired.
106 INCLUDEDIR := sources/includes
107
108 # The directory in which to generate temporary buildfiles.
109 BUILDDIR := build
110
111 # The directory into which to output files on `make install´.
112 DESTDIR := public
113
114 # The location of this Makefile (and related ⛩️📰 书社 files),
115 # relative to the current working directory.
116 #
117 # By default, this is inferred from the variable `MAKEFILE_LIST´.
118 THISDIR := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
119
120 # The location of the magic files to use when determining media types.
121 #
122 # One is provided as part of this repository, but you can override it
123 # if you need different media type detection.
124 #
125 # Your computer probably has a more comprehensive one installed at
126 # `/usr/share/file/magic´, but it is not recommended that you use this
127 # directly. Instead, link or copy just the files you expect to need for
128 # your project.
129 MAGICDIR := $(patsubst ./%,%,$(THISDIR)/magic)
130
131 # Configuration of `find´.
132 #
133 # By default, `find´ will follow symlinks and use extended regular
134 # expressions, ignoring hidden files and those which begin with a
135 # period.
136 FINDOPTS := -LE
137 FINDRULES := -flags -nohidden -and -not -name '.*'
138
139 # The list of parsers for plaintext file types.
140 #
141 # Which parsers are provided will influence which kinds of files are
142 # recognized as plaintext.
143 #
144 # Each parser ⁜must⁜ have a template which matches ⁜only⁜ X·H·T·M·L
145 # `<script>´ elements that have a `@type´ of a plaintext type supported
146 # by the parser. They may have multiple.
147 PARSERS := $(patsubst ./%,%,$(wildcard $(THISDIR)/parsers/*.xslt))
148
149 # The list of transforms.
150 TRANSFORMS := $(patsubst ./%,%,$(wildcard $(THISDIR)/transforms/*.xslt))
151
152 # List of types which should be treated as X·M·L.
153 XMLTYPES := application/xml text/xml
154
155 # Set to a non·empty value to print all commands as they run.
156 VERBOSE :=
157
158 # The default target for this makefile.
159 #
160 # Print help and exit.
161 .DEFAULT_GOAL := help
162
163 # ━ § BEGIN MAKE·FILE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
164
165 # ─ ¶ Non‐Recipe Variable Definitions ─────────────────────────────────
166
167 # A variable with no value, usable when assigning values which contain
168 # whitespace.
169 override empty :=
170
171 # A variable which contains a newline, to allow the generation of
172 # multiline strings in function calls.
173 override define newline
174
175
176 endef
177
178 # A variable which contains a single space.
179 override space := $(empty) $(empty)
180
181 # A variable which contains a single comma.
182 override comma := ,
183
184 # (callable) Quote the given string for use within shell calls.
185 override quote = '$(subst ','"'"',$1)'
186
187 # Outputs an `@´ to silence rules, unless `VERBOSE´ is nonempty.
188 override silent := $(if $(VERBOSE),,@)
189
190 # (callable) Escape special characters for use in sed regular
191 # expressions.
192 override sedesc = $(subst $$,\$$,$(subst *,\*,$(subst .,\.,$(subst [,\[,$(subst ^,\^,$(subst \,\\,$1))))))
193
194 # Collect all of the applicable includes from the includes directory.
195 sourceincludes := $(shell $(FIND) $(FINDOPTS) $(INCLUDEDIR) -type f '(' $(FINDRULES) ')')
196
197 # Collect all of the applicable source files from the source directory,
198 # removing any which are also includes.
199 sourcefiles := $(filter-out $(sourceincludes),$(shell $(FIND) $(FINDOPTS) $(SRCDIR) -type f '(' $(FINDRULES) ')'))
200
201 # Figure out the file type of each source file and source include.
202 ifneq ($(wildcard $(BUILDDIR)/magic.mgc),)
203 override types := $(shell $(SED) 's/^ *//;s/ *$$//;s/ {2,}/ /g' <<< $(call quote,$(sourcefiles) $(sourceincludes)) | $(TR) ' ' '\n' | $(FILE) -m $(call quote,$(BUILDDIR)/magic.mgc) --mime-type --separator '`' --files-from - | $(SED) 's/` */?type=/g')
204 endif
205
206 # Get the list of supported plaintext file types from the parser.
207 ifneq ($(wildcard $(BUILDDIR)/parser.xslt),)
208 override plaintexttypes := $(shell $(XSLTPROC) $(call quote,$(THISDIR)/lib/parser2types.xslt) $(call quote,$(BUILDDIR)/parser.xslt))
209 endif
210
211 # Simplify the file type by only taking the first component (image,
212 # text, ⁊·c).
213 override simpletypes := $(shell $(TR) ' ' '\n' <<< $(call quote,$(types)) | $(SED) 's`/[^/]*$$``g')
214
215 # (callable) Get all of the files (source and includes) which have the
216 # given types.
217 override filesoftype = $(foreach type,$1,$(patsubst %?type=$(type),%,$(filter %?type=$(type),$(types))))
218
219 # Build up collections of various file types.
220 override plaintextfiles := $(call filesoftype,$(plaintexttypes))
221 override xmlfiles := $(filter-out $(plaintextfiles),$(call filesoftype,$(XMLTYPES)))
222 override assetfiles := $(filter-out $(xmlfiles) $(plaintextfiles),$(sourcefiles) $(sourceincludes))
223
224 # (callable) Get the types of the given files.
225 override typeoffile = $(patsubst $(foreach file,$1,$(file)?type=%),%,$(filter $(foreach file,$1,$(file)?type=%),$(types)))
226
227 # (callable) Get the identifier for the given transform.
228 override id = $(or $(shell $(XMLLINT) --xpath '/*/*[local-name()="id" and namespace-uri()="urn:fdc:ladys.computer:20231231:Shu1She4"]/text()[1]' $1),$(basename $(notdir $1)) | $(SED))
229
230 # (callable) Get base64 data u·r·i’s for the given files.
231 override datauri = $(foreach file,$1,data:$(call typeoffile,$(file));base64,$(shell $(UUENCODE) -m -r $(call quote,$(file)) _ | tr -d ' \n'))
232
233 # (callable) Get local leiris for the given files.
234 override localuri = $(foreach file,$1,$(if $(filter $(file),$(sourceincludes)),$(patsubst $(INCLUDEDIR)/%,about:shushe?include=%,$(file)),$(patsubst $(SRCDIR)/%,about:shushe?source=%,$(file))))
235
236 # (callable) Get the source files for the given local leiris.
237 override sourcefile = $(foreach file,$1,$(if $(filter about:shushe?include=%,$(file)),$(patsubst about:shushe?include=%,$(INCLUDEDIR)/%,$(file)),$(patsubst about:shushe?source=%,$(SRCDIR)/%,$(file))))
238
239 # Adds a requirement on `$(BUILDDIR)/.update-types´ if the file is
240 # present.
241 #
242 # This file is created after a reload due to type changes, and is
243 # removed after. Requiring it ensures that file classifications are
244 # up‐to‐date immediately after the reload.
245 override typeupdates := $(if $(wildcard $(BUILDDIR)/.update-types),$(BUILDDIR)/.update-types,)
246
247 # (callable) Get the location of the transformed X·M·L files for the
248 # given source files.
249 override parsed = $(foreach file,$1,$(if $(filter $(file),$(sourceincludes)),$(patsubst $(INCLUDEDIR)/%,$(BUILDDIR)/includes/%,$(file)),$(patsubst $(SRCDIR)/%,$(BUILDDIR)/sources/%,$(file))))
250
251 ifneq ($(wildcard $(BUILDDIR)/dependencies),)
252 # Pair each file with a list of dependencies for it.
253 override dependenciesforfile := $(foreach file,$(sourcefiles),$(file)`$(subst $(space),`,$(shell $(CAT) $(call quote,$(BUILDDIR)/dependencies) | $(SED) $(call quote,/^$(call sedesc,$(call localuri,$(file)))$$/$(comma)/^[^ ]/!d;/^ /!d;s/^ //))))
254
255 # (callable) Get the list of dependency leiris for the given source
256 # files.
257 #
258 # Recursive dependencies are marked with a leading `!´.
259 override dependencyuris = $(foreach file,$1,$(subst `, ,$(patsubst $(file)`%,%,$(filter $(file)`%,$(dependenciesforfile)))))
260
261 # (callable) Get the list of recursive dependencies for the given
262 # source files.
263 override recursives = $(foreach uri,$(filter !%,$(call dependencyuris,$1)),$(call sourcefile,$(patsubst !%,%,$(uri))))
264
265 # (callable) Get the list of (nonrecursive) dependencies for the given
266 # source files.
267 override dependencies = $(foreach uri,$(filter-out !%,$(call dependencyuris,$1)),$(call sourcefile,$(uri)))
268 endif
269
270 # Collect all files with recursive dependencies.
271 override recursivefiles := $(foreach file,$(filter-out $(assetfiles),$(sourcefiles)),$(if $(call recursives,$(file)),$(file),))
272
273 # Collect all files which should be compiled.
274 #
275 # This is all of the non·asset, nonrecursive files.
276 override compilablefiles := $(filter-out $(assetfiles) $(recursivefiles),$(sourcefiles))
277
278 # (callable) Get the compiled locations for the given source files.
279 override compiled = $(patsubst $(SRCDIR)/%,$(BUILDDIR)/public/%,$(1))
280
281 # (callable) Get the installed locations for the given source files.
282 override installed = $(patsubst $(SRCDIR)/%,$(DESTDIR)/%,$(1))
283
284 # ─ ¶ Recipe Variable Definitions ─────────────────────────────────────
285
286 # (callable) Check to see if the given directory exists and
287 # create it if not.
288 override ensuredirectory = if $(TEST) ! -d $(call quote,$1); then $(MKDIR) -p $(call quote,$1); fi
289
290 # (callable) Sanitize and wrap the provided plaintext file in
291 # X·M·L, printing to `stdout´.
292 override wrapplaintext = $(PRINTF) '%s\n' "$$($(PRINTF) '%b' '<?xml version=\042\061.0\042?>\n<script xmlns=\042http://www.w3.org/1999/xhtml\042 type=\042$(patsubst $1?type=%,%,$(filter $1?type=%,$(types)))\042><![CDATA['; $(CAT) $(call quote,$1) | $(TR) '\000\013\014' '\032\011\012' | $(SED) $$($(PRINTF) '%s%b' 's/]]>/]]]]><!\[CDATA\[>/g;s/\xEF\xBF\xBE/�/g;s/\xEF\xBF\xBF/�/g;$$!s/\r$$//g;s/\r/\n/g;$$!s/\xC2\x85$$//g;s/\xC2\x85/\n/g;s/\xE2\x80\xA8/\n/g;' 's/[\0001-\0010]/�/g;s/[\0016-\0037]/�/g'); $(PRINTF) '%s' ']]></script>')"
293
294 # ─ ¶ Phony Targets ───────────────────────────────────────────────────
295
296 # Provide help.
297 help:
298 $(silent)$(PRINTF) '%b' '$(subst $(newline),\n,$(makefileinfo))'
299
300 # Compile all files, or error if any are recursive.
301 all: $(call compiled,$(recursivefiles) $(compilablefiles) $(assetfiles)) ;
302
303 # Destroy buildfiles.
304 clean:
305 $(silent)$(RM) -rf $(BUILDDIR)/
306
307 # Destroy buildfiles and the install directory.
308 gone:
309 $(silent)$(RM) -rf $(BUILDDIR)/ $(call compiled,$(recursivefiles) $(compilablefiles))
310
311 # Install the compiled files into `DESTDIR´.
312 install: $(call installed,$(recursivefiles) $(compilablefiles) $(assetfiles)) ;
313
314 # List all source files and includes and their computed types.
315 list:
316 $(silent)$(PRINTF) '%b' $(call quote,$(foreach file,$(sort $(sourcefiles)) $(sort $(sourceincludes)),\0033[1m$(file)\0033[22m`$(call typeoffile,$(file))`[\0033[3m$(if $(filter $(file),$(xmlfiles)),xml,$(if $(filter $(file),$(plaintextfiles)),text,asset))$(if $(filter $(file),$(sourceincludes)), include,)\0033[23m]$(if $(call dependencies,$(file))$(call recursives,$(file)), $(strip $(foreach recursive,$(call recursives,$(file)),\0033[93;41m•`Recursive`Dependency:\0033[39;49m`$(recursive)) $(foreach dependency,$(call dependencies,$(file)),\0033[2m•`Dependency:\0033[22m`$(dependency)))) )) | $(TR) ' `' '\n '
317
318 # Raise an error when attempting to build any files with recursive
319 # dependencies.
320 $(call compiled,$(recursivefiles)): $(BUILDDIR)/public/%:
321 @$(PRINTF) '%b\n' $(call quote,\0033[93;41mError:\0033[39;49m `$*´ has recursive dependencies:\n$(subst `, ,$(subst $(space),$(newline),$(foreach recursive,$(call recursives,$(SRCDIR)/$*),•`$(patsubst $(SRCDIR)/%,%,$(recursive)))))) && false
322
323 # ─ ¶ Special Targets ─────────────────────────────────────────────────
324
325 # Perform secondary expansion; this enables pattern rules to determine
326 # their prerequisites based on the matched pattern.
327 .SECONDEXPANSION: ;
328
329 # Don’t use any implicit rules.
330 .SUFFIXES: ;
331
332 # Phony rules; always consider these out‐of‐date.
333 .PHONY: all default clean gone info install list $(call compiled,$(recursivefiles));
334
335 ifeq ($(wildcard $(BUILDDIR)/.update-types),)
336 # Reload this make·file if any of the magic files or parsers have
337 # changed.
338 #
339 # These are used to classify source files, so if they have changed then
340 # the make·file must be reloaded.
341 #
342 # This recipe sleeps for one second to ensure that files built after
343 # the restart have a more current time·stamp.
344 $(THISDIR)/GNUmakefile:: $(BUILDDIR)/magic.mgc $(BUILDDIR)/parser.xslt $(THISDIR)/lib/parser2types.xslt
345 $(silent)$(TOUCH) $(THISDIR)/GNUmakefile
346 $(silent)$(TOUCH) $(call quote,$(BUILDDIR)/.update-types)
347 $(silent)$(RM) -f $(call quote,$(BUILDDIR)/dependencies)
348 @$(PRINTF) '%b\n' '\0033[1mMagic file or parsers have updated. Restarting…\0033[22m'
349 $(silent)$(SLEEP) 1
350 endif
351
352 ifneq ($(wildcard $(BUILDDIR)/.update-types)$(wildcard $(BUILDDIR)/dependencies),)
353 # Reload this make·file if the dependency graph has changed.
354 #
355 # This graph is a dependency for some of the variables that this
356 # make·file uses, so it’s important to ensure that they are actually
357 # up‐to‐date prior to executing any later rules.
358 #
359 # This recipe only exists after types have been updated or when the
360 # dependency graph already exists.
361 $(THISDIR)/GNUmakefile:: $(BUILDDIR)/dependencies
362 $(silent)$(TOUCH) $(THISDIR)/GNUmakefile
363 $(silent)$(RM) -f $(BUILDDIR)/.update-types
364 @$(PRINTF) '%b\n' '\0033[1mDependency graph updated. Restarting…\0033[22m'
365 endif
366
367 # ─ ¶ Build Targets ───────────────────────────────────────────────────
368
369 # Generate the compiled magic file from its sources.
370 #
371 # It must be updated if any of the files in the magic directory change.
372 # It ⁜also⁜ should be updated if any of the files in the magic
373 # directory are deleted, but this isn’t tracked presently.
374 $(BUILDDIR)/magic.mgc: $(wildcard $(MAGICDIR)/*)
375 @$(ECHO) "Compiling new magic…"
376 $(silent)$(call ensuredirectory,$(dir $@))
377 $(silent)$(FILE) -C -m $(call quote,$(MAGICDIR))
378 $(silent)$(MV) $(call quote,$(MAGICDIR).mgc) $(call quote,$(BUILDDIR)/magic.mgc)
379
380 # Generate the main parser.
381 $(BUILDDIR)/parser.catalog: $(PARSERS)
382 @$(ECHO) "Generating catalog of parsers…"
383 $(silent)$(XMLCATALOG) --create --noout $(call quote,$@)
384 $(foreach parser,$(PARSERS),$(silent)$(XMLCATALOG) --add uri $(call quote,$(call id,$(parser))) $(call quote,../$(parser)) --noout $(call quote,$@)$(newline))
385 $(BUILDDIR)/parser.xslt: $(BUILDDIR)/parser.catalog $(THISDIR)/lib/catalog2parser.xslt
386 @$(ECHO) "Generating main parser…"
387 $(silent)$(XSLTPROC) -o $(call quote,$@) $(call quote,$(THISDIR)/lib/catalog2parser.xslt) $(call quote,$<)
388
389 # Note updates to parsers or magic.
390 #
391 # This file is actually generated as part of the make·file restart
392 # process, so it doesn’t need any recipes.
393 $(BUILDDIR)/.update-types: $(BUILDDIR)/magic.mgc $(BUILDDIR)/parser.xslt $(THISDIR)/lib/parser2types.xslt ;
394
395 # Parse the files.
396 #
397 # Even plain X·M·L files are parsed, because they may contain X·H·T·M·L
398 # `<script>´ elements which contain other kinds of data. Asset files
399 # are turned into H·T·M·L embeds pointing to `data:´ U·R·I’s.
400 $(call parsed,$(sourceincludes)): $(BUILDDIR)/includes/%: $(INCLUDEDIR)/% $(typeupdates)
401 @$(PRINTF) '%s\n' $(call quote,Processing `$<´…)
402 $(silent)$(call ensuredirectory,$(dir $@))
403 $(silent)$(if $(filter $<,$(assetfiles)),$(PRINTF) '%s\n' $(call quote,<object xmlns="http://www.w3.org/1999/xhtml" type="$(call typeoffile,$(INCLUDEDIR)/$*)" data="$(call datauri,$<)"/>) > $(call quote,$@),$(if $(filter $<,$(plaintextfiles)),$(call wrapplaintext,$<),$(CAT) $(call quote,$<)) | $(XSLTPROC) -o $(call quote,$@) $(call quote,$(BUILDDIR)/parser.xslt) -)
404 $(call parsed,$(sourcefiles)): $(BUILDDIR)/sources/%: $(SRCDIR)/% $(typeupdates)
405 @$(PRINTF) '%s\n' $(call quote,Processing `$<´…)
406 $(silent)$(call ensuredirectory,$(dir $@))
407 $(silent)$(if $(filter $<,$(assetfiles)),$(PRINTF) '%s\n' $(call quote,<object xmlns="http://www.w3.org/1999/xhtml" type="$(call typeoffile,$(SRCDIR)/$*)" data="$(call datauri,$<)"/>) > $(call quote,$@),$(if $(filter $<,$(plaintextfiles)),$(call wrapplaintext,$<),$(CAT) $(call quote,$<)) | $(XSLTPROC) -o $(call quote,$@) $(call quote,$(BUILDDIR)/parser.xslt) -)
408
409 # Generate a catalog of all transformed files, for use when processing
410 # includes. This does not depend on actually transforming the files.
411 $(BUILDDIR)/catalog: $(sourcefiles) $(sourceincludes) $(typeupdates)
412 @$(ECHO) "Generating catalog of parsed files…"
413 $(silent)$(XMLCATALOG) --create --noout $(call quote,$@)
414 $(foreach source,$(sourcefiles) $(sourceincludes),$(silent)$(XMLCATALOG) --add uri $(call quote,$(call localuri,$(source))) $(call quote,$(patsubst $(BUILDDIR)/%,%,$(call parsed,$(source)))#$(if $(filter $(source),$(assetfiles)),asset,xml)) --noout $(call quote,$@)$(newline))
415
416 # Build a list of dependencies for each transformed file.
417 $(BUILDDIR)/dependencies: $(BUILDDIR)/catalog $(call parsed,$(plaintextfiles) $(xmlfiles)) $(THISDIR)/lib/catalog2dependencies.xslt
418 @$(ECHO) "Identifying dependencies…"
419 $(silent)$(XSLTPROC) -o $(call quote,$@) $(call quote,$(THISDIR)/lib/catalog2dependencies.xslt) $(call quote,$<)
420
421 # Generate the main transform.
422 $(BUILDDIR)/transform.catalog: $(TRANSFORMS)
423 @$(ECHO) "Generating catalog of transforms…"
424 $(silent)$(XMLCATALOG) --create --noout $(call quote,$@)
425 $(foreach transform,$(TRANSFORMS),$(silent)$(XMLCATALOG) --add uri $(call quote,$(call id,$(transform))) $(call quote,../$(transform)) --noout $(call quote,$@)$(newline))
426 $(BUILDDIR)/transform.xslt: $(BUILDDIR)/transform.catalog $(THISDIR)/lib/catalog2transform.xslt
427 @$(ECHO) "Generating main transform…"
428 $(silent)$(XSLTPROC) -o $(call quote,$@) $(call quote,$(THISDIR)/lib/catalog2transform.xslt) $(call quote,$<)
429
430 # Generate the output files using the dependencies as necessary.
431 $(call compiled,$(compilablefiles)): $(BUILDDIR)/public/%: $$(call parsed,$(SRCDIR)/%) $(BUILDDIR)/transform.xslt $$(call parsed,$$(call dependencies,$(SRCDIR)/%))
432 $(silent)$(call ensuredirectory,$(dir $@))
433 @$(PRINTF) '%s\n' $(call quote,Compiling `$*´…)
434 $(silent)$(XSLTPROC) -o $(call quote,$@) --stringparam catalog 'catalog' $(call quote,$(BUILDDIR)/transform.xslt) $(call quote,$<)
435 $(call compiled,$(filter $(assetfiles),$(sourcefiles))): $(BUILDDIR)/public/%: $(SRCDIR)/%
436 @$(PRINTF) '%s\n' $(call quote,Compiling `$*´…)
437 $(silent)$(call ensuredirectory,$(dir $@))
438 $(silent)$(CP) $(call quote,$<) $(call quote,$@)
439
440 # Install compiled files (or error in the case of recursive ones).
441 $(call installed,$(filter $(assetfiles),$(sourcefiles)) $(recursivefiles) $(compilablefiles)): $(DESTDIR)/%: $(BUILDDIR)/public/%
442 @$(PRINTF) '%s\n' $(call quote,Installing `$*´…)
443 $(silent)$(call ensuredirectory,$(dir $@))
444 $(silent)$(CP) $(call quote,$<) $(call quote,$@)
This page took 0.068842 seconds and 5 git commands to generate.