From 22d87143a3787d2c9f53fa18439378bd7cc517a3 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Thu, 28 May 2026 07:14:26 +0200 Subject: [PATCH] topdir.mk: Cleanup, add static code check targets - Apply some style fixup to topdir.mk. Notably beautify indentation and move the target area down below the area with the include statements. - Add the following targets: format: check-syntax: check-format: check: check-syntax check-format These targets currently don't do anything and are meant as hooks for individual linters to add dependencies. - Make .PHONY depend on all phony non-pattern targets - Make all phony pattern-targets depend on FORCE Signed-off-by: Jan Lindemann --- make/topdir.mk | 84 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 64 insertions(+), 20 deletions(-) diff --git a/make/topdir.mk b/make/topdir.mk index ff7443fa..9830022d 100644 --- a/make/topdir.mk +++ b/make/topdir.mk @@ -1,15 +1,51 @@ -all: config -install: topdir.install -clean: topdir.clean -distclean: topdir.distclean -config: -mrproper:distclean topdir.mrproper +.PHONY: \ + FORCE \ + all \ + format \ + check-syntax \ + check-format \ + check \ + install \ + clean \ + distclean \ + config \ + mrproper \ + unlocal \ + topdir.distclean \ + topdir.clean \ + topdir.mrproper \ + topdir.install \ + do-install-links \ + install-links \ + get-maintainer \ + get-official \ + get-pub \ + git-init \ + git-init-from-cvs \ + git-config \ + git-clone-to-remote \ + git-import \ + git-init-remote \ + git-descr \ + git-update-project-description \ + install-deps-devel \ + streamline \ + git-ssh \ + git-get-official \ + git-get-maintainer \ + git-get-pub \ + pkg-manager-refresh \ + pkg-install-build-deps \ + pkg-install-release-deps \ + pkg-install-testbuild-deps \ + recache-vars \ + canonicalize-remotes ifeq ($(ORDERED_SUBDIRS),) -SUBDIRS ?= $(dir $(wildcard $(addsuffix /Makefile,\ - inst/pre make scripts contrib src libsrc \ - tools include lib bin util exe plugins conf config cfg \ - images htdocs tmpl doc test inst/post))) + SUBDIRS ?= $(dir $(wildcard $(addsuffix /Makefile,\ + inst/pre make scripts contrib src libsrc \ + tools include lib bin util exe plugins conf config cfg \ + images htdocs tmpl doc test inst/post))) endif ifeq ($(USE_USER_URL),true) @@ -25,10 +61,10 @@ INTERACTIVE ?= auto PKG_MANAGER ?= $(JW_PKG_PY) --interactive=$(INTERACTIVE) pkg ifeq ($(OPT_JANWARE_PROJECT),-j) -REMOTE_GIT_FLAVOUR ?= proj + REMOTE_GIT_FLAVOUR ?= proj else -OPT_JANWARE_PROJECT = -REMOTE_GIT_FLAVOUR ?= priv + OPT_JANWARE_PROJECT = + REMOTE_GIT_FLAVOUR ?= priv endif ifneq ($(wildcard $(TOPDIR)/make/defs.mk),) @@ -71,7 +107,18 @@ STREAMLINE_PROJECT ?= bash $(JWB_SCRIPT_DIR)/streamline-project.sh INSTALLED_TOPDIR_FILES = $(addprefix $(INSTALL_DOCDIR)/, $(DOCS)) -local-%: +all: config +format: +check-syntax: +check-format: +check: check-syntax check-format +install: topdir.install +clean: topdir.clean +distclean: topdir.distclean +config: +mrproper:distclean topdir.mrproper + +local-%: FORCE find . -name $@.mk | \ while read f; do (\ cd `dirname $$f` ;\ @@ -168,7 +215,7 @@ git-descr: $(GIT_DESCR) git-update-project-description: ssh $(JANWARE_USER)@devgit.janware.com "/opt/jw-pkg/bin/git-srv-admin.sh $(OPT_JANWARE_PROJECT) update-descriptions $(PROJECT)" -projects-%: +projects-%: FORCE $(PYTHON) $(JWB_SCRIPT_DIR)/jw-pkg.py projects build $* $(PROJECT) install-deps-devel: @@ -197,7 +244,7 @@ prefix.done: echo-build-deps: $(Q)echo $(call proj_query, required-os-pkg --quote "build" $(PROJECT)) -git-ssh-%: +git-ssh-%: FORCE bash -c "`git remote get-url --push $* | sed 's|ssh://||; s|\([^/]\+\)/\(.*\)|LC_CDPATH=/\2 ssh -o SendEnv=LC_CDPATH \1|'`" git-ssh: git-ssh-origin @@ -212,7 +259,7 @@ git-get-pub: JW_PKG_SSH_EXTRA_OPTS="" git pull pub master ;\ fi -git-get-%: +git-get-%: FORCE PGIT_SH_PROJECTS=. $(PGIT_SH) get --refspec $*:$(GIT_MAIN_BRANCH):current-branch get-%: git-get-% @@ -230,9 +277,6 @@ pkg-install-release-deps: pkg-install-testbuild-deps: $(PKG_MANAGER) install $(shell $(proj_query_cmd) pkg-requires --quote --skip-excluded --hide-self --syntax names-only --delimiter " " "build,run,devel,release" $(PROJECT)) -echo-hash: - $(Q)/bin/bash $(PKG_SH_EXE) hash - recache-vars: rm -f $(TOPDIR)/make clean-cache cache