fix kernel configure target
[openwrt.git] / rules.mk
1 -include $(TOPDIR)/.config
2 include $(TOPDIR)/include/verbose.mk
3
4 export SHELL=/bin/bash
5
6 ARCH:=$(strip $(subst ",, $(CONFIG_ARCH)))
7 TARGET_OPTIMIZATION:=$(strip $(subst ",, $(CONFIG_TARGET_OPTIMIZATION)))
8 WGET:=$(strip $(subst ",, $(CONFIG_WGET)))
9 #"))"))")) # fix vim's broken syntax highlighting
10
11 OPTIMIZE_FOR_CPU:=$(ARCH)
12
13 # DIRECTORIES #
14
15 DL_DIR:=$(TOPDIR)/dl
16 INCLUDE_DIR:=$(TOPDIR)/include
17 SCRIPT_DIR:=$(TOPDIR)/scripts
18 TOOL_BUILD_DIR:=$(TOPDIR)/toolchain_build_$(ARCH)
19 STAGING_DIR:=$(TOPDIR)/staging_dir_$(ARCH)
20 BIN_DIR:=$(TOPDIR)/bin
21 PACKAGE_DIR:=$(BIN_DIR)/packages
22 IPKG_TARGET_DIR:=$(PACKAGE_DIR)
23 BUILD_DIR:=$(TOPDIR)/build_$(ARCH)
24 STAMP_DIR:=$(BUILD_DIR)/stamp
25 TARGET_DIR:=$(BUILD_DIR)/root
26 IPKG_STATE_DIR:=$(TARGET_DIR)/usr/lib/ipkg
27
28 REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux-uclibc
29 GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux
30 KERNEL_CROSS:=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-
31 TARGET_CROSS:=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-
32 IMAGE:=$(BUILD_DIR)/root_fs_$(ARCH)
33
34 TARGET_PATH:=$(STAGING_DIR)/usr/bin:$(STAGING_DIR)/bin:/bin:/sbin:/usr/bin:/usr/sbin
35 TARGET_CFLAGS:=$(TARGET_OPTIMIZATION)
36
37 LINUX_DIR:=$(BUILD_DIR)/linux
38 LINUX_HEADERS_DIR:=$(TOOL_BUILD_DIR)/linux
39
40 # APPLICATIONS #
41 HOSTCC:=gcc
42 TARGET_CC:=$(TARGET_CROSS)gcc
43 STRIP:=$(STAGING_DIR)/bin/sstrip
44 PATCH:=$(SCRIPT_DIR)/patch-kernel.sh
45 SED:=$(STAGING_DIR)/bin/sed -i -e
46 CP:=cp -fpR
47
48 HOST_ARCH:=$(shell $(HOSTCC) -dumpmachine | sed -e s'/-.*//' \
49 -e 's/sparc.*/sparc/' \
50 -e 's/arm.*/arm/' \
51 -e 's/m68k.*/m68k/' \
52 -e 's/ppc/powerpc/' \
53 -e 's/v850.*/v850/' \
54 -e 's/sh[234]/sh/' \
55 -e 's/mips-.*/mips/' \
56 -e 's/mipsel-.*/mipsel/' \
57 -e 's/cris.*/cris/' \
58 -e 's/i[3-9]86/i386/' \
59 )
60
61 GNU_HOST_NAME:=$(HOST_ARCH)-pc-linux-gnu
62
63 TARGET_CONFIGURE_OPTS:= \
64 PATH=$(TARGET_PATH) \
65 AR=$(TARGET_CROSS)ar \
66 AS=$(TARGET_CROSS)as \
67 LD=$(TARGET_CROSS)ld \
68 NM=$(TARGET_CROSS)nm \
69 CC=$(TARGET_CROSS)gcc \
70 GCC=$(TARGET_CROSS)gcc \
71 CXX=$(TARGET_CROSS)g++ \
72 RANLIB=$(TARGET_CROSS)ranlib \
73 STRIP=$(TARGET_CROSS)strip
74
75 # strip an entire directory
76 RSTRIP:= \
77 STRIP="$(STRIP)" \
78 STRIP_KMOD="$(TARGET_CROSS)strip --strip-unneeded --remove-section=.comment" \
79 $(SCRIPT_DIR)/rstrip.sh
80
81 # where to build (and put) .ipk packages
82 IPKG:= \
83 IPKG_TMP=$(BUILD_DIR)/tmp \
84 IPKG_INSTROOT=$(TARGET_DIR) \
85 IPKG_CONF_DIR=$(STAGING_DIR)/etc \
86 IPKG_OFFLINE_ROOT=$(BUILD_DIR)/root \
87 $(SCRIPT_DIR)/ipkg -force-defaults -force-depends
88
89 # invoke ipkg-build with some default options
90 IPKG_BUILD:= \
91 PATH="$(TARGET_PATH)" ipkg-build -c -o root -g root
92
93 ifeq ($(CONFIG_ENABLE_LOCALE),true)
94 DISABLE_NLS:=
95 else
96 DISABLE_NLS:=--disable-nls
97 endif
98
99 ifneq ($(CONFIG_LARGEFILE),y)
100 DISABLE_LARGEFILE= --disable-largefile
101 endif
102
103 ifeq ($(CONFIG_TAR_VERBOSITY),y)
104 TAR_OPTIONS=-xvf
105 else
106 TAR_OPTIONS=-xf
107 endif
108
109 all:
110 FORCE: ;
111 .PHONY: FORCE
This page took 0.139138 seconds and 5 git commands to generate.