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 <jan@janware.com>
This commit is contained in:
Jan Lindemann 2018-12-27 17:30:10 +00:00
commit f19831245f
7 changed files with 14 additions and 12 deletions

View file

@ -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:

View file

@ -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

View file

@ -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

View file

@ -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 ?= .

View file

@ -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)

View file

@ -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

View file

@ -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))