]> Ladyโ€™s Gitweb - Caudex/blob - GNUmakefile
Update โ›ฉ๐Ÿ“ฐ ไนฆ็คพ; use ๐Ÿ’„๐Ÿ“ LesยทMยทL as markup format
[Caudex] / GNUmakefile
1 SHELL = /bin/sh
2
3 # โ” ยง BASIC INFORMATION โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
4 override define makefileinfo
5 โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
6 โ•”โ•ก โŒ ๐Ÿชพ๐Ÿ“ฐ Caudex โˆท GNUmakefile โ•žโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
7 โ•‘โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ โ•‘
8 โ•Ÿโ”ฌ ยถ Prerequisites โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ•ข
9 โ•‘โ”‚ โ”‚โ•‘
10 โ•‘โ”‚ Requires GยทNยทU Make, at least version 3.81, and all of the โ”‚โ•‘
11 โ•‘โ”‚ requirements of โ›ฉ๐Ÿ“ฐ ไนฆ็คพ, which is included as a git โ”‚โ•‘
12 โ•‘โ”‚ submodule. Run `make help-shusheยด for more information. โ”‚โ•‘
13 โ•‘โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏโ•‘
14 โ•Ÿโ”ฌ ยถ Usage โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ•ข
15 โ•‘โ”‚ โ”‚โ•‘
16 โ•‘โ”‚ โ€ข `make allยด (default): Compile, but do not install, all โ”‚โ•‘
17 โ•‘โ”‚ files. โ”‚โ•‘
18 โ•‘โ”‚ โ”‚โ•‘
19 โ•‘โ”‚ โ€ข `make cleanยด: Remove `BUILDDIRยด. โ”‚โ•‘
20 โ•‘โ”‚ โ”‚โ•‘
21 โ•‘โ”‚ โ€ข `make cleanยด: Remove `BUILDDIRยด. โ”‚โ•‘
22 โ•‘โ”‚ โ”‚โ•‘
23 โ•‘โ”‚ โ€ข `make goneยด: Remove `BUILDDIRยด and installed files. โ”‚โ•‘
24 โ•‘โ”‚ โ”‚โ•‘
25 โ•‘โ”‚ โ€ข `make helpยด: Print this message. โ”‚โ•‘
26 โ•‘โ”‚ โ”‚โ•‘
27 โ•‘โ”‚ โ€ข `make installยด: Compile all files and install in โ”‚โ•‘
28 โ•‘โ”‚ `DESTDIRยด. โ”‚โ•‘
29 โ•‘โ”‚ โ”‚โ•‘
30 โ•‘โ”‚ โ€ข `make listยด: List all recognized source files and their โ”‚โ•‘
31 โ•‘โ”‚ classification (including media type and dependencies). โ”‚โ•‘
32 โ•‘โ”‚ โ”‚โ•‘
33 โ•‘โ”‚ โ€ข `make uninstallยด: Remove installed files, but not โ”‚โ•‘
34 โ•‘โ”‚ `BUILDDIRยด. โ”‚โ•‘
35 โ•‘โ”‚ โ”‚โ•‘
36 โ•‘โ”‚ โ€ข `make +โŸจCATEGORYโŸฉยด: Create a new entry in โŸจCATEGORYโŸฉ and โ”‚โ•‘
37 โ•‘โ”‚ output its path. โ”‚โ•‘
38 โ•‘โ”‚ โ”‚โ•‘
39 โ•‘โ”‚ Set `VERBOSE=1ยด to see the text of commands as they are โ”‚โ•‘
40 โ•‘โ”‚ executed. โ”‚โ•‘
41 โ•‘โ”‚ โ”‚โ•‘
42 โ•‘โ”‚ See `README.markdownยด for a more involved description of โ”‚โ•‘
43 โ•‘โ”‚ the capabilities and configuration of this program. โ”‚โ•‘
44 โ•‘โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏโ•‘
45 โ•Ÿโ”ฌ ยถ Copyright & License โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ•ข
46 โ•‘โ”‚ โ”‚โ•‘
47 โ•‘โ”‚ Copyright ยฉ 2024 Lady [@ Ladys Computer]. โ”‚โ•‘
48 โ•‘โ”‚ โ”‚โ•‘
49 โ•‘โ”‚ This Source Code Form is subject to the terms of the โ”‚โ•‘
50 โ•‘โ”‚ Mozilla Public License, v 2.0. If a copy of the MยทPยทL was โ”‚โ•‘
51 โ•‘โ”‚ not distributed with this file, You can obtain one at โ”‚โ•‘
52 โ•‘โ”‚ <http://mozilla.org/MPL/2.0/>. โ”‚โ•‘
53 โ•‘โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏโ•‘
54 โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
55 endef
56
57 # โ” ยง MAKEยทFILE SETUP โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
58
59 # Programs needed to run this makeยทfile.
60 #
61 # If these are not installed on your computer, or you need to use a different implementation, you can override the appropriate variable.
62 #
63 # See also the documentation for โ›ฉ๐Ÿ“ฐ ไนฆ็คพ, which specifies additional programs.
64 AWK := awk
65 CAT := cat
66 GIT := git
67 MKDIR := mkdir
68 OD := od
69 PRINTF := printf
70 RM := rm
71 SED := sed
72 TEST := test
73 TR := tr
74 XARGS := xargs
75 XMLCATALOG := xmlcatalog
76
77 # The directory which contains the codex entries and related metadata.
78 SRCDIR := entries
79
80 # The directory which contains additional assets for the codex generator.
81 ASSETDIR := assets
82
83 # The directory which contains includes for additional assets for the codex generator.
84 ASSETINCLUDEDIR := $(ASSETDIR)/includes
85
86 # The directory in which to generate temporary buildfiles.
87 BUILDDIR := build
88
89 # The directory into which to output files on `makeยด.
90 DESTDIR := public
91
92 # The location of this Makefile, relative to the current working directory.
93 #
94 # It is expected that other files packaged as a part of ๐Ÿชพ๐Ÿ“ฐ Caudex can also be found in this directory.
95 #
96 # By default, this is inferred from the variable `MAKEFILE_LISTยด.
97 THISDIR := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
98
99 # Extra magic files to forward to โ›ฉ๐Ÿ“ฐ ไนฆ็คพ.
100 #
101 # Your computer probably has several already installed at `/usr/share/file/magicยด.
102 EXTRAMAGIC :=
103
104 # Extra parsers to forward to โ›ฉ๐Ÿ“ฐ ไนฆ็คพ.
105 #
106 # Which parsers are provided will influence which kinds of files are recognized as plaintext.
107 EXTRAPARSERS :=
108
109 # Extra transforms to forward to โ›ฉ๐Ÿ“ฐ ไนฆ็คพ.
110 EXTRATRANSFORMS :=
111
112 # A description of the current git revision of ๐Ÿชพ๐Ÿ“ฐ Caudex.
113 THISREV := $(shell cd $(THISDIR); $(GIT) describe 2> /dev/null || $(GIT) rev-parse HEAD 2> /dev/null || true)
114
115 # Variables to communicate to further calls to Make.
116 #
117 # By default, `MAKEOVERRIDESยด contains all variable overrides specified on the commandline.
118 # However, some values are specific to ๐Ÿชพ๐Ÿ“ฐ Caudex and may have different meaning in other makeยทfiles; filter these out.
119 MAKEOVERRIDES := $(filter-out SRCDIR=% ASSETDIR=% BUILDDIR=% DESTDIR=% THISDIR=% EXTRAMAGIC=% EXTRAPARSERS=% EXTRATRANSFORMS=% THISREV=%,$(MAKEOVERRIDES))
120
121 # The location of ๐Ÿ’„๐Ÿ“ LesยทMยทL.
122 LESML := $(THISDIR)/.๐Ÿ’„๐Ÿ“
123
124 # The location of โ›ฉ๐Ÿ“ฐ ไนฆ็คพ.
125 SHUSHE := $(THISDIR)/.โ›ฉ๐Ÿ“ฐ
126
127 # Set to a nonยทempty value to print all commands as they run.
128 VERBOSE :=
129
130 # The default target for this makefile.
131 .DEFAULT_GOAL := all
132
133 # โ” ยง BEGIN MAKEยทFILE โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
134
135 # โ”€ ยถ Nonโ€Recipe Variable Definitions โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
136
137 # A variable which contains a newline, to allow the generation of multiline strings in function calls.
138 override define newline
139
140
141 endef
142
143 # (callable) Quote the given string for use within shell calls.
144 override quote = '$(subst ','"'"',$1)'
145
146 # Outputs an `@ยด to silence rules, unless `VERBOSEยด is nonempty.
147 override silent := $(if $(VERBOSE),,@)
148
149 # The list of categories, determined by the set of directories in `SRCDIRยด with corresponding metadata files.
150 override categories := $(sort $(patsubst $(SRCDIR)/%/@,%,$(wildcard $(SRCDIR)/*/@)))
151
152 # (callable) The set of file locations for the entries of the provided categories.
153 override entriesforcategory = $(sort $(foreach category,$1,$(wildcard $(SRCDIR)/$(category)/???-????) $(wildcard $(SRCDIR)/$(category)/???-????,*)))
154
155 # A random WยทRยทMยทG(ยทlike) baseโน€32 identifier.
156 #
157 # This variable returns a different value each time it is referenced.
158 # Use `foreachยด to save the value for repeated usage.
159 #
160 # This variable recursively calls itself to ensure there is no existing entry with the resulting identifier.
161 override wrmg = $(foreach attempt,$(shell $(OD) -t u4 -N 4 /dev/random | $(SED) 's/^[0-9]* *//' | $(TR) -d ' \n' | $(AWK) 'BEGIN{chars="0123456789ABCDEFGHJKMNPQRSTVWXYZ&~@=U"}{d=32^5;r=$$0%(32^6);printf("%s",substr(chars,r%37,1));while(d>0){printf("%s", substr(chars,int(r/d),1));if(d==32^4)printf("%s", "-");r%=d;d=int(d/32)}}'),$(if $(wildcard $(SRCDIR)/*/($(attempt))*),$(call wrmg),$(attempt)))
162
163 # (callable) Returns the identifiers of the provided entries.
164 override identifier = $(shell $(PRINTF) '%s\n' $(call quote,$1) | $(TR) ' ' '\n' | $(SED) 's/^\(.*[/]\)\{0,1\}\(.\{3\}-.\{4\}\)\(,[^/]*\)\{0,1\}$$/\2/')
165
166 # Output locations for compiled catalog files for categories.
167 override categorycatalogs := $(patsubst %,$(BUILDDIR)/catalogs/categories/%/index,$(categories))
168
169 # Output locations for compiled catalog files for entries.
170 override entrycatalogs := $(foreach entry,$(call entriesforcategory,$(categories)),$(patsubst $(SRCDIR)/%,$(BUILDDIR)/catalogs/entries/%,$(entry)))
171
172 # Output locations for all compiled catalog files.
173 override allcatalogs := $(BUILDDIR)/catalogs/indices/index $(BUILDDIR)/catalogs/indices/fullindex $(categorycatalogs) $(entrycatalogs)
174
175 # (overridable) Options to pass to โ›ฉ๐Ÿ“ฐ ไนฆ็คพ.
176 override shusheopts := SRCDIR=$(call quote,$(if $(wildcard $(ASSETDIR)),$(ASSETDIR),) $(if $(entrycatalogs),$(BUILDDIR)/catalogs/entries,) $(BUILDDIR)/catalogs/indices) BUILDDIR=$(call quote,$(BUILDDIR)/โ›ฉ๐Ÿ“ฐ) INCLUDEDIR=$(call quote,$(SRCDIR) $(if $(wildcard $(ASSETINCLUDEDIR)),$(ASSETINCLUDEDIR),) $(if $(categorycatalogs),$(BUILDDIR)/catalogs/categories,)) DESTDIR=$(call quote,$(DESTDIR)) EXTRAMAGIC=$(call quote,$(sort $(patsubst ./%,%,$(wildcard $(THISDIR)/magic/*)) $(LESML)/magic $(EXTRAMAGIC))) EXTRAPARSERS=$(call quote,$(sort $(patsubst ./%,%,$(wildcard $(THISDIR)/parsers/*.xslt)) $(LESML)/parser.xslt $(EXTRAPARSERS))) EXTRATRANSFORMS=$(call quote,$(sort $(patsubst ./%,%,$(wildcard $(THISDIR)/transforms/*.xslt)) $(EXTRATRANSFORMS)))
177
178 # โ”€ ยถ Recipe Variable Definitions โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
179
180 # (callable) Check to see if the given directory exists and create it if not.
181 override ensuredirectory = if $(TEST) ! -d $(call quote,$1); then $(MKDIR) -p $(call quote,$1); fi
182
183 # (callable) Test to see if the file provided by the first argument exists and the dependencies provided by the third argument matches the value in the file corresponding to the second argument in `$(BUILDDIR)/lastprereqsยด.
184 # If not, return the fourth argument, plus an additional rule to save the new prerequisites.
185 #
186 # โ€ป If the third argument is empty, the fourth argument is always returned.
187 override makeandsavedeps = $(if $(or $(if $3,,1),$(if $(wildcard $1),,1),$(subst $(shell $(CAT) $(call quote,$(BUILDDIR)/lastdeps/$2) 2> /dev/null || true),,$3)),$4$(newline)$(silent)$(call ensuredirectory,$(BUILDDIR)/lastdeps)$(newline)$(silent)$(PRINTF) '%s\n' $(call quote,$3) > $(call quote,$(BUILDDIR)/lastdeps/$2),)
188
189 # (callable) Make the catalog for the provided category.
190 override define makecategorycatalog
191 @$(PRINTF) '%s\n' $(call quote,Generating catalog for category `$1ยดโ€ฆ)
192 $(silent)$(call ensuredirectory,$(BUILDDIR)/catalogs/categories/$1)
193 $(silent)$(XMLCATALOG) --create --noout $(call quote,$(BUILDDIR)/catalogs/categories/$1/index)
194 $(silent)$(XMLCATALOG) --add uri '?' 'about:category' --noout $(call quote,$(BUILDDIR)/catalogs/categories/$1/index)
195 $(silent)$(XMLCATALOG) --add uri '@' $(call quote,$1/@) --noout $(call quote,$(BUILDDIR)/catalogs/categories/$1/index)
196 $(foreach entry,$(call entriesforcategory,$1),$(silent)$(XMLCATALOG) --add uri $(call quote,$(call identifier,$(entry))) $(call quote,$(patsubst $(SRCDIR)/%,%,$(entry))) --noout $(call quote,$(BUILDDIR)/catalogs/categories/$1/index)$(newline))
197 endef
198
199 # (callable) Make the catalog for the dynamic or static index.
200 override define makeindexcatalog
201 @$(PRINTF) '%s\n' 'Generating $(if $1,static,dynamic) catalog indexโ€ฆ'
202 $(silent)$(call ensuredirectory,$(BUILDDIR)/catalogs/indices)
203 $(silent)$(XMLCATALOG) --create --noout $(call quote,$(BUILDDIR)/catalogs/indices/$(if $1,full,)index)
204 $(silent)$(XMLCATALOG) --add uri '.' '$(if $1,standalone,index).xhtml' --noout $(call quote,$(BUILDDIR)/catalogs/indices/$(if $1,full,)index)
205 $(silent)$(XMLCATALOG) --add uri '?' 'about:$(if $1,full,)index' --noout $(call quote,$(BUILDDIR)/catalogs/indices/$(if $1,full,)index)
206 $(silent)$(XMLCATALOG) --add uri '@' '@' --noout $(call quote,$(BUILDDIR)/catalogs/indices/$(if $1,full,)index)
207 $(foreach category,$(categories),$(silent)$(XMLCATALOG) --add uri $(call quote,$(category)) $(call quote,$(category)/index) --noout $(call quote,$(BUILDDIR)/catalogs/indices/$(if $1,full,)index)$(newline))
208 endef
209
210 # โ”€ ยถ โ›ฉ๐Ÿ“ฐ ไนฆ็คพ Targets โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
211
212 # Targets to forward to โ›ฉ๐Ÿ“ฐ ไนฆ็คพ.
213 all install list uninstall : $(SHUSHE)/GNUmakefile catalogs
214 $(silent)$(MAKE) -f $(call quote,$<) $(call quote,$@) $(shusheopts)
215 %-shushe : $(SHUSHE)/GNUmakefile FORCE
216 $(silent)$(MAKE) -f $(call quote,$<) $(call quote,$*) $(shusheopts)
217 build/โ›ฉ๐Ÿ“ฐ/% : $(SHUSHE)/GNUmakefile catalogs FORCE
218 $(SILENT)$(MAKE) -f $(call quote,$<) $(call quote,$@) $(shusheopts)
219 public/% : $(SHUSHE)/GNUmakefile catalogs FORCE
220 $(SILENT)$(MAKE) -f $(call quote,$<) $(call quote,$@) $(shusheopts)
221
222 # โ”€ ยถ Phony Targets โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
223
224 # Generate all catalogs, then remove any which no longer have corresponding source files.
225 catalogs : $(allcatalogs)
226 @$(PRINTF) '%s\n' 'Removing any outdated catalogsโ€ฆ'
227 $(foreach deletedcategory,$(filter-out $(categorycatalogs),$(wildcard $(BUILDDIR)/catalogs/categories/*/index)),@$(PRINTF) '%s\n' $(call quote,Removing `$(patsubst $(BUILDDIR)/catalogs/categories/%/index,%,$(deletedcategory))ยดโ€ฆ)$(newline)$(silent)$(RM) -rf $(call quote,./$(dir $(deletedcategory)))$(newline)$(silent)$(RM) -rf $(call quote,./$(patsubst $(BUILDDIR)/catalogs/categories/%,$(BUILDDIR)/catalogs/entries/%,$(dir $(deletedcategory))))$(newline))
228 $(foreach deletedentry,$(filter-out $(entrycatalogs),$(wildcard $(BUILDDIR)/catalogs/entries/*/*)),@$(PRINTF) '%s\n' $(call quote,Removing `$(patsubst $(BUILDDIR)/catalogs/entries/%,%,$(deletedentry))ยดโ€ฆ)$(newline)$(silent)$(RM) $(call quote,./$(deletedentry))$(newline))
229
230 # Destroy buildfiles.
231 clean:
232 $(if $(BUILDDIR),$(silent)$(RM) -rf $(call quote,$(BUILDDIR)/),)
233
234 # Provide help.
235 help :
236 @$(PRINTF) '%b' '$(subst $(newline),\n,$(makefileinfo))'
237
238 # Destroy build directory and installed files.
239 gone : clean uninstall ;
240
241 # List the iยทdโ€™s of all recognized entries.
242 listids :
243 @$(TR) '| ' ' \n' <<< '$(strip $(foreach category,$(categories),\0033[1m$(category)\0033[22m: $(patsubst %,โ€ข|%,$(call identifier,$(call entriesforcategory,$(category)))) ))' | $(XARGS) -0 $(PRINTF) '%b'
244
245 # Output a random unused identifier.
246 wrmg :
247 @$(PRINTF) '%s\n' $(wrmg)
248
249 # Create a new entry in the provided category and output its path.
250 +% : FORCE
251 $(silent)$(call ensuredirectory,$(SRCDIR)/$*)
252 $(if $(wildcard $(SRCDIR)/$*/@),,$(silent)$(PRINTF) '%b' '%%\nCATEGORY : $*\n%%\n' > '$(SRCDIR)/$*/@')
253 $(foreach identifier,$(wrmg),@$(PRINTF) '%b' '\0043!lesml\nENTRY : $(identifier)\n%%\n\n' > '$(SRCDIR)/$*/$(identifier)'$(newline)@$(PRINTF) '%s\n' '$(SRCDIR)/$*/$(identifier)')
254
255 # โ”€ ยถ Special Targets โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
256
257 # Perform secondary expansion; this enables pattern rules to determine their prerequisites based on the matched pattern.
258 .SECONDEXPANSION : ;
259
260 # Donโ€™t use any implicit rules.
261 .SUFFIXES : ;
262
263 # Treat targets with this as a prerequisite as though they were phony.
264 #
265 # Mainly useful in pattern rules.
266 FORCE : ;
267
268 # Phony rules; always consider these outยทofยทdate.
269 .PHONY : FORCE all build catalogs clean gone help install list listids uninstall wrmg ;
270
271 # โ”€ ยถ Build Targets โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
272
273 # Initialize the โ›ฉ๐Ÿ“ฐ ไนฆ็คพ repository if it is empty.
274 ifneq ($(filter $(THISDIR)/%,$(SHUSHE)),)
275 $(SHUSHE)/GNUmakefile : $(THISDIR)/%/GNUmakefile :
276 @$(PRINTF) '%s\n' $(call quote,Initializing git submodule at `$*ยด)
277 $(silent)cd $(THISDIR) && $(GIT) submodule update --init $(call quote,$*)
278 endif
279
280 # Initialize the ๐Ÿ’„๐Ÿ“ LesยทMยทL repository if it is empty.
281 ifneq ($(filter $(THISDIR)/%,$(LESML)),)
282 $(LESML)/parser.xslt : $(THISDIR)/%/parser.xslt :
283 @$(PRINTF) '%s\n' $(call quote,Initializing git submodule at `$*ยด)
284 $(silent)cd $(THISDIR) && $(GIT) submodule update --init $(call quote,$*)
285 endif
286
287 # Create an empty codex metadata file if none exists.
288 $(SRCDIR)/@ :
289 $(silent)$(PRINTF) '%b' '%%\nCODEX :\n%%\n' > $(call quote,$@)
290
291 # Create category catalogs.
292 $(categorycatalogs) : $(BUILDDIR)/catalogs/categories/%/index : FORCE
293 $(call makeandsavedeps,$@,$*,$(call entriesforcategory,$*),$(call makecategorycatalog,$*))
294
295 # Create entry catalogs.
296 $(entrycatalogs) : $(BUILDDIR)/catalogs/entries/% :
297 @$(PRINTF) '%s\n' $(call quote,Generating catalog for document `$(call identifier,$*)ยดโ€ฆ)
298 $(silent)$(call ensuredirectory,$(dir $@))
299 $(silent)$(XMLCATALOG) --create --noout $(call quote,$@)
300 $(silent)$(XMLCATALOG) --add uri '.' '$(call identifier,$*).xhtml' --noout $(call quote,$@)
301 $(silent)$(XMLCATALOG) --add uri '?' 'about:entry' --noout $(call quote,$@)
302 $(silent)$(XMLCATALOG) --add uri '@' $(call quote,$*) --noout $(call quote,$@)
303
304 $(BUILDDIR)/catalogs/indices/index : FORCE | $(SRCDIR)/@
305 $(call makeandsavedeps,$@,index,$(categories),$(call makeindexcatalog,))
306
307 $(BUILDDIR)/catalogs/indices/fullindex : FORCE | $(SRCDIR)/@
308 $(call makeandsavedeps,$@,fullindex,$(categories),$(call makeindexcatalog,1))
This page took 0.065017 seconds and 5 git commands to generate.