summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
Diffstat (limited to 'mk')
-rw-r--r--mk/build.mk2
-rw-r--r--mk/kernel-vars.mk10
-rw-r--r--mk/package.mk60
-rw-r--r--mk/vars.mk94
4 files changed, 80 insertions, 86 deletions
diff --git a/mk/build.mk b/mk/build.mk
index 43f209923..8ac41f3a5 100644
--- a/mk/build.mk
+++ b/mk/build.mk
@@ -252,7 +252,7 @@ ifeq ($(filter-out distclean,${MAKECMDGOALS}),)
include ${TOPDIR}/mk/vars.mk
else
include $(TOPDIR)/prereq.mk
-export BASH HOSTCC HOSTCFLAGS HOSTCXX HOSTCXXFLAGS MAKE LANGUAGE LC_ALL OStype PATH
+export BASH MAKE LANGUAGE LC_ALL OStype PATH CC_FOR_BUILD
endif
all: menuconfig
diff --git a/mk/kernel-vars.mk b/mk/kernel-vars.mk
index f66b238e0..e730f561d 100644
--- a/mk/kernel-vars.mk
+++ b/mk/kernel-vars.mk
@@ -4,12 +4,6 @@
KERNEL_MAKE_OPTS:= -C "${LINUX_DIR}" V=1
ifneq ($(ADK_NATIVE),y)
KERNEL_MAKE_OPTS+= CROSS_COMPILE="$(TARGET_CROSS)" ARCH=$(ARCH) \
- CC="$(TARGET_CC)" HOSTCC="${HOSTCC}" \
- HOSTCFLAGS='${HOSTCFLAGS}'
+ CC="$(TARGET_CC)" HOSTCC="${CC_FOR_BUILD}" \
+ HOSTCFLAGS='${CFLAGS_FOR_BUILD}'
endif
-
-ifeq (${ADK_TARGET_SYSTEM_LINKSYS_WRT54G},y)
-ADK_KCPPFLAGS+= -DBCM47XX_OVERRIDE_FLASHSIZE=0x400000
-endif
-
-KERNEL_MAKE_ENV+= KCPPFLAGS='${ADK_KCPPFLAGS}'
diff --git a/mk/package.mk b/mk/package.mk
index bacee71f4..eded9c226 100644
--- a/mk/package.mk
+++ b/mk/package.mk
@@ -7,32 +7,6 @@ ifeq ($(ADK_HOST_CYGWIN),y)
EXEEXT:= .exe
endif
-TCFLAGS:= ${TARGET_CFLAGS}
-TCXXFLAGS:= ${TARGET_CFLAGS}
-TCPPFLAGS:= ${TARGET_CPPFLAGS}
-TLDFLAGS:= ${TARGET_LDFLAGS} -Wl,-rpath -Wl,/usr/lib \
- -Wl,-rpath-link -Wl,${STAGING_TARGET_DIR}/usr/lib \
- -L${STAGING_TARGET_DIR}/lib -L${STAGING_TARGET_DIR}/usr/lib
-ifeq ($(ADK_STATIC),y)
-TCFLAGS:= ${TARGET_CFLAGS} -static
-TCXXFLAGS:= ${TARGET_CFLAGS} -static
-TCPPFLAGS:= ${TARGET_CPPFLAGS} -static
-TLDFLAGS:= ${TARGET_LDFLAGS} -Wl,-rpath -Wl,/usr/lib \
- -Wl,-rpath-link -Wl,${STAGING_TARGET_DIR}/usr/lib \
- -L${STAGING_TARGET_DIR}/lib -L${STAGING_TARGET_DIR}/usr/lib \
- -static
-endif
-ifeq ($(ADK_NATIVE),y)
-TCFLAGS:= $(TARGET_CFLAGS_ARCH) $(TARGET_DEBUGGING) -fwrapv
-TCXXFLAGS:=
-TCPPFLAGS:=
-TLDFLAGS:=
-endif
-
-ifeq ($(ADK_DEBUG),)
-TCPPFLAGS+= -DNDEBUG
-endif
-
# does not change CONFIGURE_ARGS in minimal mode
ifeq ($(filter minimal,${CONFIG_STYLE}),)
ifneq ($(ADK_DEBUG),)
@@ -42,10 +16,10 @@ endif
CONFIGURE_ENV+= GCC_HONOUR_COPTS=s \
CONFIG_SHELL='$(strip ${SHELL})' \
- CFLAGS='$(strip ${TCFLAGS})' \
- CXXFLAGS='$(strip ${TCXXFLAGS})' \
- CPPFLAGS='$(strip ${TCPPFLAGS})' \
- LDFLAGS='$(strip ${TLDFLAGS})' \
+ CFLAGS='$(strip ${TARGET_CFLAGS})' \
+ CXXFLAGS='$(strip ${TARGET_CXXFLAGS})' \
+ CPPFLAGS='$(strip ${TARGET_CPPFLAGS})' \
+ LDFLAGS='$(strip ${TARGET_LDFLAGS})' \
PKG_CONFIG_LIBDIR='${STAGING_TARGET_DIR}/usr/lib/pkgconfig'
ifeq ($(ADK_NATIVE),)
CONFIGURE_ENV+= ${TARGET_CONFIGURE_OPTS} \
@@ -67,26 +41,16 @@ FAKE_FLAGS?=
ALL_TARGET?= all
INSTALL_TARGET?= install
-MAKE_ENV+= WRKDIR='${WRKDIR}' WRKDIST='${WRKDIST}' \
+MAKE_ENV+= GCC_HONOUR_COPTS=2 \
+ WRKDIR='${WRKDIR}' WRKDIST='${WRKDIST}' \
WRKSRC='${WRKSRC}' WRKBUILD='${WRKBUILD}' \
- CFLAGS='$(strip ${TCFLAGS})' \
- CXXFLAGS='$(strip ${TCXXFLAGS})' \
- CPPFLAGS='$(strip ${TCPPFLAGS})' \
- LDFLAGS='$(strip ${TLDFLAGS})'
-MAKE_ENV+= PKG_CONFIG_LIBDIR='${STAGING_TARGET_DIR}/usr/lib/pkgconfig'
+ CFLAGS='$(strip ${TARGET_CFLAGS})' \
+ CXXFLAGS='$(strip ${TARGET_CXXFLAGS})' \
+ CPPFLAGS='$(strip ${TARGET_CPPFLAGS})' \
+ LDFLAGS='$(strip ${TARGET_LDFLAGS})' \
+ PKG_CONFIG_LIBDIR='${STAGING_TARGET_DIR}/usr/lib/pkgconfig'
ifeq ($(ADK_NATIVE),)
-MAKE_ENV+= PATH='${TARGET_PATH}' \
- ${HOST_CONFIGURE_OPTS} \
- CC='${TARGET_CC}' \
- CXX='${TARGET_CXX}' \
- LD='${TARGET_LD}' \
- AR='${TARGET_CROSS}ar' \
- RANLIB='${TARGET_CROSS}ranlib' \
- NM='${TARGET_CROSS}nm' \
- OBJCOPY='${TARGET_CROSS}objcopy' \
- RANLIB='${TARGET_CROSS}ranlib' \
- STRIP='${TARGET_CROSS}strip' \
- CROSS="$(TARGET_CROSS)"
+MAKE_ENV+= ${TARGET_CONFIGURE_OPTS} ${HOST_CONFIGURE_OPTS}
endif
MAKE_FLAGS+= ${XAKE_FLAGS} V=1
diff --git a/mk/vars.mk b/mk/vars.mk
index ab247901f..1bc167e52 100644
--- a/mk/vars.mk
+++ b/mk/vars.mk
@@ -10,24 +10,6 @@ MAKEFLAGS= $(EXTRA_MAKEFLAGS)
BUILD_USER= $(shell id -un)
BUILD_GROUP= $(shell id -gn)
-# target compiler settings
-TARGET_CPPFLAGS+= -I${STAGING_TARGET_DIR}/usr/include
-TARGET_LDFLAGS+= -Wl,-O2
-ifneq ($(ADK_DEBUG),)
-TARGET_DEBUGGING:= -g3 -fno-omit-frame-pointer
-else
-TARGET_DEBUGGING:= $(TARGET_OPTIMIZATION) -fomit-frame-pointer
-endif
-TARGET_CFLAGS:= $(TARGET_CFLAGS_ARCH) $(TARGET_DEBUGGING) -fwrapv
-ifneq ($(ADK_TOOLCHAIN_GCC_USE_SSP),)
-TARGET_CFLAGS+= -fstack-protector
-TARGET_CXXFLAGS+= -fstack-protector
-TARGET_LDFLAGS+= -fstack-protector
-endif
-ifneq ($(ADK_TOOLCHAIN_GCC_USE_LTO),)
-TARGET_CFLAGS+= -flto
-TARGET_LDFLAGS+= -flto
-endif
BASE_DIR:= $(TOPDIR)
DISTDIR?= ${BASE_DIR}/dl
@@ -56,35 +38,89 @@ TARGET_PATH= ${SCRIPT_DIR}:${TOOLS_DIR}:${STAGING_HOST_DIR}/bin:${STAGING_HOST_
REAL_GNU_TARGET_NAME= $(CPU_ARCH)-$(ADK_VENDOR)-linux-$(ADK_TARGET_SUFFIX)
GNU_TARGET_NAME= $(CPU_ARCH)-$(ADK_VENDOR)-linux
ifeq ($(ADK_NATIVE),y)
-TARGET_CROSS:=
+TARGET_CROSS:=
TARGET_COMPILER_PREFIX?=
else
TARGET_CROSS:= $(STAGING_HOST_DIR)/bin/$(REAL_GNU_TARGET_NAME)-
TARGET_COMPILER_PREFIX?=${TARGET_CROSS}
endif
+
+# target compiler flags
TARGET_CC:= ${TARGET_COMPILER_PREFIX}gcc
TARGET_CXX:= ${TARGET_COMPILER_PREFIX}g++
TARGET_LD:= ${TARGET_COMPILER_PREFIX}ld
+
+TARGET_CPPFLAGS:= -I${STAGING_TARGET_DIR}/usr/include
+TARGET_CFLAGS:= $(TARGET_CFLAGS_ARCH) -fwrapv -fno-ident -fhonour-copts
+TARGET_CXXFLAGS:=
+TARGET_LDFLAGS:= -Wl,-O2 -Wl,-rpath -Wl,/usr/lib \
+ -Wl,-rpath-link -Wl,${STAGING_TARGET_DIR}/usr/lib \
+ -L${STAGING_TARGET_DIR}/lib -L${STAGING_TARGET_DIR}/usr/lib
+
+ifneq ($(ADK_STATIC),)
+TARGET_CFLAGS+= -static
+TARGET_CXXFLAGS+= -static
+TARGET_LDFLAGS+= -static
+endif
+
+ifneq ($(ADK_TOOLCHAIN_GCC_USE_SSP),)
+TARGET_CFLAGS+= -fstack-protector
+TARGET_CXXFLAGS+= -fstack-protector
+TARGET_LDFLAGS+= -fstack-protector
+endif
+
+ifneq ($(ADK_TOOLCHAIN_GCC_USE_LTO),)
+TARGET_CFLAGS+= -flto
+TARGET_LDFLAGS+= -flto
+endif
+
+ifneq ($(ADK_DEBUG),)
+TARGET_CPPFLAGS+= -DNDEBUG
+TARGET_CFLAGS+= -g3 -fno-omit-frame-pointer
+else
+TARGET_CFLAGS+= -fomit-frame-pointer $(TARGET_OPTIMIZATION)
+endif
+
+ifneq ($(ADK_NATIVE),)
+TARGET_CPPFLAGS:=
+TARGET_CFLAGS:= $(TARGET_OPTIMIZATION) $(TARGET_CFLAGS_ARCH) -fwrapv -fno-ident -fhonour-copts
+TARGET_LDFLAGS:=
+endif
+
+# host compiler flags
+CPPFLAGS_FOR_BUILD?=
+CFLAGS_FOR_BUILD?= -O2 -Wall
+CXXFLAGS_FOR_BUILD?= -O2 -Wall
+LDFLAGS_FOR_BUILD?=
+FLAGS_FOR_BUILD:= ${CPPFLAGS_FOR_BUILD} ${CFLAGS_FOR_BUILD} ${LDFLAGS_FOR_BUILD}
+
PATCH= ${BASH} $(SCRIPT_DIR)/patch.sh
SED:= sed -i -e
LINUX_DIR:= $(BUILD_DIR)/linux
LINUX_HEADER_DIR:= $(STAGING_TARGET_DIR)/linux-header
+KERNEL_MODULE_FLAGS:= ARCH=${ARCH} KERNELVERSION="2.6" \
+ KERNEL_PATH=${LINUX_DIR} KERNELDIR=${LINUX_DIR} KERNEL_DIR=${LINUX_DIR} \
+ PREFIX=/usr CROSS_COMPILE="${TARGET_CROSS}" \
+ CFLAGS_MODULE="-fhonour-copts" V=1
+
TARGET_CONFIGURE_OPTS= PATH='${TARGET_PATH}' \
- AR=$(TARGET_CROSS)ar \
- AS=$(TARGET_CROSS)as \
- LD=$(TARGET_CROSS)ld \
- NM=$(TARGET_CROSS)nm \
- RANLIB=$(TARGET_CROSS)ranlib \
+ AR='$(TARGET_CROSS)ar' \
+ AS='$(TARGET_CROSS)as' \
+ LD='$(TARGET_CROSS)ld' \
+ NM='$(TARGET_CROSS)nm' \
+ RANLIB='$(TARGET_CROSS)ranlib' \
+ STRIP='${TARGET_CROSS}strip' \
+ OBJCOPY='${TARGET_CROSS}objcopy' \
CC='$(TARGET_CC)' \
GCC='$(TARGET_CC)' \
CXX='$(TARGET_CXX)' \
CROSS='$(TARGET_CROSS)'
-HOST_CONFIGURE_OPTS= CC_FOR_BUILD='${HOSTCC}' \
- BUILD_CC='${HOSTCC}' \
- CFLAGS_FOR_BUILD='${HOSTCFLAGS}' \
- CPPFLAGS_FOR_BUILD='${HOSTCPPFLAGS}' \
- LDFLAGS_FOR_BUILD='${HOSTLDFLAGS}'
+
+HOST_CONFIGURE_OPTS= CC_FOR_BUILD='${CC_FOR_BUILD}' \
+ CPPFLAGS_FOR_BUILD='${CPPFLAGS_FOR_BUILD}' \
+ CFLAGS_FOR_BUILD='${CFLAGS_FOR_BUILD}' \
+ LDFLAGS_FOR_BUILD='${LDFLAGS_FOR_BUILD}'
PKG_SUFFIX:= $(strip $(subst ",, $(ADK_PACKAGE_SUFFIX)))