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