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