diff --git a/Makefile b/Makefile index 4f7f506e..3b199451 100755 --- a/Makefile +++ b/Makefile @@ -3,13 +3,42 @@ # # ----------------------------------------------------------------------------- +MAINTAINER := $(shell whoami) UID := $(shell id -u) ifeq ($(UID),0) warn: - @echo "You are running as root. Don't do this, it's dangerous." - @echo "Refusing to build. Good bye." + @echo "You are running as root. Do not do this, it is dangerous." + @echo "Aborting the build. Log in as a regular user and retry." else +# Delete default rules. We don't use them. This saves a bit of time. +.SUFFIXES: + +# we want bash as shell +SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ + else if [ -x /bin/bash ]; then echo /bin/bash; \ + else echo sh; fi; fi) + +# Include some helper macros and variables +include support/misc/utils.mk + +# bash prints the name of the directory on 'cd ' if CDPATH is +# set, so unset it here to not cause problems. Notice that the export +# line doesn't affect the environment of $(shell ..) calls. +export CDPATH := + +# Disable top-level parallel build if per-package directories is not +# used. Indeed, per-package directories is necessary to guarantee +# determinism and reproducibility with top-level parallel build. +.NOTPARALLEL: + +# kconfig uses CONFIG_SHELL +CONFIG_SHELL := $(SHELL) + +export SHELL CONFIG_SHELL + +# ----------------------------------------------------------------------------- + # first target is default ... default: all @@ -81,7 +110,6 @@ Makefile.local: @cp Makefile.example $@ -include config.local -include make/buildsystem-utils.mk include make/environment-box.mk include make/environment-linux.mk include make/environment-build.mk diff --git a/make/buildsystem-helpers.mk b/make/buildsystem-helpers.mk index cfaf4a47..0e19e6bf 100644 --- a/make/buildsystem-helpers.mk +++ b/make/buildsystem-helpers.mk @@ -34,10 +34,10 @@ define INSTALL_EXIST # (source, dest) fi endef -GET-GIT-ARCHIVE = $(HELPERS_DIR)/get-git-archive.sh -GET-GIT-SOURCE = $(HELPERS_DIR)/get-git-source.sh -GET-SVN-SOURCE = $(HELPERS_DIR)/get-svn-source.sh -UPDATE-RC.D = $(HELPERS_DIR)/update-rc.d -r $(TARGET_DIR) +GET-GIT-ARCHIVE = support/scripts/get-git-archive.sh +GET-GIT-SOURCE = support/scripts/get-git-source.sh +GET-SVN-SOURCE = support/scripts/get-svn-source.sh +UPDATE-RC.D = support/scripts/update-rc.d -r $(TARGET_DIR) # ----------------------------------------------------------------------------- # execute local scripts diff --git a/make/environment-build.mk b/make/environment-build.mk index 39fbb780..2d1cb29c 100644 --- a/make/environment-build.mk +++ b/make/environment-build.mk @@ -6,8 +6,6 @@ LD_LIBRARY_PATH = export LD_LIBRARY_PATH -SHELL := /bin/bash - # ----------------------------------------------------------------------------- ifndef MAKE @@ -116,7 +114,6 @@ LOCAL_DIR = $(BASE_DIR)/local STAGING_DIR = $(BASE_DIR)/staging IMAGE_DIR = $(STAGING_DIR)/images UPDATE_DIR = $(STAGING_DIR)/updates -HELPERS_DIR = $(BASE_DIR)/helpers CROSS_BASE = $(BASE_DIR)/cross CROSS_DIR ?= $(CROSS_BASE)/$(TARGET_ARCH)-linux-$(KERNEL_VER) STATIC_BASE = $(BASE_DIR)/static diff --git a/make/target-scripts.mk b/make/target-scripts.mk index 90e8cc6d..4b868db7 100644 --- a/make/target-scripts.mk +++ b/make/target-scripts.mk @@ -178,7 +178,7 @@ $(TARGET_sbindir)/service: $(INSTALL_EXEC) -D $(TARGET_FILES)/scripts/service $(@) $(TARGET_sbindir)/update-rc.d: - $(INSTALL_EXEC) -D $(HELPERS_DIR)/update-rc.d $(@) + $(INSTALL_EXEC) -D support/scripts/update-rc.d $(@) $(TARGET_datadir)/udhcpc/default.script: $(INSTALL_EXEC) -D $(TARGET_FILES)/scripts/udhcpc-default.script $(@) diff --git a/make/buildsystem-utils.mk b/support/misc/utils.mk similarity index 100% rename from make/buildsystem-utils.mk rename to support/misc/utils.mk diff --git a/helpers/get-git-archive.sh b/support/scripts/get-git-archive.sh similarity index 100% rename from helpers/get-git-archive.sh rename to support/scripts/get-git-archive.sh diff --git a/helpers/get-git-source.sh b/support/scripts/get-git-source.sh similarity index 100% rename from helpers/get-git-source.sh rename to support/scripts/get-git-source.sh diff --git a/helpers/get-svn-source.sh b/support/scripts/get-svn-source.sh similarity index 100% rename from helpers/get-svn-source.sh rename to support/scripts/get-svn-source.sh diff --git a/helpers/update-rc.d b/support/scripts/update-rc.d similarity index 100% rename from helpers/update-rc.d rename to support/scripts/update-rc.d