# See /LICENSE for more information.
#
-include $(TOPDIR)/.host.mk
+include $(TMP_DIR)/.host.mk
export TAR
-$(TOPDIR)/.host.mk: $(INCLUDE_DIR)/host.mk
+$(TMP_DIR)/.host.mk: $(TOPDIR)/include/host.mk
+ @mkdir -p $(TMP_DIR)
@( \
HOST_OS=`uname`; \
case "$$HOST_OS" in \
echo "HOST_OS:=$$HOST_OS" > $@; \
echo "HOST_ARCH:=$$HOST_ARCH" >> $@; \
echo "GNU_HOST_NAME:=$$GNU_HOST_NAME" >> $@; \
- TAR=`which gtar`; \
- [ -n "$$TAR" -a -x "$$TAR" ] || TAR=`which tar`; \
+ TAR=`which gtar 2>/dev/null`; \
+ [ -n "$$TAR" -a -x "$$TAR" ] || TAR=`which tar 2>/dev/null`; \
echo "TAR:=$$TAR" >> $@; \
- ZCAT=`which gzcat`; \
- [ -n "$$ZCAT" -a -x "$$ZCAT" ] || ZCAT=`which zcat`; \
+ ZCAT=`which gzcat 2>/dev/null`; \
+ [ -n "$$ZCAT" -a -x "$$ZCAT" ] || ZCAT=`which zcat 2>/dev/null`; \
echo "ZCAT:=$$ZCAT" >> $@; \
+ echo "BASH:=$(shell which bash)" >> $@; \
)
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
+
+include $(INCLUDE_DIR)/prereq.mk
+include $(INCLUDE_DIR)/kernel.mk
KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)
ifneq ($(CONFIG_BIG_ENDIAN),y)
E2SIZE=$(shell echo $$(($(CONFIG_TARGET_ROOTFS_FSPART)*1024)))
define Image/mkfs/ext2
- $(STAGING_DIR)/bin/genext2fs -q -b $(E2SIZE) -I 1500 -d $(BUILD_DIR)/root/ $(KDIR)/root.ext2
+ $(STAGING_DIR)/bin/genext2fs -U -b $(E2SIZE) -I 1500 -d $(BUILD_DIR)/root/ $(KDIR)/root.ext2
$(call Image/Build,ext2)
endef
endif
endef
define BuildImage
-compile:
+download:
+prepare:
+ifneq ($(IB),1)
+ compile: compile-targets
$(call Build/Compile)
+else
+ compile:
+endif
-install:
+ifneq ($(IB),1)
+ install: compile install-targets
$(call Image/Prepare)
$(call Image/mkfs/prepare)
$(call Image/BuildKernel)
$(call Image/mkfs/squashfs)
$(call Image/mkfs/tgz)
$(call Image/mkfs/ext2)
+else
+ install: compile install-targets
+ $(call Image/BuildKernel)
+ $(call Image/mkfs/jffs2)
+ $(call Image/mkfs/squashfs)
+ $(call Image/mkfs/tgz)
+ $(call Image/mkfs/ext2)
+endif
-clean:
+ifneq ($(IB),1)
+ clean: clean-targets
$(call Build/Clean)
-endef
+else
+ clean:
+endif
compile-targets:
install-targets:
clean-targets:
+endef
+
-download:
-prepare:
-compile: compile-targets
-install: compile install-targets
-clean: clean-targets
IPT_CONNTRACK-$(CONFIG_IP_NF_MATCH_CONNTRACK) += $(P_V4)ipt_conntrack
IPT_CONNTRACK-$(CONFIG_IP_NF_MATCH_HELPER) += $(P_V4)ipt_helper
IPT_CONNTRACK-$(CONFIG_IP_NF_MATCH_STATE) += $(P_V4)ipt_state
+IPT_CONNTRACK-$(CONFIG_NETFILTER_XT_MATCH_CONNMARK) += $(P_XT)xt_connmark
+IPT_CONNTRACK-$(CONFIG_NETFILTER_XT_TARGET_CONNMARK) += $(P_XT)xt_CONNMARK
IPT_CONNTRACK-$(CONFIG_NETFILTER_XT_MATCH_CONNTRACK) += $(P_XT)xt_conntrack
IPT_CONNTRACK-$(CONFIG_NETFILTER_XT_MATCH_HELPER) += $(P_XT)xt_helper
IPT_CONNTRACK-$(CONFIG_NETFILTER_XT_MATCH_STATE) += $(P_XT)xt_state
IPT_NAT-$(CONFIG_IP_NF_TARGET_REDIRECT) += $(P_V4)ipt_REDIRECT
IPT_NAT-$(CONFIG_IP_NF_TARGET_NETMAP) += $(P_V4)ipt_NETMAP
+IPT_NAT_DEFAULT-m :=
+IPT_NAT_DEFAULT-$(CONFIG_IP_NF_FTP) += $(P_V4)ip_conntrack_ftp
+IPT_NAT_DEFAULT-$(CONFIG_IP_NF_NAT_FTP) += $(P_V4)ip_nat_ftp
+IPT_NAT_DEFAULT-$(CONFIG_IP_NF_IRC) += $(P_V4)ip_conntrack_irc
+IPT_NAT_DEFAULT-$(CONFIG_IP_NF_NAT_IRC) += $(P_V4)ip_nat_irc
+IPT_NAT_DEFAULT-$(CONFIG_IP_NF_TFTP) += $(P_V4)ip_conntrack_tftp
+
IPT_NAT_EXTRA-m :=
IPT_NAT_EXTRA-$(CONFIG_IP_NF_AMANDA) += $(P_V4)ip_conntrack_amanda
IPT_NAT_EXTRA-$(CONFIG_IP_NF_CT_PROTO_GRE) += $(P_V4)ip_conntrack_proto_gre
IPT_NAT_EXTRA-$(CONFIG_IP_NF_NAT_SNMP_BASIC) += $(P_V4)ip_nat_snmp_basic
IPT_NAT_EXTRA-$(CONFIG_IP_NF_SIP) += $(P_V4)ip_conntrack_sip
IPT_NAT_EXTRA-$(CONFIG_IP_NF_NAT_SIP) += $(P_V4)ip_nat_sip
-IPT_NAT_EXTRA-$(CONFIG_IP_NF_TFTP) += $(P_V4)ip_conntrack_tftp
IPT_QUEUE-m :=
IPT_QUEUE-$(CONFIG_IP_NF_QUEUE) += $(P_V4)ip_queue
include $(INCLUDE_DIR)/host.mk
include $(INCLUDE_DIR)/unpack.mk
+PKG_CONFIG_PATH:=.
export CONFIG_SITE:=$(INCLUDE_DIR)/site/$(REAL_GNU_TARGET_NAME)
-define shvar
-V_$(subst .,_,$(subst -,_,$(subst /,_,$(1))))
-endef
-
-define shexport
-$(call shvar,$(1))=$$(call $(1))
-export $(call shvar,$(1))
-endef
-
define Build/DefaultTargets
ifeq ($(DUMP),)
ifeq ($(CONFIG_AUTOREBUILD),y)
- _INFO:=
- ifneq ($$(shell $(SCRIPT_DIR)/timestamp.pl -p $(PKG_BUILD_DIR) .),$(PKG_BUILD_DIR))
- _INFO+=$(subst $(TOPDIR)/,,$(PKG_BUILD_DIR))
+ ifneq ($$(shell $(SCRIPT_DIR)/timestamp.pl -p $(PKG_BUILD_DIR) . $(PKG_FILE_DEPEND)),$(PKG_BUILD_DIR))
+ $$(info Forcing package rebuild)
$(PKG_BUILD_DIR)/.prepared: package-clean
endif
endif
INFO_$(1):=$(IPKG_STATE_DIR)/info/$(1).list
ifdef Package/$(1)/install
- compile-targets: $$(IPKG_$(1))
+ ifeq ($(CONFIG_PACKAGE_$(1)),y)
+ install-targets: $$(INFO_$(1))
+ endif
+
+ ifneq ($(CONFIG_PACKAGE_$(1))$(DEVELOPER)$(SDK),)
+ compile-targets: $$(IPKG_$(1))
+ else
+ compile-targets: $(1)-disabled
+ $(1)-disabled:
+ @echo "WARNING: skipping $(1) -- package not selected"
+ endif
endif
ifeq ($(FORCEREBUILD),y)
IDEPEND_$(1):=$$(strip $$(DEPENDS))
ifneq ($(DUMP),)
- DUMPINFO += \
+ dumpinfo: dumpinfo-$(1)
+ dumpinfo-$(1): FORCE
+ @$$(DUMPINFO_$(call shvar,$(1)))
+
+ DUMPINFO_$(call shvar,$(1)) += \
echo "Package: $(1)";
ifneq ($(MENU),)
- DUMPINFO += \
+ DUMPINFO_$(call shvar,$(1)) += \
echo "Menu: $(MENU)";
endif
ifneq ($(SUBMENU),)
- DUMPINFO += \
+ DUMPINFO_$(call shvar,$(1)) += \
echo "Submenu: $(SUBMENU)";
ifneq ($(SUBMENUDEP),)
- DUMPINFO += \
+ DUMPINFO_$(call shvar,$(1)) += \
echo "Submenu-Depends: $(SUBMENUDEP)";
endif
endif
ifneq ($(DEFAULT),)
- DUMPINFO += \
+ DUMPINFO_$(call shvar,$(1)) += \
echo "Default: $(DEFAULT)";
endif
$(call shexport,Package/$(1)/description)
- DUMPINFO += \
+ DUMPINFO_$(call shvar,$(1)) += \
if [ "$$$$PREREQ_CHECK" = 1 ]; then echo "Prereq-Check: 1"; fi; \
echo "Version: $(VERSION)"; \
echo "Depends: $$(IDEPEND_$(1))"; \
echo "Provides: $(PROVIDES)"; \
echo "Build-Depends: $(PKG_BUILD_DEPENDS)"; \
+ echo "Section: $(SECTION)"; \
echo "Category: $(CATEGORY)"; \
echo "Title: $(TITLE)"; \
+ echo "Maintainer: $(MAINTAINER)"; \
if isset $(call shvar,Package/$(1)/description); then \
echo -n "Description: "; \
getvar $(call shvar,Package/$(1)/description); \
else \
- echo "Description: $(DESCRIPTION)" | sed -e 's,\\,\n,g'; \
+ echo "Description: $(patsubst \\,\\\\,$(DESCRIPTION))" | perl -ne 's/\\/\n/g, print'; \
fi;
ifneq ($(URL),)
- DUMPINFO += \
+ DUMPINFO_$(call shvar,$(1)) += \
echo; \
echo "$(URL)";
endif
- DUMPINFO += \
+ DUMPINFO_$(call shvar,$(1)) += \
echo "@@";
$(call shexport,Package/$(1)/config)
- DUMPINFO += \
- if isset $(call shvar,Package/$(1)/config); then echo "Config: "; getvar $(call shvar,Package/$(1)/config); fi; \
- echo "@@";
+ DUMPINFO_$(call shvar,$(1)) += \
+ if isset $(call shvar,Package/$(1)/config); then \
+ echo "Config: "; \
+ getvar $(call shvar,Package/$(1)/config); \
+ echo "@@"; \
+ fi;
endif
echo "Package: $(1)" > $$(IDIR_$(1))/CONTROL/control
echo "Version: $(VERSION)" >> $$(IDIR_$(1))/CONTROL/control
( \
- DEPENDS=; \
+ DEPENDS='$(EXTRA_DEPENDS)'; \
for depend in $$(filter-out @%,$$(IDEPEND_$(1))); do \
DEPENDS=$$$${DEPENDS:+$$$$DEPENDS, }$$$${depend##+}; \
done; \
- echo "Depends: $(EXTRA_DEPENDS) $$$$DEPENDS" >> $$(IDIR_$(1))/CONTROL/control; \
+ echo "Depends: $$$$DEPENDS" >> $$(IDIR_$(1))/CONTROL/control; \
)
echo "Source: $(SOURCE)" >> $$(IDIR_$(1))/CONTROL/control
echo "Section: $(SECTION)" >> $$(IDIR_$(1))/CONTROL/control
$$(eval $$(call Build/DefaultTargets,$(1)))
ifdef Package/$(1)/install
- ifneq ($$(CONFIG_PACKAGE_$(1)),)
+ ifneq ($$(CONFIG_PACKAGE_$(1))$(DEVELOPER)$(SDK),)
ifneq ($(MAKECMDGOALS),prereq)
ifneq ($(DUMP),1)
ifneq ($$(shell $(SCRIPT_DIR)/timestamp.pl -p -x ipkg -x ipkg-install '$$(IPKG_$(1))' '$(PKG_BUILD_DIR)'),$$(IPKG_$(1)))
- _INFO+=$(subst $(TOPDIR)/,,$$(IPKG_$(1)))
$(PKG_BUILD_DIR)/.built: package-rebuild
- endif
-
- ifneq ($$(_INFO),)
- $$(info Rebuilding $$(_INFO))
+ $$(info Rebuilding $(subst $(TOPDIR)/,,$$(IPKG_$(1))))
endif
endif
endif
CXXFLAGS="$(TARGET_CFLAGS)" \
CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
+ PKG_CONFIG_PATH="$(STAGING_DIR)/usr/lib/pkgconfig" \
PKG_CONFIG_LIBDIR="$(STAGING_DIR)/usr/lib/pkgconfig" \
$(2) \
- ./configure \
+ $(PKG_CONFIG_PATH)/configure \
--target=$(GNU_TARGET_NAME) \
--host=$(GNU_TARGET_NAME) \
--build=$(GNU_HOST_NAME) \
endef
define Build/Compile/Default
+ CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CPPFLAGS) " \
+ LDFLAGS="$(EXTRA_LDFLAGS) " \
$(MAKE) -C $(PKG_BUILD_DIR) \
$(TARGET_CONFIGURE_OPTS) \
CROSS="$(TARGET_CROSS)" \
- EXTRA_CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include " \
- EXTRA_LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib " \
+ CXXFLAGS="$(TARGET_CFLAGS) $(EXTRA_CPPFLAGS) " \
ARCH="$(ARCH)" \
$(1);
endef
endef
ifneq ($(DUMP),)
- dumpinfo: FORCE
- @$(DUMPINFO)
+ dumpinfo:
else
$(PACKAGE_DIR):
mkdir -p $@
# See /LICENSE for more information.
#
-$(TMP_DIR):
- mkdir -p $@
-
prereq:
if [ -f $(TMP_DIR)/.prereq-error ]; then \
echo; \
cat $(TMP_DIR)/.prereq-error; \
+ rm -f $(TMP_DIR)/.prereq-error; \
echo; \
- rm -rf $(TMP_DIR); \
false; \
fi
- rm -rf $(TMP_DIR)
- mkdir -p $(TMP_DIR)
-.SILENT: $(TMP_DIR) prereq
+.SILENT: prereq
define Require
export PREREQ_CHECK=1
ifeq ($$(CHECK_$(1)),)
prereq: prereq-$(1)
- prereq-$(1): $(TMP_DIR) FORCE
+ prereq-$(1): FORCE
echo -n "Checking '$(1)'... "
if $(NO_TRACE_MAKE) -f $(firstword $(MAKEFILE_LIST)) check-$(1) >/dev/null 2>/dev/null; then \
echo 'ok.'; \
else \
echo 'failed.'; \
- echo -e "$(strip $(2))" >> $(TMP_DIR)/.prereq-error; \
+ echo -e "$(strip $(2))" | perl -ne 's/\\\s*/\n/g,print' >> $(TMP_DIR)/.prereq-error; \
fi
check-$(1): FORCE
eval "var=\"\${$1}\""
[ -n "$var" ]
}
+
+trapret() {(
+ local retvals="$1"; shift
+ local cmd="$1"; shift
+ for retval in $(echo $retvals); do
+ local trap_$retval=1
+ done
+ "$cmd" "$@" || {
+ local retval="$?"
+ eval "trapped=\${trap_$retval}"
+ [ -n "$trapped" ] || {
+ return $retval
+ }
+ }
+)}
--- /dev/null
+#!/bin/sh
+
+ac_cv_c_littleendian=${ac_cv_c_littleendian=yes}
+ac_cv_c_bigendian=${ac_cv_c_bigendian=no}
+
+ac_cv_sizeof___int64=0
+ac_cv_sizeof_char=1
+ac_cv_sizeof_int=4
+ac_cv_sizeof_int16_t=2
+ac_cv_sizeof_int32_t=4
+ac_cv_sizeof_int64_t=8
+ac_cv_sizeof_long_int=4
+ac_cv_sizeof_long_long=8
+ac_cv_sizeof_long=4
+ac_cv_sizeof_off_t=8
+ac_cv_sizeof_short_int=2
+ac_cv_sizeof_short=2
+ac_cv_sizeof_size_t=4
+ac_cv_sizeof_u_int16_t=2
+ac_cv_sizeof_u_int32_t=4
+ac_cv_sizeof_u_int64_t=8
+ac_cv_sizeof_uint16_t=2
+ac_cv_sizeof_uint32_t=4
+ac_cv_sizeof_uint64_t=8
+ac_cv_sizeof_unsigned_int=4
+ac_cv_sizeof_unsigned_long=4
+ac_cv_sizeof_unsigned_short=2
+ac_cv_sizeof_void_p=4
+
+. $TOPDIR/include/site/linux-uclibc
+
ifeq ($(strip $(PKG_UNPACK)),)
+ ifneq ($(HOST_OS),Linux)
+ HOST_TAR:=trapret 2 $(TAR)
+ else
+ HOST_TAR:=$(TAR)
+ endif
ifneq ($(strip $(PKG_CAT)),)
# use existing PKG_CAT
- PKG_UNPACK:=$(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | $(TAR) -C $(PKG_BUILD_DIR)/.. $(TAR_OPTIONS)
+ PKG_UNPACK:=$(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | $(HOST_TAR) -C $(PKG_BUILD_DIR)/.. $(TAR_OPTIONS)
ifeq ($(PKG_CAT),unzip)
- PKG_UNPACK=unzip -d $(PKG_BUILD_DIR) $(DL_DIR)/$(PKG_SOURCE)
+ PKG_UNPACK:=unzip -d $(PKG_BUILD_DIR)/.. $(DL_DIR)/$(PKG_SOURCE)
endif
# replace zcat with $(ZCAT), because some system have it as gzcat
ifeq ($(PKG_CAT),zcat)
- PKG_UNPACK:=$(ZCAT) $(DL_DIR)/$(PKG_SOURCE) | $(TAR) -C $(PKG_BUILD_DIR)/.. $(TAR_OPTIONS)
+ PKG_UNPACK:=$(ZCAT) $(DL_DIR)/$(PKG_SOURCE) | $(HOST_TAR) -C $(PKG_BUILD_DIR)/.. $(TAR_OPTIONS)
endif
else
# try to autodetect file type
KBUILD_VERBOSE:=$(V)
endif
-ifneq ($(shell tty -s <&3 || echo x),x)
+ifeq ($(IS_TTY),1)
_Y:="\\33[33m"# yellow
_N:="\\33[m"# normal
endif
include $(TOPDIR)/include/verbose.mk
export SHELL=/usr/bin/env bash -c '. $(TOPDIR)/include/shell.sh; eval "$$2"' --
-export BASH=$(shell which bash)
ARCH:=$(strip $(subst ",, $(CONFIG_ARCH)))
TARGET_OPTIMIZATION:=$(strip $(subst ",, $(CONFIG_TARGET_OPTIMIZATION)))
PACKAGE_DIR:=$(BIN_DIR)/packages
IPKG_TARGET_DIR:=$(PACKAGE_DIR)
BUILD_DIR:=$(TOPDIR)/build_$(ARCH)
-TMP_DIR:=$(BUILD_DIR)/tmp
+TMP_DIR:=$(TOPDIR)/tmp
STAMP_DIR:=$(BUILD_DIR)/stamp
TARGET_DIR:=$(BUILD_DIR)/root
IPKG_STATE_DIR:=$(TARGET_DIR)/usr/lib/ipkg
IMAGE:=$(BUILD_DIR)/root_fs_$(ARCH)
-TARGET_PATH:=$(STAGING_DIR)/usr/bin:$(STAGING_DIR)/bin:$(PATH)
+TARGET_PATH:=$(STAGING_DIR)/usr/sbin:$(STAGING_DIR)/usr/bin:$(STAGING_DIR)/bin:$(PATH)
TARGET_CFLAGS:=$(TARGET_OPTIMIZATION)
export PATH:=$(TARGET_PATH)
TARGET_CC:= ccache $(TARGET_CC)
endif
+EXTRA_CPPFLAGS := -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include
+EXTRA_CFLAGS := $(EXTRA_CPPFLAGS)
+EXTRA_LDFLAGS := -L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib
+
TARGET_CONFIGURE_OPTS:= \
AR=$(TARGET_CROSS)ar \
AS="$(TARGET_CC) -c $(TARGET_CFLAGS)" \
GCC="$(TARGET_CC)" \
CXX=$(TARGET_CROSS)g++ \
RANLIB=$(TARGET_CROSS)ranlib \
- STRIP=$(TARGET_CROSS)strip
+ STRIP=$(TARGET_CROSS)strip \
+ OBJCOPY=$(TARGET_CROSS)objcopy
# strip an entire directory
RSTRIP:= \
TAR_OPTIONS:=-xf -
endif
+define shvar
+V_$(subst .,_,$(subst -,_,$(subst /,_,$(1))))
+endef
+
+define shexport
+$(call shvar,$(1))=$$(call $(1))
+export $(call shvar,$(1))
+endef
+
+
all:
FORCE: ;
.PHONY: FORCE