jw-pkg/make/projects-dir.mk
Jan Lindemann 0b1b1bd30f projects-dir.mk: Remove several implicit pulls from echo-xxx targets
While this might fail if a user has an out-of-date or incomplete tree, it will
likely cause less confusion than a silently running update. The silence in the
update is required to keep the echo-'s target clean of unwanted garbage, which
complicates machine-readability.

Signed-off-by: Jan Lindemann <jan@janware.com>
2017-04-28 09:02:36 +00:00

258 lines
7.2 KiB
Makefile

#
# This is the top-level Makefile for a janware GmbH software build tree. It is
# provided under the terms of the GNU Lesser Public License, Version 2.
#
# You will need a janware.com user account for pretty much anything this
# Makefile does. Ask admin@janware.com if you want one.
#
# Please see https://janware.com/wiki/pub/en/sw/build/ for current
# documentation on how this Makefile is meant to be used. Running
# "make doc-module" might take you there semi-automatically.
#
# ------------ Makefile and environment variables
-include local.mk
ifneq ($(PROJECTS),)
export PGIT_CLONE_PROJECTS = $(PROJECTS)
endif
ifneq ($(wildcard projects.txt),)
PROJECTS ?= $(shell cat projects.txt | sed '/^ *\#/ d')
# TODO: this could be nicer
CVS_PROJECTS = $(PROJECTS)
else
PROJECTS ?= $(shell ls -d */CVS */.git 2>/dev/null | sed 's%/[^/]*%%')
CVS_PROJECTS = $(filter $(dir $(wildcard */CVS)),$(PROJECTS))
endif
EXCLUDE_FROM_BUILD += \
dspider-btools \
dspider-shared \
feedfs-dspcd \
casview \
dspfs \
jux3
BUILD_PROJECTS = $(filter-out $(EXCLUDE_FROM_BUILD),$(PROJECTS))
ifeq ($(JANWARE_USER),)
export JANWARE_USER = $(shell id -un)
endif
CWD := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
export CVSROOT = :ext:$(JANWARE_USER)@cvs.jannet.de:/home/jannet/arc/cvs
ifneq ($(JW_BUILD_SSH),)
export CVS_RSH := $(JW_BUILD_SSH)
else
export CVS_RSH := $(CWD)/ssh-wrapper.sh
endif
export GIT_SSH := $(CVS_RSH)
ifeq ($(filter pkg-%,$(MAKECMDGOALS)),)
export JW_BUILD_SSH_EXTRA_OPTS += -o ControlMaster=auto -o ControlPath=/tmp/%r@jw-build:%p -o ControlPersist=3m
endif
ifneq ($(CLONE_FROM_USER),)
export PGIT_CLONE_FROM_USER = $(CLONE_FROM_USER)
else
export PGIT_CLONE_FROM_USER = $(JANWARE_USER)
endif
ifneq ($(EXCLUDE_FROM_BUILD),)
BUILD_PY_EXTRA_ARGS += --exclude "$(EXCLUDE_FROM_BUILD)"
endif
# ------------ external programs
MOD_SCRIPT_DIR = ./jw-build/scripts
PGIT = CLONE_PROJECTS="$(PROJECTS)" /bin/bash $(firstword $(wildcard $(MOD_SCRIPT_DIR)/pgit.sh /opt/jw-build/bin/pgit.sh) pgit.sh-not-found)
BUILD_PY = python $(MOD_SCRIPT_DIR)/build.py -b $(shell pwd) $(BUILD_PY_EXTRA_ARGS)
PROJECTS_PY = python $(MOD_SCRIPT_DIR)/projects.py --prefix $(shell pwd) $(PROJECTS_PY_EXTRA_ARGS)
PURGE_SH = /bin/bash $(firstword $(wildcard $(MOD_SCRIPT_DIR)/purge-stale-projects.sh /opt/jw-build/bin/purge-stale-projects.sh) purge-not-found)
RELEASE_SH = /bin/bash $(firstword $(wildcard $(MOD_SCRIPT_DIR)/build-release.sh /opt/jw-build/bin/build-release.sh) release-not-found)
PKG_MANAGER_SH ?= /bin/bash $(firstword $(wildcard $(MOD_SCRIPT_DIR)/pkg-manager.sh /opt/jw-build/bin/pkg-manager.sh) pkg-manager-not-found)
CREATE_PROJECT_SH ?= /bin/bash $(firstword $(wildcard $(MOD_SCRIPT_DIR)/jw-build-create-project.sh /opt/jw-build/bin/jw-build-create-project.sh) jw-build-create-project-not-found)
BROWSER ?= firefox
GIT_SRV_ADMIN_SH = JW_BUILD_SSH_EXTRA_OPTS="$(JW_BUILD_SSH_EXTRA_OPTS)" $(GIT_SSH) $(JANWARE_USER)@git.jannet.de /opt/jw-build/bin/git-srv-admin.sh
CVS_ADMIN_SH = JW_BUILD_SSH_EXTRA_OPTS="$(JW_BUILD_SSH_EXTRA_OPTS)" $(GIT_SSH) $(JANWARE_USER)@git.jannet.de /opt/jw-build/bin/cvs-admin.sh
# ------------ targets
all: pull.done
all clean: pull.done
$(BUILD_PY) $@ $(BUILD_PROJECTS)
build-order: pull.done
$(BUILD_PY) order $(BUILD_PROJECTS) | sed 's/ */\n/g'
clean: done.clean
clean-dirs:
ls */dirs-all.done 2>/dev/null | sed 's%/.*%%' | xargs -r $(BUILD_PY) clean
echo-prereq-build:
@$(PROJECTS_PY) required-pkg $(BUILD_PROJECTS)
install-prereq-build:
@make --no-print-directory echo-prereq-build 2>/dev/null | xargs -r $(PKG_MANAGER_SH) install -y
echo-prereq-release:
@$(PROJECTS_PY) required-pkg --flavour release $(BUILD_PROJECTS)
install-prereq-release:
$(PKG_MANAGER_SH) refresh
@make --no-print-directory echo-prereq-build echo-prereq-release 2>/dev/null | xargs -r $(PKG_MANAGER_SH) install -y
init-project-%:
$(CREATE_PROJECT_SH) $*
doc-project doc-module:
$(BROWSER) $(firstword $(shell sed '/https:/ !d; s%.*https%https%; s/ .*//' $(lastword $(MAKEFILE_LIST))))
pkg-%: pull.done
$(BUILD_PY) $@ $(BUILD_PROJECTS)
status: ssh-wrapper.sh
for p in $(CVS_PROJECTS); do test -f $$d/CVS || echo $$p; done
cvs status $(addsuffix VERSION,$(CVS_PROJECTS))
$(PGIT) status
purge: ssh-wrapper.sh
ifneq ($(wildcard CVS),)
$(PURGE_SH)
endif
update pull: purge cvs-update git-clone
touch pull.done
pull-all: purge cvs-update git-clone git-pull-all
touch clone.done
touch pull.done
diff-all diff: ssh-wrapper.sh
cvs diff -u; $(PGIT) diff
rebuild: clean pull subdirs-all
release: ssh-wrapper.sh
$(RELEASE_SH)
subdirs-%:
FORCE_REBUILD_SUBDIRS=true make $*
cvs-update: ssh-wrapper.sh
rm -f $@.done
make $@.done
cvs-diff: ssh-wrapper.sh
cvs diff -u
git-push push: ssh-wrapper.sh
$(PGIT) push
git-push-all: ssh-wrapper.sh
$(PGIT) push --all
git-diff: ssh-wrapper.sh
$(PGIT) diff
git-short-diff: ssh-wrapper.sh
$(PGIT) diff --shortstat
git-pull: ssh-wrapper.sh
$(PGIT) clone
git-pull-all: ssh-wrapper.sh
$(PGIT) pull --all
git-clone: ssh-wrapper.sh
$(PGIT) clone
touch clone.done
git-clone-%: ssh-wrapper.sh
PGIT_CLONE_FROM_USER=$* $(PGIT) clone
pull-%: ssh-wrapper.sh
PGIT_CLONE_FROM_USER=$* $(PGIT) clone
git-commit:
$(PGIT) commit
git-conv-%: ssh-wrapper.sh
[ -e $*/.git ] || { \
mv $* old/ ;\
if PROJECTS="$*" make clone; then \
sed -i "/^D\/$*\// d" CVS/Entries ;\
else \
mv old/$* . ;\
fi \
}
check-conv: ssh-wrapper.sh
for p in `$(GIT_SRV_ADMIN_SH) -u jan -j list-personal-projects`; do \
make git-conv-$$p ;\
done
list-maintainers: ssh-wrapper.sh
$(GIT_SRV_ADMIN_SH) $@
git-update-project-descriptions: ssh-wrapper.sh
$(GIT_SRV_ADMIN_SH) -j update-descriptions all
projects.txt:
echo $(PROJECTS) | sed 's/ /\n/g; s%/%%g' > $@
done.clean:
rm -f *.done
links.done:
if [ -d btools ]; then ln -sf btools dspider-btools; fi
if [ -d dspc/src/shared ]; then ln -sf dspc/src/shared dspider-shared; fi
touch $@
ssh-wrapper.sh: Makefile
/bin/echo -e '#!/bin/bash -x\n\nexec /usr/bin/ssh $$JW_BUILD_SSH_EXTRA_OPTS "$$@"' > $@.tmp
chmod 700 $@.tmp
mv $@.tmp $@
ssh-wrapper: ssh-wrapper.sh
clean.ssh-wrapper:
rm -f ssh-wrapper.sh
clean: clean.ssh-wrapper
cvsdir.done: ssh-wrapper.sh
if [ ! -d CVS ]; then \
mkdir CVS && \
echo :ext:$(JANWARE_USER)@cvs.jannet.de:/home/jannet/arc/cvs > CVS/Root && \
echo proj > CVS/Repository && \
echo "/Makefile/$Revision$ ///" | sed 's/ *evision: *\([0-9.]*\) */\1/; s/ *$$ *//' > CVS/Entries ;\
fi
touch $@
cvs-update.done: cvsdir.done ssh-wrapper.sh
cvs update -dP Makefile $(shell $(CVS_ADMIN_SH) list-projects)
touch $@
update.done: purge
pull.done: cvs-update.done clone.done links.done
touch $@
clone.done: ssh-wrapper.sh
$(PGIT) clone
touch $@
loc:
find . -name '*.c' -o -name '*.cpp' -o -name '*.h' \
-o -name Makefile -o -name '*.mk' \
-o -name '*.sh' -o -name '*.pl' -o -name '*.py' \
| grep -v "/dist/\|\.dep\.mk\|local.mk\|coordgen\|^\./[^/]\+/include/" \
| grep -v "contrib/wt\|/bin/\|contrib/bootstrap\|contrib/chntpw/src\|contrib/jquery/src\|contrib/ntv2linux" \
| grep -v "copilot-suse-tw-cf/initrd-tree" \
| grep -v "iow-standalone\|jux3" \
| grep -v "generated\|tmp\|old\|orig\|purged"