run defconfig at the start of a normal make run to get additional config options
[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 BUILD_MAKEFLAGS= V=$(V) $(EXTRA_MAKEFLAGS)
28 MAKEFLAGS=$(BUILD_MAKEFLAGS)
29 # Strip off the annoying quoting
30 ARCH:=$(strip $(subst ",, $(CONFIG_ARCH)))
31 WGET:=$(strip $(subst ",, $(CONFIG_WGET)))
32 TARGET_OPTIMIZATION:=$(strip $(subst ",, $(CONFIG_TARGET_OPTIMIZATION)))
33 #"))"))"))"))")) # for vim's broken syntax highlighting :)
34
35 ifeq ($(CONFIG_TAR_VERBOSITY),y)
36 TAR_OPTIONS=-xvf
37 else
38 TAR_OPTIONS=-xf
39 endif
40
41 ifneq ($(CONFIG_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)
51 STAGING_DIR:=$(BASE_DIR)/staging_dir_$(ARCH)
52 SCRIPT_DIR:=$(BASE_DIR)/scripts
53 BIN_DIR:=$(BASE_DIR)/bin
54 STAMP_DIR:=$(BUILD_DIR)/stamp
55 PACKAGE_DIR:=$(BIN_DIR)/packages
56 STAMP_DIR:=$(BUILD_DIR)/stamp
57 TARGET_DIR:=$(BUILD_DIR)/root
58 TOOL_BUILD_DIR=$(BASE_DIR)/toolchain_build_$(ARCH)
59 TARGET_PATH=$(STAGING_DIR)/usr/bin:$(STAGING_DIR)/bin:/bin:/sbin:/usr/bin:/usr/sbin
60 IMAGE:=$(BUILD_DIR)/root_fs_$(ARCH)
61 REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux-uclibc
62 GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux
63 KERNEL_CROSS:=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-
64 TARGET_CROSS:=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-
65 TARGET_CC:=$(TARGET_CROSS)gcc
66 STRIP:=$(STAGING_DIR)/bin/sstrip
67 PATCH=$(SCRIPT_DIR)/patch-kernel.sh
68 SED:=$(STAGING_DIR)/bin/sed -i -e
69 LINUX_DIR:=$(BUILD_DIR)/linux
70 LINUX_HEADERS_DIR:=$(TOOL_BUILD_DIR)/linux
71
72
73 HOST_ARCH:=$(shell $(HOSTCC) -dumpmachine | sed -e s'/-.*//' \
74 -e 's/sparc.*/sparc/' \
75 -e 's/arm.*/arm/g' \
76 -e 's/m68k.*/m68k/' \
77 -e 's/ppc/powerpc/g' \
78 -e 's/v850.*/v850/g' \
79 -e 's/sh[234]/sh/' \
80 -e 's/mips-.*/mips/' \
81 -e 's/mipsel-.*/mipsel/' \
82 -e 's/cris.*/cris/' \
83 -e 's/i[3-9]86/i386/' \
84 )
85 GNU_HOST_NAME:=$(HOST_ARCH)-pc-linux-gnu
86 TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \
87 AR=$(TARGET_CROSS)ar \
88 AS=$(TARGET_CROSS)as \
89 LD=$(TARGET_CROSS)ld \
90 NM=$(TARGET_CROSS)nm \
91 CC=$(TARGET_CROSS)gcc \
92 GCC=$(TARGET_CROSS)gcc \
93 CXX=$(TARGET_CROSS)g++ \
94 RANLIB=$(TARGET_CROSS)ranlib
95
96 ifeq ($(ENABLE_LOCALE),true)
97 DISABLE_NLS:=
98 else
99 DISABLE_NLS:=--disable-nls
100 endif
101
102 ifeq ($(CONFIG_ENABLE_MULTILIB),y)
103 MULTILIB:=--enable-multilib
104 endif
105
106 # invoke ipkg-build with some default options
107 IPKG_BUILD := PATH="$(TARGET_PATH)" ipkg-build -c -o root -g root
108 # where to build (and put) .ipk packages
109 IPKG_TARGET_DIR := $(PACKAGE_DIR)
110 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
111 IPKG_STATE_DIR := $(TARGET_DIR)/usr/lib/ipkg
112
113 RSTRIP:=STRIP="$(STRIP)" STRIP_KMOD="$(TARGET_CROSS)strip --strip-unneeded --remove-section=.comment" $(SCRIPT_DIR)/rstrip.sh
114
115 all:
116 .PHONY: FORCE
117 FORCE:
This page took 0.04648 seconds and 5 git commands to generate.