mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 03:53:32 +01:00
jw-build doesn't stop at building software, packaging it afterwards is also a core feature, so this commit gives the package a better name. The commit replaces strings s/jw-build/jw-pkg/ in text files and file names. Fallout to the functionality is fixed, variable names are left as they are, though. To be adjusted by later commits. Signed-off-by: Jan Lindemann <jan@janware.com>
82 lines
2.9 KiB
Makefile
82 lines
2.9 KiB
Makefile
#
|
|
# SPDX-License-Identifier: LGPL-2.0-only
|
|
#
|
|
# Makefile for managing multiple software repositories in one tree
|
|
# (C) Copyright 2001-2025, Jan Lindemann <jan@janware.com>
|
|
#
|
|
# This is the top-level Makefile for a software build tree organized by
|
|
# jw-pkg. It is provided under the terms of the GNU Lesser Public License,
|
|
# Version 2.
|
|
#
|
|
# Current documentation on how this Makefile is meant to be used can be found
|
|
# under https://janware.com/wiki/pub/en/sw/build/. Running "make help" might
|
|
# take you there semi-automatically.
|
|
#
|
|
|
|
PROJECTS_MAKEFILE_NAME := $(firstword $(MAKEFILE_LIST))
|
|
|
|
-include local.mk
|
|
|
|
JWBDIR ?= jw-pkg
|
|
|
|
ifeq ($(origin PROJECTS_DIR_REMOTE_BASE),undefined)
|
|
ifneq ($(wildcard $(JWBDIR)),)
|
|
PROJECTS_DIR_REMOTE_BASE := $(shell /usr/bin/python3 $(JWBDIR)/scripts/jw-projects.py -p . get-auth-info --remote-base --only-values)
|
|
endif
|
|
ifeq ($(PROJECTS_DIR_REMOTE_BASE),)
|
|
PROJECTS_DIR_REMOTE_BASE := https://janware.com/code
|
|
endif
|
|
endif
|
|
|
|
ifneq ($(findstring ssh://git.janware.com/srv/git,$(PROJECTS_DIR_REMOTE_BASE)),)
|
|
$(warning Using janware private SSH: $(PROJECTS_DIR_REMOTE_BASE))
|
|
PROJECTS_DIR_REMOTE_USER_SUBPATH ?= /proj
|
|
else ifneq ($(findstring ssh://git.janware.com,$(PROJECTS_DIR_REMOTE_BASE)),)
|
|
$(warning Using janware SSH: $(PROJECTS_DIR_REMOTE_BASE))
|
|
else ifneq ($(findstring https://,$(PROJECTS_DIR_REMOTE_BASE)),)
|
|
$(warning Using HTTPS: $(PROJECTS_DIR_REMOTE_BASE))
|
|
else
|
|
$(error Unsupported PROJECTS_DIR_REMOTE_BASE="$(PROJECTS_DIR_REMOTE_BASE)")
|
|
endif
|
|
|
|
ifeq ($(JANWARE_USER),)
|
|
ifneq ($(wildcard $(JWBDIR)),)
|
|
JANWARE_USER := $(shell /usr/bin/python3 $(JWBDIR)/scripts/jw-projects.py -p . get-auth-info --username --only-values)
|
|
endif
|
|
endif
|
|
|
|
ifneq ($(JANWARE_USER),)
|
|
CLONE_FROM_USER ?= $(JANWARE_USER)
|
|
GIT_GLOBAL_OPTS += -c https.proactiveAuth=basic
|
|
export GIT_GLOBAL_OPTS
|
|
else
|
|
CLONE_FROM_USER ?= janware
|
|
endif
|
|
|
|
JWBDIR_GIT_REMOTE ?= $(PROJECTS_DIR_REMOTE_BASE)/$(CLONE_FROM_USER)$(PROJECTS_DIR_REMOTE_USER_SUBPATH)/$(notdir $(JWBDIR))
|
|
PROJECTS_DIR_INCLUDE_MK = $(JWBDIR)/make/projects-dir-include.mk
|
|
|
|
all:
|
|
|
|
include $(PROJECTS_DIR_INCLUDE_MK)
|
|
|
|
$(PROJECTS_DIR_INCLUDE_MK): | $(JWBDIR)
|
|
|
|
$(JWBDIR):
|
|
git $(GIT_GLOBAL_OPTS) clone $(addprefix -b ,$(JW_BUILD_BRANCH)) $(JWBDIR_GIT_REMOTE) $(JWBDIR)
|
|
ifneq ($(findstring proactiveAuth,$(GIT_GLOBAL_OPTS)),)
|
|
git -C $(JWBDIR) config set http.proactiveAuth basic
|
|
endif
|
|
make $(MAKECMDGOALS)
|
|
|
|
RANDOM_STRING := some-random-string-to-id-this-makefile
|
|
all: link-makefile.done
|
|
link-makefile.done: | $(JWBDIR)
|
|
if [ ! -L $(PROJECTS_MAKEFILE_NAME) ] && grep -q $(RANDOM_STRING) $(PROJECTS_MAKEFILE_NAME); then \
|
|
ln -sf `git -C $(JWBDIR) ls-files | sed '/\.mk$$/ !d; s|^|$(JWBDIR)/|' | xargs grep -l $(RANDOM_STRING)` \
|
|
$(PROJECTS_MAKEFILE_NAME) ;\
|
|
fi
|
|
touch $@
|
|
clean: clean.link-makefile
|
|
clean.link-makefile:
|
|
rm -f link-makefile.done
|