X-Git-Url: https://git.ladys.computer/Shushe/blobdiff_plain/3d56020bffefecf41aceb500f74de4547e35b842..86c5d5eeef6def732f49b94bc497ee07d92dc72e:/GNUmakefile?ds=sidebyside diff --git a/GNUmakefile b/GNUmakefile index d1a7f6e..e698262 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -134,11 +134,13 @@ MAGICDIR := $(patsubst ./%,%,$(THISDIR)/magic) # Configuration of `find´. # -# By default, `find´ will follow symlinks and use extended regular -# expressions, ignoring hidden files and those which begin with a -# period. -FINDOPTS := -LE +# By default, `find´ will not follow symlinks and will use extended +# regular expressions, ignoring hidden files and those which begin with +# a period. +FINDOPTS := -PE FINDRULES := -flags -nohidden -and -not -name '.*' +FINDINCLUDEOPTS := $(FINDOPTS) +FINDINCLUDERULES := $(FINDRULES) # The list of parsers for plaintext file types. # @@ -193,7 +195,7 @@ override silent := $(if $(VERBOSE),,@) # (callable) Escape special characters for use in sed regular # expressions. -override sedesc = $(subst $$,\$$,$(subst *,\*,$(subst .,\.,$(subst [,\[,$(subst ^,\^,$(subst \,\\,$1)))))) +override sedesc = $(subst /,[/],$(subst $$,\$$,$(subst *,\*,$(subst .,\.,$(subst [,\[,$(subst ^,\^,$(subst \,\\,$1))))))) # Collect all of the applicable includes from the includes directory. sourceincludes := $(shell $(FIND) $(FINDOPTS) $(INCLUDEDIR) -type f '(' $(FINDRULES) ')') @@ -209,20 +211,16 @@ endif # Get the list of supported plaintext file types from the parser. ifneq ($(wildcard $(BUILDDIR)/parser.xslt),) -override plaintexttypes := $(shell $(XSLTPROC) $(call quote,$(THISDIR)/lib/parser2types.xslt) $(call quote,$(BUILDDIR)/parser.xslt)) +override plaintexttypes := $(filter-out $(XMLTYPES),$(shell $(XSLTPROC) $(call quote,$(THISDIR)/lib/parser2types.xslt) $(call quote,$(BUILDDIR)/parser.xslt))) endif -# Simplify the file type by only taking the first component (image, -# text, ⁊·c). -override simpletypes := $(shell $(TR) ' ' '\n' <<< $(call quote,$(types)) | $(SED) 's`/[^/]*$$``g') - # (callable) Get all of the files (source and includes) which have the # given types. override filesoftype = $(foreach type,$1,$(patsubst %?type=$(type),%,$(filter %?type=$(type),$(types)))) # Build up collections of various file types. -override plaintextfiles := $(call filesoftype,$(plaintexttypes)) -override xmlfiles := $(filter-out $(plaintextfiles),$(call filesoftype,$(XMLTYPES))) +override xmlfiles := $(call filesoftype,$(XMLTYPES)) +override plaintextfiles := $(filter-out $(xmlfiles),$(call filesoftype,$(plaintexttypes))) override assetfiles := $(filter-out $(xmlfiles) $(plaintextfiles),$(sourcefiles) $(sourceincludes)) # (callable) Get the types of the given files. @@ -302,7 +300,7 @@ help: $(silent)$(PRINTF) '%b' '$(subst $(newline),\n,$(makefileinfo))' # Compile all files, or error if any are recursive. -all: $(call compiled,$(recursivefiles) $(compilablefiles) $(assetfiles)) ; +all: $(call compiled,$(recursivefiles) $(compilablefiles) $(filter $(sourcefiles),$(assetfiles))) ; # Destroy buildfiles. clean: @@ -313,7 +311,7 @@ gone: $(silent)$(RM) -rf $(BUILDDIR)/ $(call compiled,$(recursivefiles) $(compilablefiles)) # Install the compiled files into `DESTDIR´. -install: $(call installed,$(recursivefiles) $(compilablefiles) $(assetfiles)) ; +install: $(call installed,$(recursivefiles) $(compilablefiles) $(filter $(sourcefiles),$(assetfiles))) ; # List all source files and includes and their computed types. list: