add more ipkg validation checks
[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)/toolchain_build_$(ARCH)
26 STAGING_DIR:=$(TOPDIR)/staging_dir_$(ARCH)
27 BIN_DIR:=$(TOPDIR)/bin
28 PACKAGE_DIR:=$(BIN_DIR)/packages
29 IPKG_TARGET_DIR:=$(PACKAGE_DIR)
30 BUILD_DIR:=$(TOPDIR)/build_$(ARCH)
31 TMP_DIR:=$(BUILD_DIR)/tmp
32 STAMP_DIR:=$(BUILD_DIR)/stamp
33 TARGET_DIR:=$(BUILD_DIR)/root
34 IPKG_STATE_DIR:=$(TARGET_DIR)/usr/lib/ipkg
35
36 REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux-uclibc
37 GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux
38 KERNEL_CROSS:=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-
39 TARGET_CROSS:=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-
40 IMAGE:=$(BUILD_DIR)/root_fs_$(ARCH)
41
42 TARGET_PATH:=$(STAGING_DIR)/usr/bin:$(STAGING_DIR)/bin:/bin:/sbin:/usr/bin:/usr/sbin
43 TARGET_CFLAGS:=$(TARGET_OPTIMIZATION)
44
45 LINUX_DIR:=$(BUILD_DIR)/linux
46 LINUX_HEADERS_DIR:=$(TOOL_BUILD_DIR)/linux
47
48 # APPLICATIONS #
49 HOSTCC:=gcc
50 TARGET_CC:=$(TARGET_CROSS)gcc
51 STRIP:=$(STAGING_DIR)/bin/sstrip
52 PATCH:=$(SCRIPT_DIR)/patch-kernel.sh
53 SED:=$(STAGING_DIR)/bin/sed -i -e
54 CP:=cp -fpR
55
56 HOST_ARCH:=$(shell $(HOSTCC) -dumpmachine | sed -e s'/-.*//' \
57 -e 's/sparc.*/sparc/' \
58 -e 's/arm.*/arm/' \
59 -e 's/m68k.*/m68k/' \
60 -e 's/ppc/powerpc/' \
61 -e 's/v850.*/v850/' \
62 -e 's/sh[234]/sh/' \
63 -e 's/mips-.*/mips/' \
64 -e 's/mipsel-.*/mipsel/' \
65 -e 's/cris.*/cris/' \
66 -e 's/i[3-9]86/i386/' \
67 )
68
69 GNU_HOST_NAME:=$(HOST_ARCH)-pc-linux-gnu
70
71 TARGET_CONFIGURE_OPTS:= \
72 PATH=$(TARGET_PATH) \
73 AR=$(TARGET_CROSS)ar \
74 AS=$(TARGET_CROSS)as \
75 LD=$(TARGET_CROSS)ld \
76 NM=$(TARGET_CROSS)nm \
77 CC=$(TARGET_CROSS)gcc \
78 GCC=$(TARGET_CROSS)gcc \
79 CXX=$(TARGET_CROSS)g++ \
80 RANLIB=$(TARGET_CROSS)ranlib \
81 STRIP=$(TARGET_CROSS)strip
82
83 # strip an entire directory
84 RSTRIP:= \
85 STRIP="$(STRIP)" \
86 STRIP_KMOD="$(TARGET_CROSS)strip --strip-unneeded --remove-section=.comment" \
87 $(SCRIPT_DIR)/rstrip.sh
88
89 # where to build (and put) .ipk packages
90 IPKG:= \
91 IPKG_TMP=$(BUILD_DIR)/tmp \
92 IPKG_INSTROOT=$(TARGET_DIR) \
93 IPKG_CONF_DIR=$(STAGING_DIR)/etc \
94 IPKG_OFFLINE_ROOT=$(BUILD_DIR)/root \
95 $(SCRIPT_DIR)/ipkg -force-defaults -force-depends
96
97 # invoke ipkg-build with some default options
98 IPKG_BUILD:= \
99 PATH="$(TARGET_PATH)" ipkg-build -c -o root -g root
100
101 ifeq ($(CONFIG_ENABLE_LOCALE),true)
102 DISABLE_NLS:=
103 else
104 DISABLE_NLS:=--disable-nls
105 endif
106
107 ifneq ($(CONFIG_LARGEFILE),y)
108 DISABLE_LARGEFILE= --disable-largefile
109 endif
110
111 ifeq ($(CONFIG_TAR_VERBOSITY),y)
112 TAR_OPTIONS=-xvf
113 else
114 TAR_OPTIONS=-xf
115 endif
116
117 all:
118 FORCE: ;
119 .PHONY: FORCE
This page took 0.041846 seconds and 5 git commands to generate.