remove old trace/verbose junk
[oweals/openwrt.git] / openwrt / rules.mk
1 ifeq ($(DUMP),)
2 include $(TOPDIR)/.config
3 endif
4
5 SHELL=/bin/bash
6 export SHELL
7
8 ifeq ($(V),)
9 V=5
10 endif
11
12 CP=cp -fpR
13 MAKE1=make
14 MAKEFLAGS=-j$(CONFIG_JLEVEL) V=$(V) $(EXTRA_MAKEFLAGS)
15 # Strip off the annoying quoting
16 ARCH:=$(strip $(subst ",, $(CONFIG_ARCH)))
17 WGET:=$(strip $(subst ",, $(CONFIG_WGET)))
18 GCC_VERSION:=$(strip $(subst ",, $(CONFIG_GCC_VERSION)))
19 GCC_USE_SJLJ_EXCEPTIONS:=$(strip $(subst ",, $(CONFIG_GCC_USE_SJLJ_EXCEPTIONS)))
20 TARGET_OPTIMIZATION:=$(strip $(subst ",, $(CONFIG_TARGET_OPTIMIZATION)))
21 #"))"))"))"))")) # for vim's broken syntax highlighting :)
22
23
24 ifeq ($(CONFIG_SOFT_FLOAT),y)
25 # gcc 3.4.x soft float configuration is different than previous versions.
26 ifeq ($(findstring 3.4.,$(GCC_VERSION)),3.4.)
27 SOFT_FLOAT_CONFIG_OPTION:=--with-float=soft
28 else
29 SOFT_FLOAT_CONFIG_OPTION:=--without-float
30 endif
31 TARGET_SOFT_FLOAT:=-msoft-float
32 ARCH_FPU_SUFFIX:=_nofpu
33 else
34 SOFT_FLOAT_CONFIG_OPTION:=
35 TARGET_SOFT_FLOAT:=
36 ARCH_FPU_SUFFIX:=
37 endif
38
39
40 ifeq ($(CONFIG_TAR_VERBOSITY),y)
41 TAR_OPTIONS=-xvf
42 else
43 TAR_OPTIONS=-xf
44 endif
45
46 ifneq ($(CONFIG_LARGEFILE),y)
47 DISABLE_LARGEFILE= --disable-largefile
48 endif
49 TARGET_CFLAGS:=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)
50
51 OPTIMIZE_FOR_CPU=$(ARCH)
52 HOSTCC:=gcc
53 BASE_DIR:=$(TOPDIR)
54 DL_DIR:=$(BASE_DIR)/dl
55 BUILD_DIR:=$(BASE_DIR)/build_$(ARCH)$(ARCH_FPU_SUFFIX)
56 STAGING_DIR:=$(BASE_DIR)/staging_dir_$(ARCH)$(ARCH_FPU_SUFFIX)
57 SCRIPT_DIR:=$(BASE_DIR)/scripts
58 BIN_DIR:=$(BASE_DIR)/bin
59 STAMP_DIR:=$(BUILD_DIR)/stamp
60 PACKAGE_DIR:=$(BIN_DIR)/packages
61 STAMP_DIR:=$(BUILD_DIR)/stamp
62 TARGET_DIR:=$(BUILD_DIR)/root
63 TOOL_BUILD_DIR=$(BASE_DIR)/toolchain_build_$(ARCH)$(ARCH_FPU_SUFFIX)
64 TARGET_PATH=$(STAGING_DIR)/usr/bin:$(STAGING_DIR)/bin:/bin:/sbin:/usr/bin:/usr/sbin
65 IMAGE:=$(BUILD_DIR)/root_fs_$(ARCH)$(ARCH_FPU_SUFFIX)
66 REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux-uclibc
67 GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux
68 KERNEL_CROSS:=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-
69 TARGET_CROSS:=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-
70 TARGET_CC:=$(TARGET_CROSS)gcc
71 STRIP:=$(STAGING_DIR)/bin/sstrip
72 PATCH=$(SCRIPT_DIR)/patch-kernel.sh
73 SED:=$(STAGING_DIR)/bin/sed -i -e
74 LINUX_DIR:=$(BUILD_DIR)/linux
75 LINUX_HEADERS_DIR:=$(TOOL_BUILD_DIR)/linux
76
77
78 HOST_ARCH:=$(shell $(HOSTCC) -dumpmachine | sed -e s'/-.*//' \
79         -e 's/sparc.*/sparc/' \
80         -e 's/arm.*/arm/g' \
81         -e 's/m68k.*/m68k/' \
82         -e 's/ppc/powerpc/g' \
83         -e 's/v850.*/v850/g' \
84         -e 's/sh[234]/sh/' \
85         -e 's/mips-.*/mips/' \
86         -e 's/mipsel-.*/mipsel/' \
87         -e 's/cris.*/cris/' \
88         -e 's/i[3-9]86/i386/' \
89         )
90 GNU_HOST_NAME:=$(HOST_ARCH)-pc-linux-gnu
91 TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \
92                 AR=$(TARGET_CROSS)ar \
93                 AS=$(TARGET_CROSS)as \
94                 LD=$(TARGET_CROSS)ld \
95                 NM=$(TARGET_CROSS)nm \
96                 CC=$(TARGET_CROSS)gcc \
97                 GCC=$(TARGET_CROSS)gcc \
98                 CXX=$(TARGET_CROSS)g++ \
99                 RANLIB=$(TARGET_CROSS)ranlib
100
101 ifeq ($(ENABLE_LOCALE),true)
102 DISABLE_NLS:=
103 else
104 DISABLE_NLS:=--disable-nls
105 endif
106
107 ifeq ($(CONFIG_ENABLE_MULTILIB),y)
108 MULTILIB:=--enable-multilib
109 endif
110
111 # invoke ipkg-build with some default options
112 IPKG_BUILD := PATH="$(TARGET_PATH)" ipkg-build -c -o root -g root
113 # where to build (and put) .ipk packages
114 IPKG_TARGET_DIR := $(PACKAGE_DIR)
115 IPKG:=IPKG_TMP=$(BUILD_DIR)/tmp IPKG_INSTROOT=$(TARGET_DIR) IPKG_CONF_DIR=$(STAGING_DIR)/etc IPKG_OFFLINE_ROOT=$(BUILD_DIR)/root $(SCRIPT_DIR)/ipkg -force-defaults -force-depends
116 IPKG_STATE_DIR := $(TARGET_DIR)/usr/lib/ipkg
117
118 RSTRIP:=STRIP="$(STRIP)" $(SCRIPT_DIR)/rstrip.sh
119 RSTRIP_KMOD:=STRIP="$(TARGET_CROSS)strip --strip-unneeded --remove-section=.comment" $(SCRIPT_DIR)/rstrip.sh
120