mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 20:13:32 +01:00
Cleanup: Rename variables, remove edge-cases
- Rename some variables for clarity
- BASE_PACKAGES -> PREREQ_BASE
- BUILD_PROJECTS -> TARGET_PROJECTS
- BUILD_PROJECTS now contains $(TARGET_PROJECTS) and
their dependencies
- Remove almost all special treatment of packages, notably
remove as many explicit project names from Makefile as
possible
- Work further towards making all targets work off the the
current $(PROJECTS) definitions
- Add target cloc, remove loc
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
822cbf6e2e
commit
c49a3cbd03
1 changed files with 25 additions and 38 deletions
|
|
@ -20,26 +20,14 @@
|
|||
SHELL = /bin/bash -o pipefail
|
||||
PROJECTS_TXT ?= projects.txt
|
||||
JW_BUILD_VERBOSE ?= false
|
||||
BASE_PACKAGES = cvs git make sudo
|
||||
EXCLUDE_FROM_BUILD += \
|
||||
dspider-btools \
|
||||
dspider-shared \
|
||||
feedfs-dspcd \
|
||||
casview \
|
||||
dspfs \
|
||||
jux3 \
|
||||
emscren-v8
|
||||
|
||||
PREREQ_BASE = cvs git make sudo
|
||||
|
||||
# ------------ evaluate Makefile and environment variables
|
||||
|
||||
ifneq ($(wildcard $(PROJECTS_TXT)),)
|
||||
PROJECTS ?= $(shell cat $(PROJECTS_TXT) | sed '/^ *\#/ d')
|
||||
# TODO: this could be nicer
|
||||
CVS_PROJECTS = $(PROJECTS)
|
||||
else
|
||||
PROJECTS ?= $(shell ls -d */Makefile 2>/dev/null | sed 's%/[^/]*%%')
|
||||
CVS_PROJECTS = $(filter $(dir $(wildcard */CVS)),$(PROJECTS))
|
||||
endif
|
||||
|
||||
ifeq ($(JW_BUILD_VERBOSE),true)
|
||||
|
|
@ -63,8 +51,6 @@ ifneq ($(wildcard $(EXCLUDES_FILES)),)
|
|||
EXCLUDE_FROM_BUILD += $(shell sed 's/\#.*//g' $(wildcard $(EXCLUDES_FILES)))
|
||||
endif
|
||||
|
||||
BUILD_PROJECTS = $(filter-out $(EXCLUDE_FROM_BUILD),$(PROJECTS))
|
||||
|
||||
ifndef JANWARE_USER
|
||||
ifneq ($(wildcard CVS/Root),)
|
||||
JANWARE_USER = $(shell sed '/^:ext/ !d; s/:ext:\([^@]\+\)@.*/\1/' CVS/Root)
|
||||
|
|
@ -120,12 +106,19 @@ EDITOR ?= xdg-open
|
|||
GIT_SRV_ADMIN_SH = JW_BUILD_SSH_EXTRA_OPTS="$(JW_BUILD_SSH_EXTRA_OPTS)" $(GIT_SSH) $(JANWARE_USER)@git.janware.com /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.janware.com /opt/jw-build/bin/cvs-admin.sh
|
||||
|
||||
# ------------ projects to be built
|
||||
|
||||
TARGET_PROJECTS = $(filter-out $(EXCLUDE_FROM_BUILD),$(PROJECTS))
|
||||
BUILD_PROJECTS = $(shell $(PROJECTS_PY_BUILD) --build-order all $(TARGET_PROJECTS))
|
||||
GIT_PROJECTS = $(patsubst %/,%,$(dir $(wildcard $(addsuffix /.git,$(BUILD_PROJECTS)))))
|
||||
CVS_PROJECTS = $(patsubst %/,%,$(dir $(wildcard $(addsuffix /CVS,$(BUILD_PROJECTS)))))
|
||||
|
||||
# ------------ targets
|
||||
|
||||
# --- mandatory targets
|
||||
|
||||
all: $(filter-out $(UNAVAILABLE_TARGETS),pull.done links.done)
|
||||
$(PROJECTS_PY_BUILD) $@ $(BUILD_PROJECTS)
|
||||
$(PROJECTS_PY_BUILD) $@ $(TARGET_PROJECTS)
|
||||
clean: clean-dirs done.clean
|
||||
distclean: clean-all-dirs done.clean
|
||||
install:
|
||||
|
|
@ -153,18 +146,18 @@ status: $(SSH_WRAPPER_SH)
|
|||
$(PGIT) -uno status
|
||||
|
||||
build-order-%: $(filter-out $(UNAVAILABLE_TARGETS),pull.done)
|
||||
$(PROJECTS_PY_BUILD) --build-order $* $(BUILD_PROJECTS) | sed 's/ */\n/g'
|
||||
$(PROJECTS_PY_BUILD) --build-order $* $(TARGET_PROJECTS) | sed 's/ */\n/g'
|
||||
|
||||
build-order: build-order-all
|
||||
|
||||
echo-prereq-build:
|
||||
@$(PROJECTS_PY) requires-pkg --skip-excluded --flavours "build" $(BUILD_PROJECTS)
|
||||
@$(PROJECTS_PY) requires-pkg --skip-excluded --flavours "build" $(TARGET_PROJECTS)
|
||||
|
||||
echo-prereq-install:
|
||||
@$(PROJECTS_PY) requires-pkg --skip-excluded --flavours "build run" $(BUILD_PROJECTS)
|
||||
@$(PROJECTS_PY) requires-pkg --skip-excluded --flavours "build run" $(TARGET_PROJECTS)
|
||||
|
||||
echo-prereq-release:
|
||||
@$(PROJECTS_PY) requires-pkg --skip-excluded --flavours "build run release" $(BUILD_PROJECTS)
|
||||
@$(PROJECTS_PY) requires-pkg --skip-excluded --flavours "build run release" $(TARGET_PROJECTS)
|
||||
echo-os:
|
||||
@$(GET_OS_SH)
|
||||
|
||||
|
|
@ -186,27 +179,21 @@ clean.text-files-cache:
|
|||
$(TEXT_FILES_CACHE):
|
||||
@make text-files-update
|
||||
text-files-update:
|
||||
@make --no-print-directory list-files | xargs file -N | grep ":.*text" | cut -d: -f1 > $(TEXT_FILES_CACHE).tmp
|
||||
@make -s --no-print-directory list-files | xargs file -N | grep ":.*text" | cut -d: -f1 > $(TEXT_FILES_CACHE).tmp
|
||||
mv $(TEXT_FILES_CACHE).tmp $(TEXT_FILES_CACHE)
|
||||
text-files-update-all:
|
||||
@PROJECTS_TXT= make text-files-update
|
||||
text-files-list list-text-files: | $(TEXT_FILES_CACHE)
|
||||
@cat $(TEXT_FILES_CACHE)
|
||||
|
||||
loc-all:
|
||||
@make --no-print-directory list-text-files | \
|
||||
grep -v "iow-standalone\|jux3\|ntv2/contrib\|\.dia$$\|\.dat\$$\|bootsrap\.css\|mpegplayer/contrib\|gitweb.cgi" | \
|
||||
xargs wc -l
|
||||
|
||||
find-code-files:
|
||||
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"
|
||||
cloc:
|
||||
for p in $(GIT_PROJECTS); do \
|
||||
git -C $$p submodule status | sed "s|^ *\([^ ]\+\) \+\([^ ]\+\) *.*|$$p/\2|" ;\
|
||||
done > cloc-ignore.txt
|
||||
for p in $(foreach s,dist include bin lib,$(addsuffix /$s,$(BUILD_PROJECTS))); do \
|
||||
echo $$p >> cloc-ignore.txt ;\
|
||||
done
|
||||
cloc --exclude-list-file=cloc-ignore.txt $(BUILD_PROJECTS)
|
||||
|
||||
# --- package-related targets
|
||||
|
||||
|
|
@ -214,10 +201,10 @@ pkg-manager-refresh:
|
|||
$(PKG_MANAGER_SH) refresh -y
|
||||
|
||||
pkg-install-prereq-build:
|
||||
$(PKG_MANAGER_SH) install -y $(BASE_PACKAGES) $(shell $(PROJECTS_PY) requires-pkg --skip-excluded --flavours "build" $(BUILD_PROJECTS))
|
||||
$(PKG_MANAGER_SH) install -y $(PREREQ_BASE) $(shell $(PROJECTS_PY) requires-pkg --skip-excluded --flavours "build" $(TARGET_PROJECTS))
|
||||
|
||||
pkg-install-prereq-release:
|
||||
$(PKG_MANAGER_SH) install -y $(BASE_PACKAGES) $(shell $(PROJECTS_PY) requires-pkg --skip-excluded --flavours "build run release" $(BUILD_PROJECTS))
|
||||
$(PKG_MANAGER_SH) install -y $(PREREQ_BASE) $(shell $(PROJECTS_PY) requires-pkg --skip-excluded --flavours "build run release" $(TARGET_PROJECTS))
|
||||
|
||||
pkg-exclude-built-today:
|
||||
touch $(EXCLUDES_FILE)
|
||||
|
|
@ -247,7 +234,7 @@ pkg-init-%:
|
|||
$(CREATE_PROJECT_SH) $*
|
||||
|
||||
pkg-%: $(filter-out $(UNAVAILABLE_TARGETS),pull.done)
|
||||
$(PROJECTS_PY_BUILD) $@ $(BUILD_PROJECTS)
|
||||
$(PROJECTS_PY_BUILD) $@ $(TARGET_PROJECTS)
|
||||
|
||||
# --- generic cleanup targets
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue