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