From f19831245ffb1fb5a0433c1b5e7a6626f38b3f57 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Thu, 27 Dec 2018 17:30:10 +0000 Subject: [PATCH] make: Support GNUmakefile too, where applicable Add support for GNUmakefile, where originally only Makefile was supported. Not done everywhere, as some of the code involving makefiles is dead anyway. Signed-off-by: Jan Lindemann --- make/bin.mk | 2 +- make/defs.mk | 12 +++++++----- make/dev-utils.mk | 2 +- make/install-files.mk | 2 +- make/projects-dir.mk | 2 +- make/std-tools.mk | 2 +- make/subtree.mk | 4 ++-- 7 files changed, 14 insertions(+), 12 deletions(-) diff --git a/make/bin.mk b/make/bin.mk index 490d4664..be09690f 100644 --- a/make/bin.mk +++ b/make/bin.mk @@ -5,5 +5,5 @@ all install: clean distclean: - $(RM) -f $(filter-out Makefile CVS debug release,$(wildcard *)) + $(RM) -f $(filter-out $(LOCAL_MKFILES) CVS debug release,$(wildcard *)) test: diff --git a/make/defs.mk b/make/defs.mk index be768666..25952a2d 100644 --- a/make/defs.mk +++ b/make/defs.mk @@ -97,8 +97,10 @@ CREATE_DEVEL = false endif endif -VERSION := $(shell $(CAT) $(VERSION_FILE)) -DIST_VERSION ?= $(shell $(SED) -e "s/-dev//" $(VERSION_FILE)) +ifneq ($(wildcard $(VERSION_FILE)),) + VERSION ?= $(shell $(CAT) $(VERSION_FILE)) +endif +DIST_VERSION ?= $(patsubst %-dev,%,$(VERSION)) HEX_VERSION = $(shell echo $(DIST_VERSION) | \ $(SED) 's/-dev//; s/pre[^\.]*//; s/F[^\.]//; s/[\.-]/ /g' | xargs printf "0x%02x%02x%02x%02x") BINARY_VERSION = $(shell echo $(PROJECT)_$(DIST_VERSION) | tr [a-z] [A-Z] | $(SED) 's/-[^-]*$$//; s/-/_/g') @@ -274,7 +276,7 @@ endif # makefile helpers FIND_SUBDIRS = $(filter-out . .. nomake CVS $(IGNORE_SUBDIRS),\ - $(patsubst ./%,%,$(patsubst %/,%,$(dir $(shell find . -maxdepth 2 -mindepth 2 -iname Makefile))))) + $(patsubst ./%,%,$(patsubst %/,%,$(dir $(shell find . -maxdepth 2 -mindepth 2 -a \( -iname Makefile -o -iname GNUmakefile \)))))) SUBDIRS_TO_ITERATE = $(filter-out $(IGNORE_SUBDIRS),$(SUBDIRS)) # compiler and linker @@ -359,6 +361,7 @@ UPLOAD_URL_DEVEL_DOC = rsync_ssh://root@feitnix.jannet.de:/srv/www/htdocs/jann IMAGES += $(wildcard *.png *.jpg *.bmp *.gif *.ico *.svg) FONTS += $(wildcard *.woff *.svg) +LOCAL_MKFILES ?= $(wildcard GNUmakefile makefile Makefile *.mk) # -- standard dirs and files for build and install @@ -514,7 +517,7 @@ INSTALLED_HTML += $(addprefix $(INSTALL_HTMLDIR)/,$(LOCAL_HTML)) # -- TMPL INSTALLATION_FILE_TYPES += TMPL BUILD_TMPLDIR = $(TOPDIR)/tmpl -LOCAL_TMPL += $(filter-out $(DONT_INSTALL) Makefile,$(wildcard *.tmpl)) +LOCAL_TMPL += $(filter-out $(DONT_INSTALL),$(wildcard *.tmpl)) TMPL_SUBDIR ?= $(shell $(PWD) | $(SED) '/.*\/tmpl\(\/\|$$\)/!d; s%.*/tmpl\(/\|$$\)%%') ifeq ($(TMPL_SUBDIR),) INSTALL_TMPLDIR = $(PROJECT_TMPLDIR) @@ -1092,4 +1095,3 @@ doc-project: $(BROWSER) $(JANWARE_URL_DOC_PROJECT) endif - diff --git a/make/dev-utils.mk b/make/dev-utils.mk index d5b7f9fd..d4ed79ea 100644 --- a/make/dev-utils.mk +++ b/make/dev-utils.mk @@ -9,7 +9,7 @@ echo-vars: make -p nothing | grep -B1 "^[A-Z_]* *[?:+]*=" echo-makefiles: - $(Q)strace -f make nothing 2>&1 | sed '/open\(at\)*(.*\(Makefile\|\.mk\)/ !d; s/.*open("//; s/.*openat([A-Z_]\+, "//; s/", O_.*//' + $(Q)strace -f make nothing 2>&1 | sed '/open\(at\)*(.*\(GNUmakefile\|makefile\|Makefile\|\.mk\)/ !d; s/.*open("//; s/.*openat([A-Z_]\+, "//; s/", O_.*//' cat-makefiles: Q=@ make --no-print-directory echo-makefiles | while read f; do echo "# =================================================== $$f"; sed 's/^include/#cat include/' $$f; done diff --git a/make/install-files.mk b/make/install-files.mk index 1e7b3c6a..670a2d2c 100644 --- a/make/install-files.mk +++ b/make/install-files.mk @@ -1,4 +1,4 @@ -SOURCE_FILES ?= $(filter-out CVS .git Makefile %.done, $(wildcard *)) +SOURCE_FILES ?= $(filter-out CVS .git $(LOCAL_MKFILES) %.done, $(wildcard *)) TARGET_DIR ?= $(PREFIX)/share SOURCE_BASE ?= . diff --git a/make/projects-dir.mk b/make/projects-dir.mk index fade6269..57019192 100644 --- a/make/projects-dir.mk +++ b/make/projects-dir.mk @@ -28,7 +28,7 @@ PREREQ_RELEASE ?= pull ifneq ($(wildcard $(PROJECTS_TXT)),) PROJECTS ?= $(shell cat $(PROJECTS_TXT) | sed '/^ *\#/ d') else - PROJECTS ?= $(shell ls -d */Makefile 2>/dev/null | sed 's%/[^/]*%%') + PROJECTS ?= $(shell ls -d */GNUmakefile */Makefile 2>/dev/null | sed 's%/[^/]*%%' | sort -u) endif ifeq ($(JW_BUILD_VERBOSE),true) diff --git a/make/std-tools.mk b/make/std-tools.mk index c43bc91f..c90c86f1 100644 --- a/make/std-tools.mk +++ b/make/std-tools.mk @@ -7,7 +7,7 @@ clean: clean.std-tools install: $(PROFILE_SH) install.std-tools.done distclean: clean -$(PROFILE_SH): Makefile +$(PROFILE_SH): $(LOCAL_MKFILES) echo '#!/bin/sh' > $@.tmp echo "if [ \"\$$PATH\" ]; then" >> $@.tmp echo " PATH=\$$PATH:$(INSTALL_EXEDIR)" >> $@.tmp diff --git a/make/subtree.mk b/make/subtree.mk index c90696ef..5944dcef 100644 --- a/make/subtree.mk +++ b/make/subtree.mk @@ -19,8 +19,8 @@ endif #SUBTREE_SRC = $(shell find .) #endif -SUBTREE_DIRS += $(shell for f in `git ls-files . 2>/dev/null || find | sed 's%/[^/]\+$$%%' | sort -u | grep -v Makefile`; do if [ -d "$$f" ]; then echo $$f; fi; done) -SUBTREE_FILES += $(shell for f in `git ls-files . 2>/dev/null || find | grep -v Makefile`; do if [ -f "$$f" ]; then echo $$f; fi; done) +SUBTREE_DIRS += $(shell for f in `git ls-files . 2>/dev/null || find | sed 's%/[^/]\+$$%%' | sort -u | grep -v "Makefile\|GNUmakefile"`; do if [ -d "$$f" ]; then echo $$f; fi; done) +SUBTREE_FILES += $(shell for f in `git ls-files . 2>/dev/null || find | grep -v "Makefile\|GNUmakefile"`; do if [ -f "$$f" ]; then echo $$f; fi; done) INSTALLED_SUBTREE_DIRS = $(addprefix $(ENV_PREFIX)$(SUBTREE_INSTALL_PREFIX)/,$(SUBTREE_DIRS)) INSTALLED_SUBTREE_FILES = $(addprefix $(ENV_PREFIX)$(SUBTREE_INSTALL_PREFIX)/,$(SUBTREE_FILES))