X-Git-Url: https://git.ladys.computer/Shushe/blobdiff_plain/a2a37ad84293ab4880a23a816f7eeba60083806a..54dfa39ba4c73ae0d9a0fa608d9d48f40d63e136:/GNUmakefile diff --git a/GNUmakefile b/GNUmakefile index cf2a538..70183f8 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -150,7 +150,7 @@ MAGICDIR := $(patsubst ./%,%,$(THISDIR)/magic) # # By default, `find´ will ignore hidden files, those which begin with a # period, and those which are likely to cause problems for `make´. -FINDRULES := -flags -nohidden -and ! '(' '(' -name '[.-]*' -or -name '*[:|$$%]*' ')' -and -prune ')' +FINDRULES := -flags -nohidden -and ! '(' '(' -name '[.-]*' -or -name '*[][*?:|$$%\#;]*' ')' -and -prune ')' FINDINCLUDERULES := $(FINDRULES) # The list of parsers for plaintext file types. @@ -218,18 +218,20 @@ override perdec = $(foreach encoded,$1,$(shell $(PRINTF) '%s\n' $(call quote,$(e # The encoding assumes the input is a “u·r·i component”; e·g that the # resulting string should only contain `pchar´ (but can contain any # `sub-delim´). -override perenc = $(foreach unencoded,$1,$(call perdec,$(shell $(PRINTF) '%s' $(call quote,$(unencoded)) | $(OD) -t x1 | $(SED) 's/^[0-9]*//;s/2[146-9A-Ea-e]/%&/g;s/3[0-9AaBbDd]/%&/g;s/40/%&/g;s/[46][1-9A-Fa-f]/%&/g;s/[57][0-9Aa]/%&/g;s/7[Ee]/%&/g;s/[ ][0-9A-Fa-f]\{2\}/%25&/g' | $(TR) -d ' \n' | $(TR) 'abcdef' 'ABCDEF'))) +override perenc = $(foreach unencoded,$1,$(call perdec,$(shell $(PRINTF) '%s' $(call quote,$(unencoded)) | $(OD) -t x1 | $(SED) 's/^[0-9]*//;s/2[146-9A-Ea-e]/%&/g;s/3[0-9AaBbDd]/%&/g;s/40/%&/g;s/[46][1-9A-Fa-f]/%&/g;s/[57][0-9Aa]/%&/g;s/5[Ff]/%&/g;s/7[Ee]/%&/g;s/[ ][0-9A-Fa-f]\{2\}/%25&/g' | $(TR) -d ' \n' | $(TR) 'abcdef' 'ABCDEF'))) # (callable) Percent‐encode each component in the given paths. +# +# ☡ This will remove leading and trailing slashes. override pathenc = $(foreach path,$1,$(subst $(space),/,$(call perenc,$(subst /, ,$(path))))) # (overridable) Collect all of the applicable includes from the # includes directory. -sourceincludes := $(shell $(FIND) $(FINDOPTS) $(foreach dir,$(INCLUDEDIR),$(call quote,$(dir))) -type f '(' $(FINDRULES) ')') +sourceincludes := $(shell $(FIND) $(foreach dir,$(INCLUDEDIR),$(call quote,$(dir))) -type f '(' $(FINDRULES) ')') # (overridable) Collect all of the applicable source files from the # source directory, removing any which are also includes. -sourcefiles := $(filter-out $(sourceincludes),$(shell $(FIND) $(FINDOPTS) $(foreach dir,$(SRCDIR),$(call quote,$(dir))) -type f '(' $(FINDRULES) ')')) +sourcefiles := $(filter-out $(sourceincludes),$(shell $(FIND) $(foreach dir,$(SRCDIR),$(call quote,$(dir))) -type f '(' $(FINDRULES) ')')) ifdef GIT ifneq ($(wildcard $(THISDIR)/.git),) @@ -343,8 +345,8 @@ override sourcedestinationpair := $(foreach destination,$(destinations),$(call s # (callable) Get the destination for the given source files. override destination = $(foreach file,$1,$(patsubst $(file)|%,%,$(filter $(file)|%,$(sourcedestinationpair)))) -# Pair each source file and include with its compiled location. -override sourcecompiledpair := $(foreach file,$(sourcefiles) $(sourceincludes),$(file)|$(BUILDDIR)/public/$(call destination,$(file))) +# Pair each source file with its compiled location. +override sourcecompiledpair := $(foreach file,$(sourcefiles),$(file)|$(BUILDDIR)/public/$(call destination,$(file))) # (callable) Get the location of the transformed X·M·L files for the # given source files. @@ -371,10 +373,10 @@ override wrapplaintext = $(PRINTF) '%s\n' "$$($(PRINTF) '%b' ',) )) | $(TR) ' |' '\n ' + @$(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))))$(if $(filter $(file),$(sourcefiles)), →|<\0033[4m/$(call destination,$(file))\0033[24m>,) )) | $(TR) ' |' '\n ' # Raise an error when attempting to build any files with recursive # dependencies.