X-Git-Url: https://git.ladys.computer/Shushe/blobdiff_plain/964a6521326c8630f5589de971afaac5f6d68870..b03ac9094ce56f3591816f976cd5a4c97be492ac:/GNUmakefile?ds=inline diff --git a/GNUmakefile b/GNUmakefile index a0f6983..1fe78ec 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -144,17 +144,21 @@ MAGICDIR := $(patsubst ./%,%,$(THISDIR)/magic) # Configuration of `find´. # -# 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 ')' -FINDINCLUDERULES := $(FINDRULES) +# By default, `find´ will ignore files which begin with a period and those which are likely to cause problems for `make´. +EXTRAFINDRULES := +EXTRAFINDINCLUDERULES := +FINDRULES := ! '(' '(' -name '[.-]*' -o -name '*[][*?:|$$%\#\\; ]*' ')' -a -prune ')'$(if $(EXTRAFINDRULES), -a $(EXTRAFINDRULES),) +FINDINCLUDERULES := $(FINDRULES)$(if $(EXTRAFINDINCLUDERULES), -a $(EXTRAFINDINCLUDERULES),) # The list of parsers for plaintext file types. # # Which parsers are provided will influence which kinds of files are recognized as plaintext. -PARSERS := $(patsubst ./%,%,$(wildcard $(THISDIR)/parsers/*.xslt)) +EXTRAPARSERS := +PARSERS := $(sort $(patsubst ./%,%,$(wildcard $(THISDIR)/parsers/*.xslt)) $(EXTRAPARSERS)) # The list of transforms. -TRANSFORMS := $(patsubst ./%,%,$(wildcard $(THISDIR)/transforms/*.xslt)) +EXTRATRANSFORMS := +TRANSFORMS := $(sort $(patsubst ./%,%,$(wildcard $(THISDIR)/transforms/*.xslt)) $(EXTRATRANSFORMS)) # List of types which should be treated as X·M·L. XMLTYPES := application/xml text/xml @@ -210,10 +214,10 @@ override perenc = $(foreach unencoded,$1,$(call perdec,$(shell $(PRINTF) '%s' $( 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) $(foreach dir,$(INCLUDEDIR),$(call quote,$(dir))) -type f '(' $(FINDRULES) ')') +sourceincludes := $(shell $(FIND) $(foreach dir,$(INCLUDEDIR),$(call quote,$(dir))) '(' $(FINDRULES) ')' -a -type f) # (overridable) Collect all of the applicable source files from the source directory, removing any which are also includes. -sourcefiles := $(filter-out $(sourceincludes),$(shell $(FIND) $(foreach dir,$(SRCDIR),$(call quote,$(dir))) -type f '(' $(FINDRULES) ')')) +sourcefiles := $(filter-out $(sourceincludes),$(shell $(FIND) $(foreach dir,$(SRCDIR),$(call quote,$(dir))) '(' $(FINDRULES) ')' -a -type f)) ifdef GIT ifneq ($(wildcard $(THISDIR)/.git),) @@ -386,12 +390,12 @@ $(call compiled,$(recursivefiles)): # Phony rules; always consider these out·of·date. .PHONY: all default clean gone info install list uninstall $(call compiled,$(recursivefiles)); -ifneq ($(wildcard $(BUILDDIR)/.update-types)$(wildcard $(BUILDDIR)/dependencies),) -# Reload this make·file if the dependency graph has changed. +ifneq ($(wildcard $(BUILDDIR)/.update-types)$(wildcard $(BUILDDIR)/dependencies)$(wildcard $(BUILDDIR)/destinations),) +# Reload this make·file if the dependency graph or output destinations have changed. # # The dependency graph and output destinations are used to set the values of variables in this make·file, so it’s important to ensure that they are actually up·to·date prior to executing any later rules. # -# This recipe only exists after types have been updated or when the dependency graph already exists. +# This recipe only exists after types have been updated or when the dependency graph or destinations file already exists. $(THISDIR)/GNUmakefile:: $(BUILDDIR)/dependencies $(BUILDDIR)/destinations $(silent)$(TOUCH) $(THISDIR)/GNUmakefile $(silent)$(RM) -f $(BUILDDIR)/.update-types @@ -406,7 +410,7 @@ ifeq ($(wildcard $(BUILDDIR)/.update-types),) # This recipe sleeps for one second to ensure that files built after the restart have a more current time·stamp. $(THISDIR)/GNUmakefile:: $(BUILDDIR)/magic.mgc $(BUILDDIR)/parser.xslt $(silent)$(TOUCH) $(THISDIR)/GNUmakefile - $(silent)$(RM) -f $(call quote,$(BUILDDIR)/dependencies) + $(silent)$(RM) -f $(call quote,$(BUILDDIR)/dependencies) $(call quote,$(BUILDDIR)/destinations) @$(PRINTF) '%b\n' '\0033[1mMagic file or parsers have updated. Restarting…\0033[22m' $(silent)$(SLEEP) 1 $(silent)$(TOUCH) $(call quote,$(BUILDDIR)/.update-types)