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