mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-25 09:35:54 +02:00
Add an init target. Use it if you want to tell the Makefile: _Just_ initalize the build machinery and nothing else, don't pull and build everything else you can. Not strictly necessary, most of the time pulling everything is what's wanted, and that does the init anyway. Signed-off-by: Jan Lindemann <jan@janware.com>
86 lines
3.1 KiB
Makefile
86 lines
3.1 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
|
|
Q ?= @
|
|
|
|
ifeq ($(origin PROJECTS_DIR_REMOTE_BASE),undefined)
|
|
ifneq ($(wildcard $(JWBDIR)),)
|
|
PROJECTS_DIR_REMOTE_BASE := $(shell /usr/bin/python3 $(JWBDIR)/scripts/jw-pkg.py -p . projects 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 ifneq ($(wildcard $(PROJECTS_DIR_REMOTE_BASE)),)
|
|
$(warning Using local PROJECTS_DIR_REMOTE_BASE = $(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-pkg.py -p . projects 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)
|
|
$(Q)echo Provided $@
|
|
|
|
$(JWBDIR):
|
|
git $(GIT_GLOBAL_OPTS) clone $(addprefix -b ,$(JW_PKG_BRANCH)) $(JWBDIR_GIT_REMOTE) $(JWBDIR)
|
|
ifneq ($(findstring proactiveAuth,$(GIT_GLOBAL_OPTS)),)
|
|
git -C $(JWBDIR) config set http.proactiveAuth basic
|
|
endif
|
|
|
|
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 $@
|
|
init: link-makefile.done
|
|
clean: clean.link-makefile
|
|
clean.link-makefile:
|
|
rm -f link-makefile.done
|