]> Lady’s Gitweb - Shushe/commitdiff
Allow overriding of cd
authorLady <redacted>
Fri, 24 May 2024 02:39:49 +0000 (22:39 -0400)
committerLady <redacted>
Fri, 24 May 2024 04:01:29 +0000 (00:01 -0400)
Altho `cd` is builtin in most shells, it is not a special builtin
utility as defined by Posix, and the use of an alternative
implementation is conceivable.

GNUmakefile
README.markdown

index d16d76e88da999db79d3172385de93236b31fdfe..00b04f2df874acc4a2b517076d9479c973c27687 100644 (file)
@@ -19,6 +19,7 @@ override define makefileinfo
 ║│                                                            │║
 ║│ • awk                                                      │║
 ║│ • cat                                                      │║
 ║│                                                            │║
 ║│ • awk                                                      │║
 ║│ • cat                                                      │║
+║│ • cd                                                       │║
 ║│ • cksum                                                    │║
 ║│ • cp                                                       │║
 ║│ • date                                                     │║
 ║│ • cksum                                                    │║
 ║│ • cp                                                       │║
 ║│ • date                                                     │║
@@ -99,6 +100,7 @@ endef
 # If these are not installed on your computer, or you need to use a different implementation, you can override the appropriate variable.
 AWK := awk
 CAT := cat
 # If these are not installed on your computer, or you need to use a different implementation, you can override the appropriate variable.
 AWK := awk
 CAT := cat
+CD := cd
 CKSUM := cksum
 CP := cp
 DATE := date
 CKSUM := cksum
 CP := cp
 DATE := date
@@ -201,7 +203,7 @@ XMLTYPES := application/xml text/xml +xml
 ifdef GIT
 ifneq ($(wildcard $(THISDIR)/.git),)
 # A description of the current git revision of ⛩️📰 书社.
 ifdef GIT
 ifneq ($(wildcard $(THISDIR)/.git),)
 # A description of the current git revision of ⛩️📰 书社.
-THISREV := $(shell cd $(THISDIR); $(GIT) describe 2> /dev/null || $(GIT) rev-parse HEAD 2> /dev/null || true)
+THISREV := $(shell $(CD) $(THISDIR); $(GIT) describe 2> /dev/null || $(GIT) rev-parse HEAD 2> /dev/null || true)
 endif
 
 ifneq ($(wildcard .git),)
 endif
 
 ifneq ($(wildcard .git),)
@@ -579,7 +581,7 @@ $(BUILDDIR)/magic.mgc : $(call diffprereqs,magic,$(sort $(call magicfile,$(MAGIC
        $(foreach outdated,$(filter-out $^,$(wildcard $(BUILDDIR)/magic/*)),$(silent)$(RM) $(call quote,$(outdated))$(newline))
        $(call inform,$(PRINTF) '%s\n' 'Compiling new magic…' >&2)
        $(silent)$(call ensuredirectory,$(dir $@))
        $(foreach outdated,$(filter-out $^,$(wildcard $(BUILDDIR)/magic/*)),$(silent)$(RM) $(call quote,$(outdated))$(newline))
        $(call inform,$(PRINTF) '%s\n' 'Compiling new magic…' >&2)
        $(silent)$(call ensuredirectory,$(dir $@))
-       $(silent)cd $(call quote,$(BUILDDIR)) && $(FILE) -C -m $(call quote,$(realpath $(BUILDDIR)/magic))
+       $(silent)$(CD) $(call quote,$(BUILDDIR)) && $(FILE) -C -m $(call quote,$(realpath $(BUILDDIR)/magic))
        $(silent)$(TOUCH) $(call quote,$(BUILDDIR)/.update-types)
 
 # Generate the main parser.
        $(silent)$(TOUCH) $(call quote,$(BUILDDIR)/.update-types)
 
 # Generate the main parser.
@@ -712,7 +714,7 @@ $(DESTDIR)/% : $(SRC) $(foreach file,$(archivefiles),$(BUILDDIR)/files/$(file))
        $(call inform,$(PRINTF) '%s\n' $(call quote,Archiving </$(NAME)>…) >&2)
        $(silent)$(call ensuredirectory,$(dir $@))
        $(silent)$(RM) -f -R $(call quote,$@)
        $(call inform,$(PRINTF) '%s\n' $(call quote,Archiving </$(NAME)>…) >&2)
        $(silent)$(call ensuredirectory,$(dir $@))
        $(silent)$(RM) -f -R $(call quote,$@)
-       $(silent)cd $(call quote,$(BUILDDIR)/files); if $(call xpath,/*/@*[local-name()="expanded" and namespace-uri()="urn:fdc:ladys.computer:20231231:Shu1She4"],$(abspath $<)); then $(MKDIR) -p $(call quote,$(abspath $@)); $(PRINTF) '%s\n' $(foreach file,$(archivefiles),$(call quote,$(file))) | $(PAX) -r -w $(call quote,$(abspath $@)); else $(PRINTF) '%s\n' $(foreach file,$(archivefiles),$(call quote,$(file))) | $(PAX) -w -x ustar > $(call quote,$(abspath $@)); fi
+       $(silent)$(CD) $(call quote,$(BUILDDIR)/files); if $(call xpath,/*/@*[local-name()="expanded" and namespace-uri()="urn:fdc:ladys.computer:20231231:Shu1She4"],$(abspath $<)); then $(MKDIR) -p $(call quote,$(abspath $@)); $(PRINTF) '%s\n' $(foreach file,$(archivefiles),$(call quote,$(file))) | $(PAX) -r -w $(call quote,$(abspath $@)); else $(PRINTF) '%s\n' $(foreach file,$(archivefiles),$(call quote,$(file))) | $(PAX) -w -x ustar > $(call quote,$(abspath $@)); fi
 
 # ━ § END DEFINED MAKE·FILE MODES ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
 
 # ━ § END DEFINED MAKE·FILE MODES ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
index 8a6efb8afdd623b1f62fd39f1eb543b483dc4985..7f5e1df90bd128b3550056f9dc656c7a1a5ff08f 100644 (file)
@@ -181,6 +181,7 @@ In every case, you may supply your own implementation by overriding the
 
 - `awk`
 - `cat`
 
 - `awk`
 - `cat`
+- `cd`
 - `cksum`
 - `cp`
 - `date`
 - `cksum`
 - `cp`
 - `date`
This page took 0.059927 seconds and 4 git commands to generate.