Add a new dependency flavour named "lint", in addition to the existing flavours run, build, devel and release, to declare the dependencies needed for static linting. Those are deliberately not lumped into the build flavour, because that might add dependencies that are hard to satisfy on some platforms that should remain buildable. Start easy, with OpenSUSE only, because Tumbleweed provides pyright and ruff in its core repositories. That should be enough for a first canary in CI. Tighter linting should be added by follow-up PRs. Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.5.1 Signed-off-by: Jan Lindemann <jan@janware.com>
325 lines
9.2 KiB
Makefile
325 lines
9.2 KiB
Makefile
# Need second expansion for TD_COPY_XXX concatenation rule to work
|
|
.SECONDEXPANSION:
|
|
|
|
.PHONY: \
|
|
FORCE \
|
|
all \
|
|
format \
|
|
canonicalize-remotes \
|
|
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 \
|
|
test
|
|
|
|
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)))
|
|
endif
|
|
|
|
ifeq ($(USE_USER_URL),true)
|
|
JANWARE_USER_PREFIX = $(JANWARE_USER)@
|
|
endif
|
|
|
|
PROJECT_DESCR = $(TOPDIR)/make/project.conf
|
|
GIT_DESCR = $(TOPDIR)/.git/description
|
|
GIT_MAIN_BRANCH ?= master
|
|
|
|
OPT_JANWARE_PROJECT ?= -j
|
|
|
|
ifeq ($(OPT_JANWARE_PROJECT),-j)
|
|
REMOTE_GIT_FLAVOUR ?= proj
|
|
else
|
|
OPT_JANWARE_PROJECT =
|
|
REMOTE_GIT_FLAVOUR ?= priv
|
|
endif
|
|
|
|
ifneq ($(wildcard $(TOPDIR)/make/defs.mk),)
|
|
include $(TOPDIR)/make/defs.mk
|
|
endif
|
|
|
|
include $(JWBDIR)/make/defs.mk
|
|
|
|
REMOTE_GIT_DIR = /$(JANWARE_USER)/$(REMOTE_GIT_FLAVOUR)/$(PROJECT)
|
|
REMOTE_GIT_URL = ssh://$(JANWARE_USER_PREFIX)devgit.janware.com$(REMOTE_GIT_DIR)
|
|
|
|
ifneq ($(DONT_CHECK_PREREQ_DONE),true)
|
|
ifndef PREREQ_DIRS_BUILD
|
|
PREREQ_DIRS_BUILD := $(call proj_query,proj-dir $(PREREQ_BUILD))
|
|
endif
|
|
PREREQ_DIRS_BUILD_DONE := $(addsuffix /dirs-all.done,$(filter-out $(TOPDIR) /opt/%,$(PREREQ_DIRS_BUILD)))
|
|
endif
|
|
|
|
ifneq ($(SUBDIRS_TO_ITERATE),)
|
|
ifeq ($(MAKECMDGOALS),)
|
|
SUBDIR_TARGETS = all
|
|
else
|
|
SUBDIR_TARGETS = $(filter $(ALLOWED_SUBDIR_TARGETS),$(MAKECMDGOALS))
|
|
endif
|
|
endif
|
|
|
|
JW_PKG_TMPL_SEARCH_PATH ?= $(JW_PKG_CONF_BASE_DIR)/templates
|
|
JW_PKG_TMPL_UPDATE ?= $(PYTHON) $(JWB_SCRIPT_DIR)/jw-pkg.py -p $(PROJECTS_DIR) -t $(TOPDIR) --topdir-format unaltered \
|
|
projects create-file --format tmpl --search-path $(subst $(space),:,$(JW_PKG_TMPL_SEARCH_PATH)) --template-name
|
|
|
|
GITIGNORE_PATTERNS_TOP ?= $(PROJECT)
|
|
GITIGNORE_PATTERNS_TOP_INV ?= $(subst $(space),|,$(strip $(addprefix \b,$(addsuffix \b,$(GITIGNORE_PATTERNS_TOP))) __init__\.py))
|
|
GITIGNORE_PATTERNS_END ?= $(addprefix !,$(shell git ls-files 2>/dev/null | grep -E "($(GITIGNORE_PATTERNS_TOP_INV))" | xargs))
|
|
|
|
all: topdir config
|
|
test: all
|
|
|
|
include $(JWBDIR)/make/dirs.mk
|
|
include $(JWBDIR)/make/pkg-dist.mk
|
|
include $(JWBDIR)/make/rules.mk
|
|
include $(JWBDIR)/make/doc-rules.mk
|
|
include $(JWBDIR)/make/list-files.mk
|
|
include $(JWBDIR)/make/projects+project.mk
|
|
include $(JWBDIR)/make/cache.mk
|
|
|
|
STREAMLINE_PROJECT ?= bash $(JWB_SCRIPT_DIR)/streamline-project.sh
|
|
|
|
INSTALLED_TOPDIR_FILES = $(addprefix $(INSTALL_DOCDIR)/, $(DOCS))
|
|
|
|
TD_CONF_DIR ?= $(JW_PKG_CONF_BASE_DIR)/topdir
|
|
TD_COPY_SRC ?= $(TD_CONF_DIR)
|
|
TD_COPY_FILES ?= $(filter-out Makefile,$(notdir $(wildcard $(TD_COPY_SRC)/*)))
|
|
# -- Internal variables, define JW_PKG_TOPDIR_COPY_PATH if you want to
|
|
# add more files appended to the target files
|
|
TD_COPY_SRC_PATH = $(subst :,$(space),$(JW_PKG_TOPDIR_COPY_PATH))
|
|
TD_GENERATE_FILES += $(TD_COPY_FILES) $(CACHE_PROJECT_MK)
|
|
|
|
test: all
|
|
format: topdir
|
|
check-syntax: topdir
|
|
check-format: topdir
|
|
check: check-syntax check-format
|
|
@echo "Static code checks completed successfully!"
|
|
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` ;\
|
|
$(RM) -f local.mk ;\
|
|
ln -s `basename $$f` local.mk ;\
|
|
) done
|
|
|
|
unlocal:
|
|
$(RM) -f $(shell find . -name local.mk)
|
|
|
|
topdir: $$(TD_GENERATE_FILES)
|
|
topdir.clean:
|
|
$(RM) -rf *.done $(TD_GENERATE_FILES)
|
|
clean: topdir.clean
|
|
topdir.distclean: topdir.clean
|
|
$(RM) -rf dist *.dist
|
|
distclean: topdir.distclean
|
|
topdir.mrproper: topdir.distclean
|
|
find . -name '*.rep' | xargs -r $(RM) -f
|
|
|
|
topdir.install: prefix.done $(INSTALLED_TOPDIR_FILES)
|
|
|
|
do-install-links:
|
|
$(Q)@cwd=$(shell $(PWD)); \
|
|
echo "o in $(INSTALL_LIBDIR):" ;\
|
|
find lib -name '*.so' -o -name '*.so.*' -o -name '*.a' -o -name '*.dll' | \
|
|
$(SED) 's%^\./%%' | \
|
|
while read f; do \
|
|
cd $(INSTALL_LIBDIR) && { \
|
|
echo " sudo ln -sf $$cwd/$$f" ; \
|
|
sudo ln -sf $$cwd/$$f; \
|
|
}; \
|
|
done; \
|
|
echo "o in $(INSTALL_EXEDIR):" ;\
|
|
find bin -type f -a -perm -u+x | \
|
|
$(SED) 's%^\./%%' | \
|
|
while read f; do \
|
|
cd $(INSTALL_EXEDIR) && { \
|
|
echo " sudo ln -sf $$cwd/$$f" ; \
|
|
sudo ln -sf $$cwd/$$f; \
|
|
}; \
|
|
done ;\
|
|
echo "o in $(INSTALL_HDRDIR):" ;\
|
|
find include -name '*.h' | \
|
|
$(SED) 's%^\./%%' | \
|
|
while read f; do \
|
|
cd $(INSTALL_HDRDIR) && { \
|
|
echo " sudo ln -sf $$cwd/$$f" ; \
|
|
sudo ln -sf $$cwd/$$f; \
|
|
}; \
|
|
done; \
|
|
echo "o in $(INSTALL_MAKEDIR):" ;\
|
|
find make -name '*.mk' | \
|
|
$(SED) 's%^\./%%' | \
|
|
while read f; do \
|
|
cd $(INSTALL_MAKEDIR) && { \
|
|
echo " sudo ln -sf $$cwd/$$f" ; \
|
|
sudo ln -sf $$cwd/$$f; \
|
|
}; \
|
|
done; \
|
|
|
|
install-links:
|
|
DEVELOPMENT=false make do-install-links
|
|
|
|
get-maintainer: git-get-maintainer
|
|
get-official: git-get-official
|
|
get-pub: git-get-pub
|
|
|
|
git-init: git-init.done $(GIT_DESCR)
|
|
|
|
git-init-from-cvs: git-init
|
|
$(LIST_VCS_FILES) -f | xargs git add
|
|
git commit -m "First commit of $(PKG_VERSION)"
|
|
|
|
git-config:
|
|
git config --global user.name || git config --global user.name "$(FULL_NAME)"
|
|
git config --global user.email || git config --global user.email $(JANWARE_USER)@janware.com
|
|
git remote -v | grep -q '^origin' || git remote add origin $(REMOTE_GIT_URL)
|
|
git remote -v | grep -q "^origin *$(REMOTE_GIT_URL)" || git remote set-url --push origin $(REMOTE_GIT_URL)
|
|
|
|
git-clone-to-remote:
|
|
ssh $(JANWARE_USER)@devgit.janware.com "/opt/jw-pkg/bin/git-srv-admin.sh $(OPT_JANWARE_PROJECT) create-personal-project $(PROJECT)"
|
|
make git-config
|
|
git push --set-upstream origin $(GIT_MAIN_BRANCH)
|
|
git push --all $(REMOTE_GIT_URL)
|
|
make git-update-project-description
|
|
|
|
git-import: git-init git-config
|
|
if ! git ls-files | grep -q .; then \
|
|
set -ex ;\
|
|
git add -A ;\
|
|
git status ;\
|
|
git commit -am "First commit" ;\
|
|
fi
|
|
|
|
git-init-remote: git-import git-clone-to-remote
|
|
|
|
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-%: FORCE
|
|
$(PYTHON) $(JWB_SCRIPT_DIR)/jw-pkg.py projects build $* $(PROJECT)
|
|
|
|
install-deps-devel:
|
|
sudo zypper in $(shell echo $(PKG_REQUIRES_DEVEL) | sed "s/ *= */-/g; s/ [^ ]\+-__NEXT_VERSION__//")
|
|
|
|
streamline:
|
|
$(STREAMLINE_PROJECT)
|
|
|
|
$(GIT_DESCR): $(PROJECT_DESCR_FILE)
|
|
/bin/bash $(JWB_SCRIPT_DIR)/ini-section.sh summary $< | tee $@.tmp
|
|
mv $@.tmp $@
|
|
|
|
git-init.done:
|
|
$(Q)if [ -e .git ]; then \
|
|
echo $(TOPDIR)/.git already exists, not running git init ;\
|
|
else \
|
|
@echo git init ;\
|
|
git init; \
|
|
fi
|
|
touch $@
|
|
|
|
prefix.done:
|
|
mkdir -p $(PREFIX)
|
|
touch $@
|
|
|
|
echo-build-deps:
|
|
$(Q)echo $(call proj_query, required-os-pkg --quote "build" $(PROJECT))
|
|
|
|
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
|
|
|
|
git-get-official:
|
|
make git-get-devops
|
|
|
|
git-get-maintainer:
|
|
make git-get-$(call proj_query,getval global jw-maintainer)
|
|
|
|
git-get-pub:
|
|
set -e; if git remote | grep -q "^pub$$"; then \
|
|
git fetch --prune --recurse-submodules=on-demand pub master ;\
|
|
git submodule foreach --recursive 'git fetch --tags -f pub' ;\
|
|
git rebase --autostash pub/master ;\
|
|
git merge --ff-only pub/master ;\
|
|
git submodule update --init --recursive ;\
|
|
fi
|
|
|
|
git-get-%: FORCE
|
|
PGIT_SH_PROJECTS=. $(PGIT_SH) get --refspec $*:$(GIT_MAIN_BRANCH):current-branch
|
|
|
|
get-%: git-get-%
|
|
@:
|
|
|
|
pkg-manager-refresh:
|
|
$(PKG_MANAGER) refresh
|
|
|
|
pkg-install-build-deps:
|
|
$(PKG_MANAGER) install $(shell $(proj_query_cmd) required-os-pkg --quote "build" $(PROJECT))
|
|
|
|
pkg-install-release-deps:
|
|
$(PKG_MANAGER) install $(shell $(proj_query_cmd) required-os-pkg --quote "build,run,release" $(PROJECT))
|
|
|
|
pkg-install-testbuild-deps:
|
|
$(PKG_MANAGER) install $(shell $(proj_query_cmd) pkg-requires --quote --hide-self --syntax names-only --delimiter " " "lint,build,run,devel,release" $(PROJECT))
|
|
|
|
recache-vars:
|
|
rm -f $(TOPDIR)/make clean-cache cache
|
|
|
|
canonicalize-remotes:
|
|
$(PYTHON) $(JWB_SCRIPT_DIR)/jw-pkg.py projects canonicalize-remotes
|
|
|
|
Makefile: ;
|
|
|
|
%: $(TD_COPY_SRC)/% $$(foreach path,$$(TD_COPY_SRC_PATH),$$(wildcard $$(addprefix $$(path)/,$$@))) $$(wildcard $$@.*)
|
|
cat $^ > $@.tmp
|
|
mv $@.tmp $@
|
|
|
|
gitignore:
|
|
$(JW_PKG_TMPL_UPDATE) gitignore --field-keys top,end \
|
|
$(addprefix --field top=,$(GITIGNORE_PATTERNS_TOP)) \
|
|
$(addprefix --field end=,$(GITIGNORE_PATTERNS_END)) \
|
|
--field-separator='%n' $(PROJECT) | grep -v '^[[:space:]]*$$' > .gitignore.tmp
|
|
mv .gitignore.tmp .gitignore
|