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