remove todo message
[openwrt.git] / rules.mk
1 include $(TOPDIR)/.config
2
3 SHELL=/bin/bash
4 export SHELL
5
6 ifeq ($(V),)
7 V=5
8 endif
9
10
11 ifneq ($(V),0)
12 TRACE:=echo "---> "
13 START_TRACE:=echo -n "---> "
14 END_TRACE:=echo
15 else
16 START_TRACE:=:
17 END_TRACE:=:
18 TRACE:=:
19 endif
20
21 ifeq (${shell [ "$(V)" -ge 5 ] && echo 1},)
22 CMD_TRACE:=:
23 PKG_TRACE:=:
24 else
25 CMD_TRACE:=echo -n
26 PKG_TRACE:=echo "------> "
27 endif
28
29 ifeq (${shell [ "$(V)" -ge 10 ] && echo 1},)
30 EXTRA_MAKEFLAGS:=-s
31 MAKE_TRACE:=2>&1 >&/dev/null || { echo "Build failed. Please re-run make with V=99 to see what's going on"; /bin/false; }
32 else
33 MAKE_TRACE:=
34 EXTRA_MAKEFLAGS:=
35 TRACE:=:
36 PKG_TRACE:=:
37 CMD_TRACE:=:
38 START_TRACE:=:
39 END_TRACE:=:
40 endif
41
42 CP=cp -fpR
43 MAKE1=make
44 MAKEFLAGS=-j$(CONFIG_JLEVEL) V=$(V) $(EXTRA_MAKEFLAGS)
45 # Strip off the annoying quoting
46 ARCH:=$(strip $(subst ",, $(CONFIG_ARCH)))
47 WGET:=$(strip $(subst ",, $(CONFIG_WGET)))
48 GCC_VERSION:=$(strip $(subst ",, $(CONFIG_GCC_VERSION)))
49 GCC_USE_SJLJ_EXCEPTIONS:=$(strip $(subst ",, $(CONFIG_GCC_USE_SJLJ_EXCEPTIONS)))
50 TARGET_OPTIMIZATION:=$(strip $(subst ",, $(CONFIG_TARGET_OPTIMIZATION)))
51 #"))"))"))"))")) # for vim's broken syntax highlighting :)
52
53
54 ifeq ($(CONFIG_SOFT_FLOAT),y)
55 # gcc 3.4.x soft float configuration is different than previous versions.
56 ifeq ($(findstring 3.4.,$(GCC_VERSION)),3.4.)
57 SOFT_FLOAT_CONFIG_OPTION:=--with-float=soft
58 else
59 SOFT_FLOAT_CONFIG_OPTION:=--without-float
60 endif
61 TARGET_SOFT_FLOAT:=-msoft-float
62 ARCH_FPU_SUFFIX:=_nofpu
63 else
64 SOFT_FLOAT_CONFIG_OPTION:=
65 TARGET_SOFT_FLOAT:=
66 ARCH_FPU_SUFFIX:=
67 endif
68
69
70 ifeq ($(CONFIG_TAR_VERBOSITY),y)
71 TAR_OPTIONS=-xvf
72 else
73 TAR_OPTIONS=-xf
74 endif
75
76 ifneq ($(CONFIG_LARGEFILE),y)
77 DISABLE_LARGEFILE= --disable-largefile
78 endif
79 TARGET_CFLAGS:=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)
80
81 OPTIMIZE_FOR_CPU=$(ARCH)
82 HOSTCC:=gcc
83 BASE_DIR:=$(TOPDIR)
84 DL_DIR:=$(BASE_DIR)/dl
85 BUILD_DIR:=$(BASE_DIR)/build_$(ARCH)$(ARCH_FPU_SUFFIX)
86 STAGING_DIR:=$(BASE_DIR)/staging_dir_$(ARCH)$(ARCH_FPU_SUFFIX)
87 SCRIPT_DIR:=$(BASE_DIR)/scripts
88 BIN_DIR:=$(BASE_DIR)/bin
89 STAMP_DIR:=$(BUILD_DIR)/stamp
90 PACKAGE_DIR:=$(BIN_DIR)/packages
91 STAMP_DIR:=$(BUILD_DIR)/stamp
92 TARGET_DIR:=$(BUILD_DIR)/root
93 TOOL_BUILD_DIR=$(BASE_DIR)/toolchain_build_$(ARCH)$(ARCH_FPU_SUFFIX)
94 TARGET_PATH=$(STAGING_DIR)/usr/bin:$(STAGING_DIR)/bin:/bin:/sbin:/usr/bin:/usr/sbin
95 IMAGE:=$(BUILD_DIR)/root_fs_$(ARCH)$(ARCH_FPU_SUFFIX)
96 REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux-uclibc
97 GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux
98 KERNEL_CROSS:=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-
99 TARGET_CROSS:=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-
100 TARGET_CC:=$(TARGET_CROSS)gcc
101 STRIP:=$(STAGING_DIR)/bin/sstrip
102 PATCH=$(SCRIPT_DIR)/patch-kernel.sh
103 SED:=$(STAGING_DIR)/bin/sed -i -e
104 LINUX_DIR:=$(BUILD_DIR)/linux
105 LINUX_HEADERS_DIR:=$(TOOL_BUILD_DIR)/linux
106
107
108 HOST_ARCH:=$(shell $(HOSTCC) -dumpmachine | sed -e s'/-.*//' \
109 -e 's/sparc.*/sparc/' \
110 -e 's/arm.*/arm/g' \
111 -e 's/m68k.*/m68k/' \
112 -e 's/ppc/powerpc/g' \
113 -e 's/v850.*/v850/g' \
114 -e 's/sh[234]/sh/' \
115 -e 's/mips-.*/mips/' \
116 -e 's/mipsel-.*/mipsel/' \
117 -e 's/cris.*/cris/' \
118 -e 's/i[3-9]86/i386/' \
119 )
120 GNU_HOST_NAME:=$(HOST_ARCH)-pc-linux-gnu
121 TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \
122 AR=$(TARGET_CROSS)ar \
123 AS=$(TARGET_CROSS)as \
124 LD=$(TARGET_CROSS)ld \
125 NM=$(TARGET_CROSS)nm \
126 CC=$(TARGET_CROSS)gcc \
127 GCC=$(TARGET_CROSS)gcc \
128 CXX=$(TARGET_CROSS)g++ \
129 RANLIB=$(TARGET_CROSS)ranlib
130
131 ifeq ($(ENABLE_LOCALE),true)
132 DISABLE_NLS:=
133 else
134 DISABLE_NLS:=--disable-nls
135 endif
136
137 ifeq ($(CONFIG_ENABLE_MULTILIB),y)
138 MULTILIB:=--enable-multilib
139 endif
140
141 # invoke ipkg-build with some default options
142 IPKG_BUILD := PATH="$(TARGET_PATH)" ipkg-build -c -o root -g root
143 # where to build (and put) .ipk packages
144 IPKG_TARGET_DIR := $(PACKAGE_DIR)
145 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
146 IPKG_STATE_DIR := $(TARGET_DIR)/usr/lib/ipkg
147
148 RSTRIP:=STRIP="$(STRIP)" $(SCRIPT_DIR)/rstrip.sh
149 RSTRIP_KMOD:=STRIP="$(TARGET_CROSS)strip --strip-unneeded --remove-section=.comment" $(SCRIPT_DIR)/rstrip.sh
150
This page took 0.049738 seconds and 5 git commands to generate.