diff --git a/Makefile b/Makefile index d8c2bdbb..8fc21cae 100755 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ include make/environment-target.mk include make/environment-update.mk printenv: - @make line + $(call draw_line); @echo "Build Environment Varibles:" @echo "CROSS_DIR: $(CROSS_DIR)" @echo "TARGET: $(TARGET)" @@ -38,7 +38,7 @@ printenv: @echo "BOXTYPE: $(BOXTYPE)" @echo "BOXSERIES: $(BOXSERIES)" @echo "BOXMODEL: $(BOXMODEL)" - @make line + $(call draw_line); @echo "" @echo "'make help' lists useful targets." @echo "" @@ -64,7 +64,7 @@ printenv: fi help: - @make line + $(call draw_line); @echo "A few helpful make targets:" @echo " * make preqs - Downloads necessary stuff" @echo " * make crosstool - Build cross toolchain" @@ -81,7 +81,7 @@ help: @echo "Total renew:" @echo " * make all-clean - Reset buildsystem to delivery state" @echo " but doesn't touch your local stuff" - @make line + $(call draw_line); # ----------------------------------------------------------------------------- @@ -120,14 +120,10 @@ include make/ni.mk all: @echo "'make all' is not a valid target. Please read the documentation." -line: - @for i in $$(seq 1 1 $$(tput cols)); do printf -; done - @echo - done: - @make line + $(call draw_line); @echo -e "$(TERM_GREEN)Done$(TERM_NORMAL)" - @make line + $(call draw_line); # target for testing only. not useful otherwise everything: $(shell sed -n 's/^\$$.D.\/\(.*\):.*/\1/p' make/*.mk) @@ -140,6 +136,38 @@ PHONY += printenv help done all everything PHONY += .print-phony .PHONY: $(PHONY) +# +# $(1) = title +# $(2) = color +# 0 - Black +# 1 - Red +# 2 - Green +# 3 - Yellow +# 4 - Blue +# 5 - Magenta +# 6 - Cyan +# 7 - White +# $(3) = left|center|right +# +define draw_line + @ \ + printf '%.0s-' {1..$(shell tput cols)}; \ + if test "$(1)"; then \ + cols=$(shell tput cols); \ + length=$(shell echo $(1) | awk '{print length}'); \ + case "$(3)" in \ + *right) let indent="length + 1" ;; \ + *center) let indent="cols - (cols - length) / 2" ;; \ + *left|*) let indent="cols" ;; \ + esac; \ + tput cub $$indent; \ + test "$(2)" && printf $$(tput setaf $(2)); \ + printf '$(1)'; \ + test "$(2)" && printf $$(tput sgr0); \ + fi; \ + echo +endef + # this makes sure we do not build top-level dependencies in parallel # (which would not be too helpful anyway, running many configure and # downloads in parallel...), but the sub-targets are still built in diff --git a/make/bootstrap.mk b/make/bootstrap.mk index d83a03c9..25443fb4 100644 --- a/make/bootstrap.mk +++ b/make/bootstrap.mk @@ -23,9 +23,9 @@ endif bootstrap: $(BOOTSTRAP) @touch $(BUILD_TMP)/.$(BOXTYPE)-$(BOXMODEL) - @make line + $(call draw_line); @echo -e "$(TERM_YELLOW)Bootstrapped for $(shell echo $(BOXTYPE) | sed 's/.*/\u&/') $(BOXMODEL)$(TERM_NORMAL)" - @make line + $(call draw_line); skeleton: | $(TARGET_DIR) cp --remove-destination -a $(SKEL_ROOT)/* $(TARGET_DIR)/ @@ -62,9 +62,9 @@ ifeq ($(BOXSERIES), hd2) endif $(TARGET_DIR): - @make line + $(call draw_line); @echo "TARGET_DIR does not exist. You probably need to run 'make bootstrap'" - @make line + $(call draw_line); @false $(D) \ diff --git a/make/crosstool.mk b/make/crosstool.mk index 1362c55c..f60f89b3 100644 --- a/make/crosstool.mk +++ b/make/crosstool.mk @@ -15,9 +15,9 @@ crosstools: CROSSTOOL_BACKUP = $(ARCHIVE)/crosstool-$(BOXARCH)-$(BOXSERIES)-backup.tar.gz $(CROSSTOOL_BACKUP): - @make line + $(call draw_line); @echo "CROSSTOOL_BACKUP does not exist. You probably need to run 'make crosstool-backup' first." - @make line + $(call draw_line); @false crosstool-backup: @@ -135,11 +135,11 @@ crosstool-arm-hd51: CROSS_DIR-check CROSS_DIR-check: ifneq ($(wildcard $(CROSS_DIR)),) - @make line + $(call draw_line); @echo "Crosstool directory already present." @echo @echo "You need to run 'make cross-clean' first if you really want to build a new crosstool." - @make line + $(call draw_line); @false endif diff --git a/make/prerequisites.mk b/make/prerequisites.mk index dc837474..25b4c27c 100644 --- a/make/prerequisites.mk +++ b/make/prerequisites.mk @@ -52,17 +52,17 @@ bashcheck: preqs: download ni-sources $(CCACHE): - @make line + $(call draw_line); @echo "ccache package on host missing." - @make line + $(call draw_line); @false download: - @make line + $(call draw_line); @echo "Download directory missing." @echo @echo "You need to make a directory named 'download' by executing 'mkdir download' or create a symlink to the directory where you keep your sources, e.g. by typing 'ln -s /path/to/my/Archive download'." - @make line + $(call draw_line); @false # ----------------------------------------------------------------------------- diff --git a/make/rootfs.mk b/make/rootfs.mk index 1a0a1a62..2b7c4bd3 100644 --- a/make/rootfs.mk +++ b/make/rootfs.mk @@ -65,9 +65,9 @@ rootfs-cleanup: $(ROOTFS) # strip bins and libs in root filesystem rootfs-strip: $(ROOTFS) ifneq ($(DEBUG), yes) - @make line + $(call draw_line); @echo "The following warnings from strip are harmless!" - @make line + $(call draw_line); find $(ROOTFS)/bin -type f -print0 | xargs -0 $(TARGET)-strip || true find $(ROOTFS)/sbin -type f -print0 | xargs -0 $(TARGET)-strip || true find $(ROOTFS)/lib \( \ @@ -131,7 +131,7 @@ endif get-update-info: get-update-info-$(BOXSERIES) get-update-info-hd2: - @make line + $(call draw_line); @echo "Get update info for model $(shell echo $(BOXMODEL) | sed 's/.*/\u&/')" @echo @cd $(SOURCE_DIR)/$(NI_DRIVERS-BIN)/$(DRIVERS_DIR); \ @@ -146,10 +146,10 @@ get-update-info-hd2: dd if=./vmlinux.ub.gz bs=1 skip=$$(LC_ALL=C grep -a -b -o $$'\x1f\x8b\x08\x00\x00\x00\x00\x00' ./vmlinux.ub.gz \ | cut -d ':' -f 1) | zcat | grep -a "Linux version"; \ ); - @make line + $(call draw_line); get-update-info-hd1: - @make line + $(call draw_line); @echo "Get update info for model $(shell echo $(BOXMODEL) | sed 's/.*/\u&/')" @echo @cd $(TARGET_DIR)/var/update; \ @@ -157,7 +157,7 @@ get-update-info-hd1: dd if=./zImage bs=1 skip=$$(LC_ALL=C grep -a -b -o $$'\x1f\x8b\x08\x00\x00\x00\x00\x00' ./zImage \ | cut -d ':' -f 1) | zcat | grep -a "Linux version"; \ ); - @make line + $(call draw_line); # -----------------------------------------------------------------------------