X-Git-Url: https://git.ladys.computer/Shushe/blobdiff_plain/5a363a0a9e519b88fed12252328acd4bfa7689e5..a555040fdebc4432aee0c167a89e74ed1378f735:/GNUmakefile?ds=sidebyside diff --git a/GNUmakefile b/GNUmakefile index ca6bfcd..a9cf3b8 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -197,6 +197,46 @@ DATAEXT := rdf EXTRAFINDDATARULES := FINDDATARULES := -name '.' $(foreach ext,$(DATAEXT), -o -name '$(subst ','"'"',[!.]*.$(ext))')$(if $(EXTRAFINDDATARULES), -a '(' $(EXTRAFINDDATARULES) ')',) +# A semicolon‐separated list of regular expressions which paths should be required to match when finding files. +FINDFILTERONLY := + +# A semicolon‐separated list of regular expressions for paths which should be filtered out when finding files. +FINDFILTEROUT := + +# A semicolon‐separated list of regular expressions for paths which paths should be required to match when finding includes. +# +# This is generally only useful when `SRCDIR´ and `INCLUDEDIR´ point to the same location. +# In that situation, this variable can be used to select certain files as includes, leaving the others to be recognized as sources instead. +# +# Otherwise, appropriately constructing `FINDFILTERONLY´ to look at the base directory of the files it finds should be sufficient. +FINDINCLUDEFILTERONLY := + +# A semicolon‐separated list of regular expressions for paths which should be filtered out in addition to those in `FINDFILTEROUT´ when finding includes. +# +# This is generally only useful when `SRCDIR´ and `INCLUDEDIR´ point to the same location. +# In that situation, this variable can be used to exclude certain files from being recognized as includes, which will make them recognized as sources instead. +# +# Otherwise, appropriately constructing `FINDFILTEROUT´ to look at the base directory of the files it finds should be sufficient. +FINDINCLUDEFILTEROUT := + +# If not empty, the regular expression provided by `FINDFILTERONLY´ is an extended regular expression. +FINDFILTERONLYEXTENDED := + +# If not empty, the regular expression provided by `FINDFILTEROUT´ is an extended regular expression. +# +# By default, this matches `FINDFILTERONLYEXTENDED´ +FINDFILTEROUTEXTENDED := $(FINDFILTERONLYEXTENDED) + +# If not empty, the regular expression provided by `FINDFILTEROUT´ is an extended regular expression. +# +# By default, this matches `FINDFILTERONLYEXTENDED´ +FINDINCLUDEFILTERONLYEXTENDED := $(FINDFILTERONLYEXTENDED) + +# If not empty, the regular expression provided by `FINDINCLUDEFILTEROUT´ is an extended regular expression. +# +# By default, this matches `FINDFILTEROUTEXTENDED´ +FINDINCLUDEFILTEROUTEXTENDED := $(and $(FINDFILTERONLYEXTENDED),$(FINDFILTEROUTEXTENDED),1) + # The list of magic files to use when determining media types. # # Some are provided as part of this repository, but you can add more if you need different media type detection. @@ -403,10 +443,10 @@ override attresc = $(subst ",",$(call xmlesc,$1)) override sedesc = $(subst /,[/],$(subst $$,\$$,$(subst *,\*,$(subst .,\.,$(subst [,\[,$(subst ^,\^,$(subst \,\\,$1))))))) # (overridable) Collect all of the applicable includes from the includes directory. -sourceincludes := $(if $(and $(INCLUDEDIR),$(wildcard $(INCLUDEDIR))),$(patsubst ./%,%,$(shell $(FIND) $(foreach dir,$(INCLUDEDIR),$(call quote,$(dir))) '(' $(FINDINCLUDERULES) ')' -a -type f -a -print)),) +sourceincludes := $(foreach dir,$(INCLUDEDIR),$(and $(dir),$(wildcard $(dir)),$(patsubst ./%,%,$(shell $(FIND) $(call quote,$(dir)) '(' $(FINDINCLUDERULES) ')' -a -type f -a -print$(and $(FINDFILTERONLY),$(space)| $(GREP)$(and $(FINDFILTERONLYEXTENDED),$(space)-E) $(foreach filter,$(shell $(PRINTF) '%s\n' $(call quote,$(FINDFILTERONLY)) | $(TR) ' ;' '; '),-e $(call quote,$(subst ;, ,$(filter)))))$(and $(FINDINCLUDEFILTERONLY),$(space)| $(GREP)$(and $(FINDINCLUDEFILTERONLYEXTENDED),$(space)-E) $(foreach filter,$(shell $(PRINTF) '%s\n' $(call quote,$(FINDINCLUDEFILTERONLY)) | $(TR) ' ;' '; '),-e $(call quote,$(subst ;, ,$(filter)))))$(and $(FINDFILTEROUT),$(space)| $(GREP)$(and $(FINDFILTEROUTEXTENDED),$(space)-E) -v $(foreach filter,$(shell $(PRINTF) '%s\n' $(call quote,$(FINDFILTEROUT)) | $(TR) ' ;' '; '),-e $(call quote,$(subst ;, ,$(filter)))))$(and $(FINDINCLUDEFILTEROUT),$(space)| $(GREP)$(and $(FINDINCLUDEFILTEROUTEXTENDED),$(space)-E) -v $(foreach filter,$(shell $(PRINTF) '%s\n' $(call quote,$(FINDINCLUDEFILTEROUT)) | $(TR) ' ;' '; '),-e $(call quote,$(subst ;, ,$(filter))))))))) # (overridable) Collect all of the applicable source files from the source directory, removing any which are also includes. -sourcefiles := $(if $(and $(SRCDIR),$(wildcard $(SRCDIR))),$(filter-out $(sourceincludes),$(patsubst ./%,%,$(shell $(FIND) $(foreach dir,$(SRCDIR),$(call quote,$(dir))) '(' $(FINDRULES) ')' -a -type f -a -print)))) +sourcefiles := $(filter-out $(sourceincludes),$(foreach dir,$(SRCDIR),$(and $(dir),$(wildcard $(dir)),$(patsubst ./%,%,$(shell $(FIND) $(call quote,$(dir)) '(' $(FINDRULES) ')' -a -type f -a -print$(and $(FINDFILTERONLY),$(space)| $(GREP)$(and $(FINDFILTERONLYEXTENDED),$(space)-E) $(foreach filter,$(shell $(PRINTF) '%s\n' $(call quote,$(FINDFILTERONLY)) | $(TR) ' ;' '; '),-e $(call quote,$(subst ;, ,$(filter)))))$(and $(FINDFILTEROUT),$(space)| $(GREP)$(and $(FINDFILTEROUTEXTENDED),$(space)-E) -v $(foreach filter,$(shell $(PRINTF) '%s\n' $(call quote,$(FINDFILTEROUT)) | $(TR) ' ;' '; '),-e $(call quote,$(subst ;, ,$(filter)))))))))) # Figure out the file type of each source file and source include. ifneq ($(wildcard $(BUILDDIR)/magic.mgc),)