X-Git-Url: https://git.ladys.computer/Shushe/blobdiff_plain/c4c2cfb24adfa62c6b4cbd819b7efe80438d8d08..bc83928663f56508f210ce19a607aa9a52f32983:/GNUmakefile diff --git a/GNUmakefile b/GNUmakefile index 99e94cf..78f9a41 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -269,6 +269,9 @@ override space := $(empty) $(empty) # A variable which contains a single comma. override comma := , +# (callable) Make empty strings non·empty, and non·empty strings empty. +override not = $(if $1,,1) + # (callable) Quote the given string for use within shell calls. override quote = '$(subst ','"'"',$1)' @@ -379,7 +382,7 @@ override plaintextfiles := $(filter-out $(xmlfiles),$(call filesoftype,$(plainte override assetfiles := $(filter-out $(xmlfiles) $(plaintextfiles),$(sourcefiles) $(sourceincludes)) # (callable) Get the types of the given files. -override typeoffile = $(foreach file,$1,$(or $(patsubst $(file)|%,%,$(filter $(file)|%,$(types))),$(error Unable to get type of file `$(file)´))) +override typeoffile = $(foreach file,$1,$(or $(patsubst $(file)|%,%,$(filter $(file)|%,$(types))),application/octet-stream)) # Pair each source magic file with its location in the build directory. override magicpair := $(foreach magicfile,$(MAGIC),$(magicfile)|$(BUILDDIR)/magic/$(call namehash,$(magicfile))) @@ -414,7 +417,7 @@ override sourcefile = $(foreach local,$1,$(patsubst %|$(local),%,$(filter %|$(lo # # This file is created before a reload due to type changes, and is removed after. # This ensures that file classifications are up·to·date immediately after the reload. -override typeupdates := $(if $(wildcard $(BUILDDIR)/.update-types),FORCE,) +override typeupdates := $(and $(wildcard $(BUILDDIR)/.update-types),FORCE) # Pair each source file and include with its metadata location. override sourcemetadatapair := $(foreach file,$(sourcefiles) $(sourceincludes),$(file)|$(BUILDDIR)/$(if $(filter $(file),$(sourceincludes)),includes.metadata/$(call includepath,$(file)),sources.metadata/$(call sourcepath,$(file)))) @@ -478,7 +481,8 @@ ifneq ($(wildcard $(BUILDDIR)/destinations),) override destinations := $(shell $(CAT) $(BUILDDIR)/destinations) # Pair source files and their destinations. -override sourcedestinationpair := $(foreach destination,$(destinations),$(call sourcefile,$(firstword $(subst |, ,$(destination))))|$(call perdec,$(subst $(space),|,$(wordlist 2,$(words $(subst |, ,$(destination))),$(subst |, ,$(destination)))))) +override sourcedestinationpair := $(foreach destination,$(destinations),$(call sourcefile,$(firstword $(subst |, ,$(destination))))|$(subst $(space),|,$(wordlist 2,$(words $(subst |, ,$(destination))),$(subst |, ,$(destination))))) +endif # (callable) Get the destination for the given source files, or return `.NOTDEF/$1´. # @@ -502,7 +506,6 @@ override unbuilt = $(foreach file,$1,$(call uncompiled,$(patsubst $(BUILDDIR)/pu # (callable) Get the installed locations for the given source files. override installed = $(foreach file,$1,$(DESTDIR)/$(call destination,$(file))) -endif # ─ ¶ Recipe Variable Definitions ───────────────────────────────────── @@ -519,6 +522,9 @@ override wrapplaintext = { $(PRINTF) '%s\n%s' '' '