]> Lady’s Gitweb - Caudex/blobdiff - GNUmakefile
Always build catalogs when non·extant
[Caudex] / GNUmakefile
index 5602ca0c82c778bcb74b2efafd4d336b49eca389..8fa6dfc5f79c7cc2ab828a0b0de8bc5a2c55a491 100644 (file)
@@ -179,9 +179,11 @@ override shusheopts := SRCDIR=$(call quote,$(if $(wildcard $(ASSETDIR)),$(ASSETD
 # (callable) Check to see if the given directory exists and create it if not.
 override ensuredirectory = if $(TEST) ! -d $(call quote,$1); then $(MKDIR) -p $(call quote,$1); fi
 
-# (callable) Test to see if the dependencies provided by the second argument matches the value in the file corresponding to the first argument in `$(BUILDDIR)/lastprereqs´.
-# If not, return the third argument, plus an additional rule to save the new prerequisites.
-override makeandsavedeps = $(if $(subst $(shell $(CAT) $(call quote,$(BUILDDIR)/lastdeps/$1) 2> /dev/null || true),,$2),$3$(newline)$(silent)$(call ensuredirectory,$(BUILDDIR)/lastdeps)$(newline)$(silent)$(PRINTF) '%s\n' $(call quote,$2) > $(BUILDDIR)/lastdeps/$1,)
+# (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´.
+# If not, return the fourth argument, plus an additional rule to save the new prerequisites.
+#
+# ※ If the third argument is empty, the fourth argument is always returned.
+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),)
 
 # (callable) Make the catalog for the provided category.
 override define makecategorycatalog
@@ -268,9 +270,9 @@ FORCE : ;
 # ─ ¶ Build Targets ───────────────────────────────────────────────────
 
 # Initialize the ⛩️📰 书社 repository if it is empty.
-$(SHUSHE)/GNUmakefile : %/GNUmakefile :
+$(SHUSHE)/GNUmakefile : $(THISDIR)/%/GNUmakefile :
        @$(PRINTF) '%s\n' $(call quote,Initializing git submodule at `$*´)
-       $(silent)$(GIT) submodule update --init $(call quote,$*)
+       $(silent)cd $(THISDIR) && $(GIT) submodule update --init $(call quote,$*)
 
 # Touch parsers and transforms if the files in `lib/´ have changed.
 $(PARSERS) $(TRANSFORMS) : $(wildcard lib/*.xslt)
@@ -282,7 +284,7 @@ $(SRCDIR)/@ :
 
 # Create category catalogs.
 $(categorycatalogs) : $(BUILDDIR)/catalogs/categories/%/index : FORCE
-       $(call makeandsavedeps,$*,$(call entriesforcategory,$*),$(call makecategorycatalog,$*))
+       $(call makeandsavedeps,$@,$*,$(call entriesforcategory,$*),$(call makecategorycatalog,$*))
 
 # Create entry catalogs.
 $(entrycatalogs) : $(BUILDDIR)/catalogs/entries/% :
@@ -294,7 +296,7 @@ $(entrycatalogs) : $(BUILDDIR)/catalogs/entries/% :
        $(silent)$(XMLCATALOG) --add uri '@' $(call quote,$*) --noout $(call quote,$@)
 
 $(BUILDDIR)/catalogs/indices/index : FORCE | $(SRCDIR)/@
-       $(call makeandsavedeps,index,$(categories),$(call makeindexcatalog,))
+       $(call makeandsavedeps,$@,index,$(categories),$(call makeindexcatalog,))
 
 $(BUILDDIR)/catalogs/indices/fullindex : FORCE | $(SRCDIR)/@
-       $(call makeandsavedeps,fullindex,$(categories),$(call makeindexcatalog,1))
+       $(call makeandsavedeps,$@,fullindex,$(categories),$(call makeindexcatalog,1))
This page took 0.023996 seconds and 4 git commands to generate.