Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

build system:

 * introduce include/make dir and move some make-macros to it
 * eliminate some code clones (_comma,_space)
 * other minor changes like "export VARIABLE=value" instead of "VARIABLE=value; export VARIABLE"
 * refs #1092


git-svn-id: file:///var/svn/freetz/trunk@9440 149334a1-2f27-0410-a3b9-fc62619ac1e6
  • Loading branch information...
commit 30119af454dc2f59d0c28a973c2ba3ef6bee5b3b 1 parent 010c83c
er13 authored
24 Makefile
View
@@ -19,7 +19,7 @@ SHELL:=/bin/bash
IMAGE:=
LOCALIP:=
RECOVER:=
-FREETZ_BASE_DIR:=$(shell pwd)
+export FREETZ_BASE_DIR:=$(shell pwd)
ADDON_DIR:=addon
BUILD_DIR:=build
DL_DIR:=dl
@@ -31,7 +31,7 @@ SOURCE_DIR_ROOT:=source
TOOLCHAIN_DIR:=toolchain
TOOLS_DIR:=tools
DL_FW_DIR:=$(DL_DIR)/fw
-FW_IMAGES_DIR:=images
+export FW_IMAGES_DIR:=images
MIRROR_DIR:=$(DL_DIR)/mirror
TOOLCHAIN_BUILD_DIR:=$(TOOLCHAIN_DIR)/$(BUILD_DIR)
@@ -54,13 +54,7 @@ CHECK_PREREQ_TOOL:=$(TOOLS_DIR)/check_prerequisites
CHECK_BUILD_DIR_VERSION:=
CHECK_UCLIBC_VERSION:=$(TOOLS_DIR)/check_uclibc
-_comma:= ,
-_empty:=
-_space:=$(_empty) $(_empty)
-
-export FW_IMAGES_DIR
-export FREETZ_BASE_DIR
-
+include $(sort $(wildcard include/make/*.mk))
# Use echo -e "$(_Y)message$(_N)" if you want to print a yellow message
IS_TTY=$(shell tty -s && echo 1 || echo 0)
@@ -71,7 +65,6 @@ __Y:=\033[33m
_N:=\\033[m
__N:=\033[m
endif
-
export __Y
export __N
@@ -84,11 +77,6 @@ define ERROR
printf "\n$(_Y)%s$(_N)\n" "ERROR: $(2)"; exit $(1);
endef
-# strip quotes and then whitespaces
-define qstrip
-$(strip $(subst ",,$(1)))
-endef
-
# check for proper make version
ifneq ($(filter 3.7% 3.80,$(MAKE_VERSION)),)
$(error Your make ($(MAKE_VERSION)) is too old. Go get at least 3.81)
@@ -506,10 +494,10 @@ common-distclean: common-dirclean $(if $(FREETZ_HAVE_DOT_CONFIG),kernel-distclea
$(RM) -r $(SOURCE_DIR_ROOT)
$(RM) -r $(TOOLCHAIN_BUILD_DIR)
$(RM) -r $(TOOLS_BUILD_DIR)
- @echo "Use 'make download-clean' to remove the download directory"
+ @echo "Use 'make download-clean' to remove the download directory"
-download-clean:
- $(RM) -r $(DL_DIR)
+download-clean:
+ $(RM) -r $(DL_DIR)
dist: distclean download-clean
version="$$(cat .version)"; \
4 include/make/010-special-characters-symbolic-names.mk
View
@@ -0,0 +1,4 @@
+_comma:=,
+_empty:=
+_space:=$(empty) $(empty)
+_hash:=\#
42 include/make/020-helper-functions.mk
View
@@ -0,0 +1,42 @@
+#
+# $1 - some string possibly quoted with double quotes
+#
+# returns:
+# double-quote and whitespace stripped version of $(1)
+#
+define qstrip
+$(strip $(subst ",,$(1)))
+endef
+
+
+#
+# $1 - some string representing a version of some package
+# $2 (optional) - number of version components to be included, default 2
+#
+# returns:
+# major version of the package, i.e. x.y for x.y.z
+#
+define GET_MAJOR_VERSION
+$(strip $(subst $(_space),.,$(wordlist 1,$(if $(2),$(2),2),$(subst .,$(_space),$(1)))))
+endef
+
+
+# SUBST_MAP
+# Substitute according to map src:dst
+# $1 - some string
+# $2 - list of src:dst pairs
+SUBST_MAP = $(strip \
+ $(eval __tmp := $1) \
+ $(foreach s,$2, \
+ $(eval __tmp := $(subst $(word 1,$(subst :, ,$s)),$(word 2,$(subst :, ,$s)),$(__tmp)))) \
+ $(__tmp))
+SUBST_MAP_TOLOWER := A:a B:b C:c D:d E:e F:f G:g H:h I:i J:j K:k L:l M:m N:n O:o P:p Q:q R:r S:s T:t U:u V:v W:w X:x Y:y Z:z
+SUBST_MAP_TOUPPER := a:A b:B c:C d:D e:E f:F g:G h:H i:I j:J k:K l:L m:M n:N o:O p:P q:Q r:R s:S t:T u:U v:V w:W x:X y:Y z:Z
+SUBST_MAP_NAME := -:_
+SUBST_MAP_TOUPPER_NAME := $(SUBST_MAP_TOUPPER) $(SUBST_MAP_NAME)
+SUBST_MAP_TOLOWER_NAME := $(SUBST_MAP_TOLOWER) $(SUBST_MAP_NAME)
+
+# TOUPPER_NAME
+# Convert letters to uppercase, minus to underline
+# $1 = string to convert
+TOUPPER_NAME = $(call SUBST_MAP,$1,$(SUBST_MAP_TOUPPER_NAME))
25 make/Makefile.in
View
@@ -91,7 +91,7 @@ FREETZ_LD_RUN_PATH:=LD_RUN_PATH="$(FREETZ_LIBRARY_PATH)"
# commands to run before calling configure
# each command has to be terminated by ';'
TARGET_CONFIGURE_PRE_CMDS:=
-TARGET_CONFIGURE_PRE_CMDS += $(RM) config.{cache,status} ;
+TARGET_CONFIGURE_PRE_CMDS += $(RM) config.{cache,status};
# setup environment for configure
TARGET_CONFIGURE_ENV:=
@@ -167,26 +167,6 @@ endif
# macro names containing _INT are for internal use only and should not be called outside of this file
# For details of the required targets, see the documentation in README.Makefiles
-# SUBST_MAP
-# Substitute according to map src:dst
-# $(1) - String
-# $(2) - List of src:dst pairs
-SUBST_MAP = $(strip \
- $(eval __tmp := $1) \
- $(foreach s,$2, \
- $(eval __tmp := $(subst $(word 1,$(subst :, ,$s)),$(word 2,$(subst :, ,$s)),$(__tmp)))) \
- $(__tmp))
-SUBST_MAP_TOLOWER := A:a B:b C:c D:d E:e F:f G:g H:h I:i J:j K:k L:l M:m N:n O:o P:p Q:q R:r S:s T:t U:u V:v W:w X:x Y:y Z:z
-SUBST_MAP_TOUPPER := a:A b:B c:C d:D e:E f:F g:G h:H i:I j:J k:K l:L m:M n:N o:O p:P q:Q r:R s:S t:T u:U v:V w:W x:X y:Y z:Z
-SUBST_MAP_NAME := -:_
-SUBST_MAP_TOUPPER_NAME := $(SUBST_MAP_TOUPPER) $(SUBST_MAP_NAME)
-SUBST_MAP_TOLOWER_NAME := $(SUBST_MAP_TOLOWER) $(SUBST_MAP_NAME)
-
-# TOUPPER_NAME
-# Convert letters to uppercase, minus to underline
-# $(1) = name to convert
-TOUPPER_NAME = $(call SUBST_MAP,$1,$(SUBST_MAP_TOUPPER_NAME))
-
define SELECTED_SUBOPTIONS__INT
$(strip \
$(foreach suboption, $(1), \
@@ -753,10 +733,9 @@ endef
define PKG_UNPACKED_CHECK_SUBOPTS__INT1
$(PKG)_FREETZ_CONFIG_FILE:=$(FREETZ_BASE_DIR)/$(SOURCE_DIR)/.$(pkg)_config
endef
-_HASH_SIGN:=\#
define PKG_UNPACKED_CHECK_SUBOPTS__INT2
$($(PKG)_FREETZ_CONFIG_FILE): $(TOPDIR)/.config
- @($(foreach OPT,$($(PKG)_REBUILD_SUBOPTS),echo "$(if $($(OPT)),$(OPT)=$($(OPT)),$(_HASH_SIGN) $(OPT) is not set)";):) > $($(PKG)_FREETZ_CONFIG_FILE).temp
+ @($(foreach OPT,$($(PKG)_REBUILD_SUBOPTS),echo "$(if $($(OPT)),$(OPT)=$($(OPT)),$(_hash) $(OPT) is not set)";):) > $($(PKG)_FREETZ_CONFIG_FILE).temp
@if ! diff -q $($(PKG)_FREETZ_CONFIG_FILE).temp $($(PKG)_FREETZ_CONFIG_FILE) 2> /dev/null $(SILENT); then \
mv $($(PKG)_FREETZ_CONFIG_FILE).temp $($(PKG)_FREETZ_CONFIG_FILE); \
$($(PKG)_CLEAN_TARGET_DIR__INT) \
6 make/linux/kernel.mk
View
@@ -1,6 +1,4 @@
-comma:=,
-space:=$(empty) $(empty)
-AVM_SOURCE:=$(call qstrip,$(subst $(space),\ ,$(FREETZ_DL_KERNEL_SOURCE)))
+AVM_SOURCE:=$(call qstrip,$(subst $(_space),\ ,$(FREETZ_DL_KERNEL_SOURCE)))
AVM_KERNEL_VERSION:=$(subst .,\.,$(KERNEL_VERSION))
AVM_UNPACK__INT_.gz:=z
@@ -143,7 +141,7 @@ $(KERNEL_DIR)/.prepared: $(KERNEL_DIR)/.configured
$(KERNEL_HEADERS_DEVEL_DIR)/include/linux/version.h: $(KERNEL_DIR)/.prepared
ifeq ($(strip $(FREETZ_KERNEL_VERSION_2_6_13)),y)
- $(call COPY_KERNEL_HEADERS,$(KERNEL_BUILD_ROOT_DIR),$(KERNEL_HEADERS_DEVEL_DIR),{asm$(comma)asm-generic$(comma)linux$(comma)mtd$(comma)scsi$(comma)video})
+ $(call COPY_KERNEL_HEADERS,$(KERNEL_BUILD_ROOT_DIR),$(KERNEL_HEADERS_DEVEL_DIR),{asm$(_comma)asm-generic$(_comma)linux$(_comma)mtd$(_comma)scsi$(_comma)video})
else
$(SUBMAKE) -C $(KERNEL_BUILD_ROOT_DIR) \
CROSS_COMPILE="$(KERNEL_CROSS)" \
4 toolchain/make/Makefile.in
View
@@ -7,10 +7,6 @@ REAL_GNU_KERNEL_NAME:=$(TARGET_ARCH)-unknown-linux-gnu
GNU_TARGET_NAME:=$(TARGET_ARCH)-linux
REAL_GNU_TARGET_NAME:=$(GNU_TARGET_NAME)-uclibc
-define GET_MAJOR_VERSION
-$(strip $(subst $(_space),.,$(wordlist 1,$(if $(2),$(2),2),$(subst .,$(_space),$(1)))))
-endef
-
KERNEL_TOOLCHAIN_GCC_VERSION:=$(call qstrip,$(FREETZ_KERNEL_GCC_VERSION))
KERNEL_TOOLCHAIN_GCC_MAJOR_VERSION:=$(call GET_MAJOR_VERSION,$(KERNEL_TOOLCHAIN_GCC_VERSION))
KERNEL_TOOLCHAIN_BINUTILS_VERSION:=$(call qstrip,$(FREETZ_KERNEL_BINUTILS_VERSION))
Please sign in to comment.
Something went wrong with that request. Please try again.