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