fix the size of the flash mem window on pronghorn metro (#2070)
[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 ifeq ($(DUMP),)
9 -include $(TOPDIR)/.config
10 endif
11 include $(TOPDIR)/include/verbose.mk
12
13 export SHELL=/usr/bin/env bash -c '. $(TOPDIR)/include/shell.sh; eval "$$2"' --
14
15 ARCH:=$(strip $(subst ",, $(CONFIG_ARCH)))
16 TARGET_OPTIMIZATION:=$(strip $(subst ",, $(CONFIG_TARGET_OPTIMIZATION)))
17 BUILD_DIR_SUFFIX:=$(strip $(subst ",, $(CONFIG_BUILD_SUFFIX)))
18 WGET:=$(strip $(subst ",, $(CONFIG_WGET)))
19 #"))"))")) # fix vim's broken syntax highlighting
20
21 OPTIMIZE_FOR_CPU:=$(ARCH)
22
23 # DIRECTORIES #
24
25 DL_DIR:=$(TOPDIR)/dl
26 INCLUDE_DIR:=$(TOPDIR)/include
27 SCRIPT_DIR:=$(TOPDIR)/scripts
28 TOOL_BUILD_DIR:=$(TOPDIR)/tool_build
29 TOOLCHAIN_BUILD_DIR:=$(TOPDIR)/toolchain_build_$(ARCH)
30 STAGING_DIR:=$(TOPDIR)/staging_dir_$(ARCH)
31 BIN_DIR:=$(TOPDIR)/bin
32 PACKAGE_DIR:=$(BIN_DIR)/packages
33 IPKG_TARGET_DIR:=$(PACKAGE_DIR)
34 BUILD_DIR:=$(TOPDIR)/build_$(ARCH)$(BUILD_DIR_SUFFIX)
35 TMP_DIR:=$(TOPDIR)/tmp
36 STAMP_DIR:=$(BUILD_DIR)/stamp
37 TARGET_DIR:=$(BUILD_DIR)/root
38 IPKG_STATE_DIR:=$(TARGET_DIR)/usr/lib/ipkg
39
40 ifeq ($(CONFIG_NATIVE_TOOLCHAIN),)
41 REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux-uclibc
42 GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux
43 TARGET_CROSS:=$(OPTIMIZE_FOR_CPU)-linux-uclibc-
44 endif
45
46 IMAGE:=$(BUILD_DIR)/root_fs_$(ARCH)
47
48 TARGET_PATH:=$(STAGING_DIR)/usr/sbin:$(STAGING_DIR)/usr/bin:$(STAGING_DIR)/bin:$(PATH)
49 TARGET_CFLAGS:=$(TARGET_OPTIMIZATION)
50
51 export PATH:=$(TARGET_PATH)
52
53 LINUX_DIR:=$(BUILD_DIR)/linux
54 LINUX_HEADERS_DIR:=$(TOOLCHAIN_BUILD_DIR)/linux
55
56 # APPLICATIONS #
57 HOSTCC:=gcc
58 TARGET_CC:=$(TARGET_CROSS)gcc
59 STRIP:=$(STAGING_DIR)/bin/sstrip
60 PATCH:=$(SCRIPT_DIR)/patch-kernel.sh
61 SED:=$(STAGING_DIR)/bin/sed -i -e
62 CP:=cp -fpR
63
64 INSTALL_BIN:=install -m0755
65 INSTALL_DIR:=install -d -m0755
66 INSTALL_DATA:=install -m0644
67 INSTALL_CONF:=install -m0600
68
69 ifneq ($(CONFIG_CCACHE),)
70 # FIXME: move this variable to a better location
71 export CCACHE_DIR=$(STAGING_DIR)/ccache
72 TARGET_CC:= ccache $(TARGET_CC)
73 endif
74
75 EXTRA_CPPFLAGS := -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include
76 EXTRA_CFLAGS := $(EXTRA_CPPFLAGS)
77 EXTRA_LDFLAGS := -L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib
78
79 TARGET_CONFIGURE_OPTS:= \
80 AR=$(TARGET_CROSS)ar \
81 AS="$(TARGET_CC) -c $(TARGET_CFLAGS)" \
82 LD=$(TARGET_CROSS)ld \
83 NM=$(TARGET_CROSS)nm \
84 CC="$(TARGET_CC)" \
85 GCC="$(TARGET_CC)" \
86 CXX=$(TARGET_CROSS)g++ \
87 RANLIB=$(TARGET_CROSS)ranlib \
88 STRIP=$(TARGET_CROSS)strip \
89 OBJCOPY=$(TARGET_CROSS)objcopy \
90 OBJDUMP=$(TARGET_CROSS)objdump \
91 SIZE=$(TARGET_CROSS)size
92
93 # strip an entire directory
94 RSTRIP:= \
95 NM="$(TARGET_CROSS)nm" \
96 STRIP="$(STRIP)" \
97 STRIP_KMOD="$(TARGET_CROSS)strip --strip-unneeded --remove-section=.comment" \
98 $(SCRIPT_DIR)/rstrip.sh
99
100 # where to build (and put) .ipk packages
101 IPKG:= \
102 PATH="$(STAGING_DIR)/bin:$(PATH)" \
103 IPKG_TMP=$(BUILD_DIR)/tmp \
104 IPKG_INSTROOT=$(TARGET_DIR) \
105 IPKG_CONF_DIR=$(STAGING_DIR)/etc \
106 IPKG_OFFLINE_ROOT=$(BUILD_DIR)/root \
107 $(SCRIPT_DIR)/ipkg -force-defaults -force-depends
108
109 # invoke ipkg-build with some default options
110 IPKG_BUILD:= \
111 ipkg-build -c -o 0 -g 0
112
113 ifeq ($(CONFIG_ENABLE_LOCALE),true)
114 DISABLE_NLS:=
115 else
116 DISABLE_NLS:=--disable-nls
117 endif
118
119 ifneq ($(CONFIG_LARGEFILE),y)
120 DISABLE_LARGEFILE= --disable-largefile
121 endif
122
123 ifeq ($(CONFIG_TAR_VERBOSITY),y)
124 TAR_OPTIONS:=-xvf -
125 else
126 TAR_OPTIONS:=-xf -
127 endif
128
129 define shvar
130 V_$(subst .,_,$(subst -,_,$(subst /,_,$(1))))
131 endef
132
133 define shexport
134 $(call shvar,$(1))=$$(call $(1))
135 export $(call shvar,$(1))
136 endef
137
138 all:
139 FORCE: ;
140 .PHONY: FORCE
141 %: ;
This page took 0.050721 seconds and 5 git commands to generate.