2017-04-12 15:11:22 +00:00
|
|
|
#
|
2017-04-12 16:24:40 +00:00
|
|
|
# This is the top-level Makefile for a janware GmbH software build tree. It is
|
2017-04-12 15:17:05 +00:00
|
|
|
# provided under the terms of the GNU Lesser Public License, Version 2.
|
2017-04-12 15:11:22 +00:00
|
|
|
#
|
|
|
|
|
# You will need a janware.com user account for pretty much anything this
|
|
|
|
|
# Makefile does. Ask admin@janware.com if you want one.
|
|
|
|
|
#
|
2017-04-13 08:42:50 +00:00
|
|
|
# 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.
|
2017-04-12 15:11:22 +00:00
|
|
|
#
|
|
|
|
|
|
2017-04-12 15:17:05 +00:00
|
|
|
# ------------ Makefile and environment variables
|
2016-11-18 10:30:11 +00:00
|
|
|
|
2017-04-20 20:02:47 +00:00
|
|
|
-include local.mk
|
|
|
|
|
|
2015-06-12 15:22:25 +00:00
|
|
|
ifneq ($(PROJECTS),)
|
2016-03-21 13:40:17 +00:00
|
|
|
export PGIT_CLONE_PROJECTS = $(PROJECTS)
|
2015-06-12 15:22:25 +00:00
|
|
|
endif
|
|
|
|
|
|
2013-12-11 19:25:42 +00:00
|
|
|
ifneq ($(wildcard projects.txt),)
|
2017-04-11 18:38:20 +00:00
|
|
|
PROJECTS ?= $(shell cat projects.txt | sed '/^ *\#/ d')
|
2016-03-21 13:40:17 +00:00
|
|
|
# TODO: this could be nicer
|
|
|
|
|
CVS_PROJECTS = $(PROJECTS)
|
2013-12-11 19:25:42 +00:00
|
|
|
else
|
2016-03-21 13:40:17 +00:00
|
|
|
PROJECTS ?= $(shell ls -d */CVS */.git 2>/dev/null | sed 's%/[^/]*%%')
|
|
|
|
|
CVS_PROJECTS = $(filter $(dir $(wildcard */CVS)),$(PROJECTS))
|
2013-12-11 19:25:42 +00:00
|
|
|
endif
|
2013-12-11 19:13:33 +00:00
|
|
|
|
2017-02-24 14:22:21 +00:00
|
|
|
EXCLUDE_FROM_BUILD += \
|
2016-11-18 10:30:11 +00:00
|
|
|
dspider-btools \
|
|
|
|
|
dspider-shared \
|
|
|
|
|
feedfs-dspcd \
|
|
|
|
|
casview \
|
|
|
|
|
dspfs \
|
|
|
|
|
jux3
|
|
|
|
|
|
2016-12-31 14:11:01 +00:00
|
|
|
BUILD_PROJECTS = $(filter-out $(EXCLUDE_FROM_BUILD),$(PROJECTS))
|
|
|
|
|
|
2016-03-21 13:40:17 +00:00
|
|
|
ifeq ($(JANWARE_USER),)
|
2016-11-18 10:30:11 +00:00
|
|
|
export JANWARE_USER = $(shell id -un)
|
|
|
|
|
endif
|
|
|
|
|
|
2017-04-12 18:21:20 +00:00
|
|
|
CWD := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
|
2017-04-11 19:15:58 +00:00
|
|
|
|
2017-04-12 18:21:20 +00:00
|
|
|
export CVSROOT = :ext:$(JANWARE_USER)@cvs.jannet.de:/home/jannet/arc/cvs
|
2017-04-13 08:42:50 +00:00
|
|
|
|
|
|
|
|
ifneq ($(JW_BUILD_SSH),)
|
|
|
|
|
export CVS_RSH := $(JW_BUILD_SSH)
|
|
|
|
|
else
|
|
|
|
|
export CVS_RSH := $(CWD)/ssh-wrapper.sh
|
|
|
|
|
endif
|
|
|
|
|
|
2017-04-12 18:21:20 +00:00
|
|
|
export GIT_SSH := $(CVS_RSH)
|
2017-04-20 20:00:46 +00:00
|
|
|
ifeq ($(filter pkg-%,$(MAKECMDGOALS)),)
|
|
|
|
|
export JW_BUILD_SSH_EXTRA_OPTS += -o ControlMaster=auto -o ControlPath=/tmp/%r@jw-build:%p -o ControlPersist=3m
|
|
|
|
|
endif
|
2017-04-12 10:07:48 +00:00
|
|
|
|
2016-11-18 10:30:11 +00:00
|
|
|
ifneq ($(CLONE_FROM_USER),)
|
|
|
|
|
export PGIT_CLONE_FROM_USER = $(CLONE_FROM_USER)
|
2016-03-21 13:40:17 +00:00
|
|
|
else
|
2016-12-06 19:35:44 +00:00
|
|
|
export PGIT_CLONE_FROM_USER = $(JANWARE_USER)
|
2016-03-21 13:40:17 +00:00
|
|
|
endif
|
2017-02-24 14:22:21 +00:00
|
|
|
|
|
|
|
|
ifneq ($(EXCLUDE_FROM_BUILD),)
|
2017-04-13 08:42:50 +00:00
|
|
|
BUILD_PY_EXTRA_ARGS += --exclude "$(EXCLUDE_FROM_BUILD)"
|
2017-02-24 14:22:21 +00:00
|
|
|
endif
|
2016-03-21 13:40:17 +00:00
|
|
|
|
2017-04-12 15:17:05 +00:00
|
|
|
# ------------ external programs
|
2017-04-11 15:05:52 +00:00
|
|
|
|
2017-04-12 13:30:53 +00:00
|
|
|
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)
|
2017-04-12 14:29:12 +00:00
|
|
|
PROJECTS_PY = python $(MOD_SCRIPT_DIR)/projects.py --prefix $(shell pwd) $(PROJECTS_PY_EXTRA_ARGS)
|
2017-04-12 13:30:53 +00:00
|
|
|
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)
|
2017-04-12 16:37:04 +00:00
|
|
|
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)
|
2017-04-12 13:30:53 +00:00
|
|
|
BROWSER ?= firefox
|
2017-04-12 15:17:05 +00:00
|
|
|
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
|
2017-04-12 14:17:01 +00:00
|
|
|
|
2016-11-18 10:30:11 +00:00
|
|
|
# ------------ targets
|
|
|
|
|
|
2016-09-18 11:44:25 +00:00
|
|
|
all: pull.done
|
2016-02-23 21:33:10 +00:00
|
|
|
|
2017-02-25 13:11:38 +00:00
|
|
|
all clean: pull.done
|
2016-12-31 14:11:01 +00:00
|
|
|
$(BUILD_PY) $@ $(BUILD_PROJECTS)
|
2016-02-24 19:54:40 +00:00
|
|
|
|
2017-02-25 13:11:38 +00:00
|
|
|
build-order: pull.done
|
|
|
|
|
$(BUILD_PY) order $(BUILD_PROJECTS) | sed 's/ */\n/g'
|
|
|
|
|
|
2016-12-31 17:00:22 +00:00
|
|
|
clean: done.clean
|
|
|
|
|
|
|
|
|
|
clean-dirs:
|
|
|
|
|
ls */dirs-all.done 2>/dev/null | sed 's%/.*%%' | xargs -r $(BUILD_PY) clean
|
2016-12-31 14:11:01 +00:00
|
|
|
|
2017-03-26 17:56:33 +00:00
|
|
|
echo-prereq-build:
|
2017-04-12 13:30:53 +00:00
|
|
|
@make --no-print-directory pull.done >/dev/null 2>&1
|
2017-04-12 14:29:12 +00:00
|
|
|
@$(PROJECTS_PY) required-pkg $(BUILD_PROJECTS)
|
2016-05-25 12:40:50 +00:00
|
|
|
|
2017-04-12 13:30:53 +00:00
|
|
|
install-prereq-build:
|
2017-04-12 13:45:19 +00:00
|
|
|
make --no-print-directory echo-prereq-build 2>/dev/null | xargs -r $(PKG_MANAGER_SH) install -y
|
2017-04-12 13:30:53 +00:00
|
|
|
|
2017-03-26 17:56:33 +00:00
|
|
|
echo-prereq-release:
|
2017-04-12 13:30:53 +00:00
|
|
|
@make --no-print-directory pull.done >/dev/null 2>&1
|
2017-04-12 14:29:12 +00:00
|
|
|
@$(PROJECTS_PY) required-pkg --flavour release $(BUILD_PROJECTS)
|
2017-03-26 17:56:33 +00:00
|
|
|
|
2017-04-12 16:37:04 +00:00
|
|
|
init-project-%:
|
|
|
|
|
@make --no-print-directory pull.done >/dev/null 2>&1
|
|
|
|
|
$(CREATE_PROJECT_SH) $*
|
|
|
|
|
|
2016-12-31 17:00:22 +00:00
|
|
|
doc-project doc-module:
|
2017-04-12 18:21:20 +00:00
|
|
|
$(BROWSER) $(firstword $(shell sed '/https:/ !d; s%.*https%https%; s/ .*//' $(lastword $(MAKEFILE_LIST))))
|
2014-07-24 14:22:36 +00:00
|
|
|
|
2016-12-31 17:00:22 +00:00
|
|
|
pkg-%: pull.done
|
|
|
|
|
$(BUILD_PY) $@ $(BUILD_PROJECTS)
|
2012-08-01 18:37:01 +00:00
|
|
|
|
2017-04-21 16:37:23 +00:00
|
|
|
status: ssh-wrapper.sh
|
2016-04-09 17:04:03 +00:00
|
|
|
for p in $(CVS_PROJECTS); do test -f $$d/CVS || echo $$p; done
|
|
|
|
|
cvs status $(addsuffix VERSION,$(CVS_PROJECTS))
|
|
|
|
|
$(PGIT) status
|
|
|
|
|
|
2017-04-21 14:12:37 +00:00
|
|
|
purge: ssh-wrapper.sh
|
2016-11-16 12:38:01 +00:00
|
|
|
ifneq ($(wildcard CVS),)
|
2016-09-18 13:44:50 +00:00
|
|
|
$(PURGE_SH)
|
2016-11-16 12:38:01 +00:00
|
|
|
endif
|
2016-09-18 13:44:50 +00:00
|
|
|
|
2017-04-22 11:31:55 +00:00
|
|
|
update pull: purge cvs-update git-clone
|
2016-09-18 13:44:50 +00:00
|
|
|
touch pull.done
|
|
|
|
|
|
2016-10-07 10:41:29 +00:00
|
|
|
pull-all: purge cvs-update git-clone git-pull-all
|
2017-04-22 11:31:55 +00:00
|
|
|
touch clone.done
|
2016-10-07 10:41:29 +00:00
|
|
|
touch pull.done
|
|
|
|
|
|
2017-04-21 16:37:23 +00:00
|
|
|
diff-all diff: ssh-wrapper.sh
|
2017-02-24 17:56:10 +00:00
|
|
|
cvs diff -u; $(PGIT) diff
|
|
|
|
|
|
2016-10-02 10:39:04 +00:00
|
|
|
rebuild: clean pull subdirs-all
|
|
|
|
|
|
2017-04-21 16:37:23 +00:00
|
|
|
release: ssh-wrapper.sh
|
2016-11-16 06:03:31 +00:00
|
|
|
$(RELEASE_SH)
|
|
|
|
|
|
2016-09-21 14:35:26 +00:00
|
|
|
subdirs-%:
|
|
|
|
|
FORCE_REBUILD_SUBDIRS=true make $*
|
2016-09-19 13:12:34 +00:00
|
|
|
|
2017-04-21 16:37:23 +00:00
|
|
|
cvs-update: ssh-wrapper.sh
|
2016-05-25 18:07:25 +00:00
|
|
|
rm -f $@.done
|
|
|
|
|
make $@.done
|
2013-12-11 19:13:33 +00:00
|
|
|
|
2017-04-21 16:37:23 +00:00
|
|
|
cvs-diff: ssh-wrapper.sh
|
2017-02-24 17:56:10 +00:00
|
|
|
cvs diff -u
|
|
|
|
|
|
2017-04-21 16:37:23 +00:00
|
|
|
git-push push: ssh-wrapper.sh
|
2015-06-12 15:22:25 +00:00
|
|
|
$(PGIT) push
|
2014-07-23 14:16:34 +00:00
|
|
|
|
2017-04-21 16:37:23 +00:00
|
|
|
git-push-all: ssh-wrapper.sh
|
2016-10-07 10:41:29 +00:00
|
|
|
$(PGIT) push --all
|
|
|
|
|
|
2017-04-21 16:37:23 +00:00
|
|
|
git-diff: ssh-wrapper.sh
|
2015-07-06 15:02:12 +00:00
|
|
|
$(PGIT) diff
|
|
|
|
|
|
2017-04-21 16:37:23 +00:00
|
|
|
git-short-diff: ssh-wrapper.sh
|
2016-10-02 19:37:22 +00:00
|
|
|
$(PGIT) diff --shortstat
|
|
|
|
|
|
2017-04-21 16:37:23 +00:00
|
|
|
git-pull: ssh-wrapper.sh
|
2015-06-12 15:22:25 +00:00
|
|
|
$(PGIT) pull
|
2014-07-23 14:15:37 +00:00
|
|
|
|
2017-04-21 16:37:23 +00:00
|
|
|
git-pull-all: ssh-wrapper.sh
|
2016-10-07 10:41:29 +00:00
|
|
|
$(PGIT) pull --all
|
|
|
|
|
|
2017-04-21 16:37:23 +00:00
|
|
|
git-clone: ssh-wrapper.sh
|
2016-09-18 13:44:50 +00:00
|
|
|
$(PGIT) clone
|
2016-12-31 17:00:22 +00:00
|
|
|
touch clone.done
|
2016-09-18 13:44:50 +00:00
|
|
|
|
2017-04-21 16:37:23 +00:00
|
|
|
git-clone-%: ssh-wrapper.sh
|
2016-11-22 10:06:45 +00:00
|
|
|
PGIT_CLONE_FROM_USER=$* $(PGIT) clone
|
|
|
|
|
|
2017-04-21 16:37:23 +00:00
|
|
|
pull-%: ssh-wrapper.sh
|
2016-11-22 12:07:03 +00:00
|
|
|
PGIT_CLONE_FROM_USER=$* $(PGIT) clone
|
|
|
|
|
|
2016-09-18 13:44:50 +00:00
|
|
|
git-commit:
|
|
|
|
|
$(PGIT) commit
|
2015-06-11 14:29:48 +00:00
|
|
|
|
2017-04-21 16:37:23 +00:00
|
|
|
git-conv-%: ssh-wrapper.sh
|
2015-06-12 19:43:39 +00:00
|
|
|
[ -e $*/.git ] || { \
|
|
|
|
|
mv $* old/ ;\
|
|
|
|
|
if PROJECTS="$*" make clone; then \
|
|
|
|
|
sed -i "/^D\/$*\// d" CVS/Entries ;\
|
|
|
|
|
else \
|
|
|
|
|
mv old/$* . ;\
|
|
|
|
|
fi \
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-21 16:37:23 +00:00
|
|
|
check-conv: ssh-wrapper.sh
|
2017-04-12 15:17:05 +00:00
|
|
|
for p in `$(GIT_SRV_ADMIN_SH) -u jan -j list-personal-projects`; do \
|
2015-06-12 19:43:39 +00:00
|
|
|
make git-conv-$$p ;\
|
|
|
|
|
done
|
|
|
|
|
|
2017-04-21 16:37:23 +00:00
|
|
|
list-maintainers: ssh-wrapper.sh
|
2017-04-12 15:17:05 +00:00
|
|
|
$(GIT_SRV_ADMIN_SH) $@
|
2017-04-10 19:21:18 +00:00
|
|
|
|
2017-04-21 16:37:23 +00:00
|
|
|
git-update-project-descriptions: ssh-wrapper.sh
|
2017-04-12 19:39:29 +00:00
|
|
|
$(GIT_SRV_ADMIN_SH) -j update-descriptions all
|
|
|
|
|
|
2015-10-25 12:12:51 +00:00
|
|
|
projects.txt:
|
|
|
|
|
echo $(PROJECTS) | sed 's/ /\n/g; s%/%%g' > $@
|
2015-06-12 19:43:39 +00:00
|
|
|
|
2016-04-09 17:04:03 +00:00
|
|
|
done.clean:
|
|
|
|
|
rm -f *.done
|
|
|
|
|
|
2016-02-24 18:30:27 +00:00
|
|
|
links.done:
|
2016-11-17 22:14:53 +00:00
|
|
|
if [ -d btools ]; then ln -sf btools dspider-btools; fi
|
|
|
|
|
if [ -d dspc/src/shared ]; then ln -sf dspc/src/shared dspider-shared; fi
|
2016-02-24 18:30:27 +00:00
|
|
|
touch $@
|
|
|
|
|
|
2017-04-12 10:07:48 +00:00
|
|
|
ssh-wrapper.sh: Makefile
|
2017-04-12 14:38:05 +00:00
|
|
|
/bin/echo -e '#!/bin/bash -x\n\nexec /usr/bin/ssh $$JW_BUILD_SSH_EXTRA_OPTS "$$@"' > $@.tmp
|
2017-04-12 10:07:48 +00:00
|
|
|
chmod 700 $@.tmp
|
|
|
|
|
mv $@.tmp $@
|
2017-04-21 14:12:37 +00:00
|
|
|
ssh-wrapper: ssh-wrapper.sh
|
2017-04-12 10:07:48 +00:00
|
|
|
clean.ssh-wrapper:
|
|
|
|
|
rm -f ssh-wrapper.sh
|
|
|
|
|
clean: clean.ssh-wrapper
|
|
|
|
|
|
|
|
|
|
cvsdir.done: ssh-wrapper.sh
|
2016-03-21 12:31:48 +00:00
|
|
|
if [ ! -d CVS ]; then \
|
2017-01-11 16:13:50 +00:00
|
|
|
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 ;\
|
2016-03-21 13:40:17 +00:00
|
|
|
fi
|
2016-03-21 12:31:48 +00:00
|
|
|
touch $@
|
|
|
|
|
|
2017-04-21 16:37:23 +00:00
|
|
|
cvs-update.done: cvsdir.done ssh-wrapper.sh
|
2017-04-12 15:17:05 +00:00
|
|
|
cvs update -dP Makefile $(shell $(CVS_ADMIN_SH) list-projects)
|
2016-04-09 17:04:03 +00:00
|
|
|
touch $@
|
|
|
|
|
|
2016-09-18 13:44:50 +00:00
|
|
|
update.done: purge
|
|
|
|
|
|
2017-04-11 15:04:30 +00:00
|
|
|
pull.done: cvs-update.done clone.done links.done
|
2016-09-18 11:44:25 +00:00
|
|
|
touch $@
|
|
|
|
|
|
2017-04-21 16:37:23 +00:00
|
|
|
clone.done: ssh-wrapper.sh
|
2016-05-25 19:03:31 +00:00
|
|
|
$(PGIT) clone
|
|
|
|
|
touch $@
|
|
|
|
|
|