jw-pkg/make/projects-dir.mk

202 lines
4.4 KiB
Makefile
Raw Normal View History

# ------------ makefile and environment variables
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
export CVSROOT = :ext:$(JANWARE_USER)@cvs.jannet.de:/home/jannet/arc/cvs
ifeq ($(CVS_RSH),)
export CVS_RSH = ssh
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
# ------------ commands
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)
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)
BROWSER ?= firefox
GIT_SRV_ADMIN = ssh $(JANWARE_USER)@git.jannet.de /opt/jw-build/bin/git-srv-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:
@make pull.done >/dev/null 2>&1
@python $(MOD_SCRIPT_DIR)/projects.py $(PROJECTS_PY_EXTRA_ARGS) required-pkg $(BUILD_PROJECTS)
echo-prereq-release:
@make pull.done >/dev/null 2>&1
@python $(MOD_SCRIPT_DIR)/projects.py $(PROJECTS_PY_EXTRA_ARGS) required-pkg --flavour release $(BUILD_PROJECTS)
doc-project doc-module:
$(BROWSER) https://janware.com/wiki/pub/sw:build:
pkg-%: pull.done
$(BUILD_PY) $@ $(BUILD_PROJECTS)
status:
for p in $(CVS_PROJECTS); do test -f $$d/CVS || echo $$p; done
cvs status $(addsuffix VERSION,$(CVS_PROJECTS))
$(PGIT) status
purge:
ifneq ($(wildcard CVS),)
$(PURGE_SH)
endif
update pull: purge cvs-update git-clone git-pull
touch pull.done
pull-all: purge cvs-update git-clone git-pull-all
touch pull.done
diff-all diff:
cvs diff -u; $(PGIT) diff
rebuild: clean pull subdirs-all
release:
$(RELEASE_SH)
subdirs-%:
FORCE_REBUILD_SUBDIRS=true make $*
cvs-update:
rm -f $@.done
make $@.done
cvs-diff:
cvs diff -u
git-push push:
$(PGIT) push
git-push-all:
$(PGIT) push --all
git-diff:
$(PGIT) diff
git-short-diff:
$(PGIT) diff --shortstat
git-pull:
$(PGIT) pull
git-pull-all:
$(PGIT) pull --all
git-clone:
$(PGIT) clone
touch clone.done
git-clone-%:
PGIT_CLONE_FROM_USER=$* $(PGIT) clone
pull-%:
PGIT_CLONE_FROM_USER=$* $(PGIT) clone
git-commit:
$(PGIT) commit
git-conv-%:
[ -e $*/.git ] || { \
mv $* old/ ;\
if PROJECTS="$*" make clone; then \
sed -i "/^D\/$*\// d" CVS/Entries ;\
else \
mv old/$* . ;\
fi \
}
check-conv:
for p in `$(GIT_SRV_ADMIN) -u jan -j list-personal-projects`; do \
make git-conv-$$p ;\
done
list-maintainers:
$(GIT_SRV_ADMIN) $@
projects.txt:
echo $(PROJECTS) | sed 's/ /\n/g; s%/%%g' > $@
done.clean:
rm -f *.done
config.done: cvs-update.done
if [ -d ytools ]; then make -C ytools config; fi
touch $@
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 $@
cvsdir.done:
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
cvs update -dP $(CVS_PROJECTS)
touch $@
update.done: purge
pull.done: cvs-update.done config.done clone.done links.done
touch $@
clone.done:
$(PGIT) clone
touch $@