You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
118 lines
2.9 KiB
118 lines
2.9 KiB
19 years ago
|
#
|
||
|
# Copyright (C) 2006 OpenWrt.org
|
||
|
#
|
||
|
# This is free software, licensed under the GNU General Public License v2.
|
||
|
# See /LICENSE for more information.
|
||
|
#
|
||
|
|
||
19 years ago
|
-include $(TOPDIR)/.config
|
||
19 years ago
|
include $(TOPDIR)/include/verbose.mk
|
||
19 years ago
|
|
||
18 years ago
|
export SHELL=/usr/bin/env bash -c '. $(TOPDIR)/include/shell.sh; eval "$$2"' --
|
||
|
export BASH=$(shell which bash)
|
||
|
|
||
19 years ago
|
ARCH:=$(strip $(subst ",, $(CONFIG_ARCH)))
|
||
|
TARGET_OPTIMIZATION:=$(strip $(subst ",, $(CONFIG_TARGET_OPTIMIZATION)))
|
||
19 years ago
|
WGET:=$(strip $(subst ",, $(CONFIG_WGET)))
|
||
|
#"))"))")) # fix vim's broken syntax highlighting
|
||
20 years ago
|
|
||
19 years ago
|
OPTIMIZE_FOR_CPU:=$(ARCH)
|
||
20 years ago
|
|
||
19 years ago
|
# DIRECTORIES #
|
||
20 years ago
|
|
||
19 years ago
|
DL_DIR:=$(TOPDIR)/dl
|
||
19 years ago
|
INCLUDE_DIR:=$(TOPDIR)/include
|
||
19 years ago
|
SCRIPT_DIR:=$(TOPDIR)/scripts
|
||
19 years ago
|
TOOL_BUILD_DIR:=$(TOPDIR)/tool_build
|
||
|
TOOLCHAIN_BUILD_DIR:=$(TOPDIR)/toolchain_build_$(ARCH)
|
||
19 years ago
|
STAGING_DIR:=$(TOPDIR)/staging_dir_$(ARCH)
|
||
|
BIN_DIR:=$(TOPDIR)/bin
|
||
20 years ago
|
PACKAGE_DIR:=$(BIN_DIR)/packages
|
||
19 years ago
|
IPKG_TARGET_DIR:=$(PACKAGE_DIR)
|
||
|
BUILD_DIR:=$(TOPDIR)/build_$(ARCH)
|
||
19 years ago
|
TMP_DIR:=$(BUILD_DIR)/tmp
|
||
20 years ago
|
STAMP_DIR:=$(BUILD_DIR)/stamp
|
||
19 years ago
|
TARGET_DIR:=$(BUILD_DIR)/root
|
||
19 years ago
|
IPKG_STATE_DIR:=$(TARGET_DIR)/usr/lib/ipkg
|
||
|
|
||
19 years ago
|
ifeq ($(CONFIG_NATIVE_TOOLCHAIN),)
|
||
|
REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux-uclibc
|
||
|
GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux
|
||
|
TARGET_CROSS:=$(OPTIMIZE_FOR_CPU)-linux-uclibc-
|
||
|
endif
|
||
|
|
||
19 years ago
|
IMAGE:=$(BUILD_DIR)/root_fs_$(ARCH)
|
||
|
|
||
19 years ago
|
TARGET_PATH:=$(STAGING_DIR)/usr/bin:$(STAGING_DIR)/bin:$(PATH)
|
||
19 years ago
|
TARGET_CFLAGS:=$(TARGET_OPTIMIZATION)
|
||
|
|
||
19 years ago
|
export PATH:=$(TARGET_PATH)
|
||
|
|
||
20 years ago
|
LINUX_DIR:=$(BUILD_DIR)/linux
|
||
19 years ago
|
LINUX_HEADERS_DIR:=$(TOOLCHAIN_BUILD_DIR)/linux
|
||
20 years ago
|
|
||
19 years ago
|
# APPLICATIONS #
|
||
|
HOSTCC:=gcc
|
||
|
TARGET_CC:=$(TARGET_CROSS)gcc
|
||
|
STRIP:=$(STAGING_DIR)/bin/sstrip
|
||
|
PATCH:=$(SCRIPT_DIR)/patch-kernel.sh
|
||
|
SED:=$(STAGING_DIR)/bin/sed -i -e
|
||
|
CP:=cp -fpR
|
||
20 years ago
|
|
||
19 years ago
|
ifneq ($(CONFIG_CCACHE),)
|
||
19 years ago
|
# FIXME: move this variable to a better location
|
||
18 years ago
|
export CCACHE_DIR=$(STAGING_DIR)/ccache
|
||
19 years ago
|
TARGET_CC:= ccache $(TARGET_CC)
|
||
19 years ago
|
endif
|
||
|
|
||
19 years ago
|
TARGET_CONFIGURE_OPTS:= \
|
||
|
AR=$(TARGET_CROSS)ar \
|
||
19 years ago
|
AS="$(TARGET_CC) -c $(TARGET_CFLAGS)" \
|
||
19 years ago
|
LD=$(TARGET_CROSS)ld \
|
||
|
NM=$(TARGET_CROSS)nm \
|
||
19 years ago
|
CC="$(TARGET_CC)" \
|
||
|
GCC="$(TARGET_CC)" \
|
||
19 years ago
|
CXX=$(TARGET_CROSS)g++ \
|
||
|
RANLIB=$(TARGET_CROSS)ranlib \
|
||
|
STRIP=$(TARGET_CROSS)strip
|
||
|
|
||
|
# strip an entire directory
|
||
|
RSTRIP:= \
|
||
|
STRIP="$(STRIP)" \
|
||
|
STRIP_KMOD="$(TARGET_CROSS)strip --strip-unneeded --remove-section=.comment" \
|
||
|
$(SCRIPT_DIR)/rstrip.sh
|
||
|
|
||
|
# where to build (and put) .ipk packages
|
||
|
IPKG:= \
|
||
18 years ago
|
PATH="$(STAGING_DIR)/bin:$(PATH)" \
|
||
19 years ago
|
IPKG_TMP=$(BUILD_DIR)/tmp \
|
||
|
IPKG_INSTROOT=$(TARGET_DIR) \
|
||
|
IPKG_CONF_DIR=$(STAGING_DIR)/etc \
|
||
|
IPKG_OFFLINE_ROOT=$(BUILD_DIR)/root \
|
||
|
$(SCRIPT_DIR)/ipkg -force-defaults -force-depends
|
||
|
|
||
|
# invoke ipkg-build with some default options
|
||
|
IPKG_BUILD:= \
|
||
19 years ago
|
ipkg-build -c -o 0 -g 0
|
||
19 years ago
|
|
||
|
ifeq ($(CONFIG_ENABLE_LOCALE),true)
|
||
|
DISABLE_NLS:=
|
||
20 years ago
|
else
|
||
19 years ago
|
DISABLE_NLS:=--disable-nls
|
||
20 years ago
|
endif
|
||
|
|
||
19 years ago
|
ifneq ($(CONFIG_LARGEFILE),y)
|
||
|
DISABLE_LARGEFILE= --disable-largefile
|
||
20 years ago
|
endif
|
||
|
|
||
19 years ago
|
ifeq ($(CONFIG_TAR_VERBOSITY),y)
|
||
|
TAR_OPTIONS=-xvf
|
||
|
else
|
||
|
TAR_OPTIONS=-xf
|
||
|
endif
|
||
19 years ago
|
|
||
|
all:
|
||
19 years ago
|
FORCE: ;
|
||
19 years ago
|
.PHONY: FORCE
|
||
19 years ago
|
%: ;
|