leave out the ccache directory when copying the staging dir into the sdk (#843)
[openwrt.git] / rules.mk
1 #
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 -include $(TOPDIR)/.config
9 include $(TOPDIR)/include/verbose.mk
10
11 export SHELL=/usr/bin/env bash -c '. $(TOPDIR)/include/shell.sh; eval "$$2"' --
12 export BASH=$(shell which bash)
13
14 ARCH:=$(strip $(subst ",, $(CONFIG_ARCH)))
15 TARGET_OPTIMIZATION:=$(strip $(subst ",, $(CONFIG_TARGET_OPTIMIZATION)))
16 WGET:=$(strip $(subst ",, $(CONFIG_WGET)))
17 #"))"))")) # fix vim's broken syntax highlighting
18
19 OPTIMIZE_FOR_CPU:=$(ARCH)
20
21 # DIRECTORIES #
22
23 DL_DIR:=$(TOPDIR)/dl
24 INCLUDE_DIR:=$(TOPDIR)/include
25 SCRIPT_DIR:=$(TOPDIR)/scripts
26 TOOL_BUILD_DIR:=$(TOPDIR)/tool_build
27 TOOLCHAIN_BUILD_DIR:=$(TOPDIR)/toolchain_build_$(ARCH)
28 STAGING_DIR:=$(TOPDIR)/staging_dir_$(ARCH)
29 BIN_DIR:=$(TOPDIR)/bin
30 PACKAGE_DIR:=$(BIN_DIR)/packages
31 IPKG_TARGET_DIR:=$(PACKAGE_DIR)
32 BUILD_DIR:=$(TOPDIR)/build_$(ARCH)
33 TMP_DIR:=$(BUILD_DIR)/tmp
34 STAMP_DIR:=$(BUILD_DIR)/stamp
35 TARGET_DIR:=$(BUILD_DIR)/root
36 IPKG_STATE_DIR:=$(TARGET_DIR)/usr/lib/ipkg
37
38 ifeq ($(CONFIG_NATIVE_TOOLCHAIN),)
39 REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux-uclibc
40 GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux
41 TARGET_CROSS:=$(OPTIMIZE_FOR_CPU)-linux-uclibc-
42 endif
43
44 IMAGE:=$(BUILD_DIR)/root_fs_$(ARCH)
45
46 TARGET_PATH:=$(STAGING_DIR)/usr/bin:$(STAGING_DIR)/bin:$(PATH)
47 TARGET_CFLAGS:=$(TARGET_OPTIMIZATION)
48
49 export PATH:=$(TARGET_PATH)
50
51 LINUX_DIR:=$(BUILD_DIR)/linux
52 LINUX_HEADERS_DIR:=$(TOOLCHAIN_BUILD_DIR)/linux
53
54 # APPLICATIONS #
55 HOSTCC:=gcc
56 TARGET_CC:=$(TARGET_CROSS)gcc
57 STRIP:=$(STAGING_DIR)/bin/sstrip
58 PATCH:=$(SCRIPT_DIR)/patch-kernel.sh
59 SED:=$(STAGING_DIR)/bin/sed -i -e
60 CP:=cp -fpR
61
62 ifneq ($(CONFIG_CCACHE),)
63 # FIXME: move this variable to a better location
64 export CCACHE_DIR=$(STAGING_DIR)/ccache
65 TARGET_CC:= ccache $(TARGET_CC)
66 endif
67
68 TARGET_CONFIGURE_OPTS:= \
69 AR=$(TARGET_CROSS)ar \
70 AS="$(TARGET_CC) -c $(TARGET_CFLAGS)" \
71 LD=$(TARGET_CROSS)ld \
72 NM=$(TARGET_CROSS)nm \
73 CC="$(TARGET_CC)" \
74 GCC="$(TARGET_CC)" \
75 CXX=$(TARGET_CROSS)g++ \
76 RANLIB=$(TARGET_CROSS)ranlib \
77 STRIP=$(TARGET_CROSS)strip
78
79 # strip an entire directory
80 RSTRIP:= \
81 STRIP="$(STRIP)" \
82 STRIP_KMOD="$(TARGET_CROSS)strip --strip-unneeded --remove-section=.comment" \
83 $(SCRIPT_DIR)/rstrip.sh
84
85 # where to build (and put) .ipk packages
86 IPKG:= \
87 PATH="$(STAGING_DIR)/bin:$(PATH)" \
88 IPKG_TMP=$(BUILD_DIR)/tmp \
89 IPKG_INSTROOT=$(TARGET_DIR) \
90 IPKG_CONF_DIR=$(STAGING_DIR)/etc \
91 IPKG_OFFLINE_ROOT=$(BUILD_DIR)/root \
92 $(SCRIPT_DIR)/ipkg -force-defaults -force-depends
93
94 # invoke ipkg-build with some default options
95 IPKG_BUILD:= \
96 ipkg-build -c -o 0 -g 0
97
98 ifeq ($(CONFIG_ENABLE_LOCALE),true)
99 DISABLE_NLS:=
100 else
101 DISABLE_NLS:=--disable-nls
102 endif
103
104 ifneq ($(CONFIG_LARGEFILE),y)
105 DISABLE_LARGEFILE= --disable-largefile
106 endif
107
108 ifeq ($(CONFIG_TAR_VERBOSITY),y)
109 TAR_OPTIONS=-xvf
110 else
111 TAR_OPTIONS=-xf
112 endif
113
114 all:
115 FORCE: ;
116 .PHONY: FORCE
117 %: ;
This page took 0.04847 seconds and 5 git commands to generate.