2007-10-03 22:22:51 +03:00
|
|
|
#
|
2008-05-09 01:57:12 +03:00
|
|
|
# Copyright (C) 2007-2008 OpenWrt.org
|
2006-06-27 03:35:46 +03:00
|
|
|
#
|
|
|
|
# This is free software, licensed under the GNU General Public License v2.
|
|
|
|
# See /LICENSE for more information.
|
|
|
|
#
|
2006-06-21 17:02:29 +03:00
|
|
|
|
2007-11-15 01:11:07 +02:00
|
|
|
ifneq ($(__target_inc),1)
|
|
|
|
__target_inc=1
|
|
|
|
|
|
|
|
# default device type
|
|
|
|
DEVICE_TYPE?=router
|
|
|
|
|
|
|
|
# Default packages - the really basic set
|
2009-01-08 03:49:11 +02:00
|
|
|
DEFAULT_PACKAGES:=base-files libc libgcc busybox dropbear mtd uci opkg
|
2007-11-15 01:11:07 +02:00
|
|
|
# For router targets
|
2008-11-11 05:02:26 +02:00
|
|
|
DEFAULT_PACKAGES.router:=dnsmasq iptables ppp ppp-mod-pppoe kmod-ipt-nathelper firewall
|
2007-11-15 01:11:07 +02:00
|
|
|
|
|
|
|
# Additional packages for Linux 2.6
|
|
|
|
ifneq ($(KERNEL),2.4)
|
|
|
|
DEFAULT_PACKAGES += udevtrigger hotplug2
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Add device specific packages
|
|
|
|
DEFAULT_PACKAGES += $(DEFAULT_PACKAGES.$(DEVICE_TYPE))
|
|
|
|
|
2007-09-08 22:55:42 +03:00
|
|
|
ifneq ($(DUMP),)
|
|
|
|
all: dumpinfo
|
|
|
|
endif
|
|
|
|
|
|
|
|
target_conf=$(subst .,_,$(subst -,_,$(subst /,_,$(1))))
|
|
|
|
ifeq ($(DUMP),)
|
|
|
|
PLATFORM_DIR:=$(TOPDIR)/target/linux/$(BOARD)
|
|
|
|
SUBTARGET:=$(strip $(foreach subdir,$(patsubst $(PLATFORM_DIR)/%/target.mk,%,$(wildcard $(PLATFORM_DIR)/*/target.mk)),$(if $(CONFIG_TARGET_$(call target_conf,$(BOARD)_$(subdir))),$(subdir))))
|
|
|
|
else
|
|
|
|
PLATFORM_DIR:=${CURDIR}
|
|
|
|
endif
|
|
|
|
|
|
|
|
TARGETID:=$(BOARD)$(if $(SUBTARGET),/$(SUBTARGET))
|
|
|
|
PLATFORM_SUBDIR:=$(PLATFORM_DIR)$(if $(SUBTARGET),/$(SUBTARGET))
|
|
|
|
|
|
|
|
ifneq ($(TARGET_BUILD),1)
|
2009-03-03 15:54:29 +02:00
|
|
|
ifndef DUMP
|
|
|
|
include $(PLATFORM_DIR)/Makefile
|
|
|
|
ifneq ($(PLATFORM_DIR),$(PLATFORM_SUBDIR))
|
|
|
|
include $(PLATFORM_SUBDIR)/target.mk
|
|
|
|
endif
|
2007-09-08 22:55:42 +03:00
|
|
|
endif
|
|
|
|
else
|
|
|
|
ifneq ($(SUBTARGET),)
|
|
|
|
-include ./$(SUBTARGET)/target.mk
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
define Profile/Default
|
|
|
|
NAME:=
|
|
|
|
PACKAGES:=
|
|
|
|
endef
|
|
|
|
|
2007-11-15 01:11:07 +02:00
|
|
|
ifndef Profile
|
2007-09-08 22:55:42 +03:00
|
|
|
define Profile
|
|
|
|
$(eval $(call Profile/Default))
|
|
|
|
$(eval $(call Profile/$(1)))
|
|
|
|
$(eval $(call shexport,Profile/$(1)/Config))
|
|
|
|
$(eval $(call shexport,Profile/$(1)/Description))
|
|
|
|
DUMPINFO += \
|
|
|
|
echo "Target-Profile: $(1)"; \
|
|
|
|
echo "Target-Profile-Name: $(NAME)"; \
|
|
|
|
echo "Target-Profile-Packages: $(PACKAGES)"; \
|
|
|
|
if [ -f ./config/profile-$(1) ]; then \
|
|
|
|
echo "Target-Profile-Kconfig: yes"; \
|
|
|
|
fi; \
|
|
|
|
echo "Target-Profile-Config: "; \
|
|
|
|
getvar "$(call shvar,Profile/$(1)/Config)"; \
|
|
|
|
echo "@@"; \
|
|
|
|
echo "Target-Profile-Description:"; \
|
|
|
|
getvar "$(call shvar,Profile/$(1)/Description)"; \
|
|
|
|
echo "@@"; \
|
|
|
|
echo;
|
2007-09-08 23:04:43 +03:00
|
|
|
ifeq ($(CONFIG_TARGET_$(call target_conf,$(BOARD)_$(if $(SUBTARGET),$(SUBTARGET)_)$(1))),y)
|
2007-09-08 22:55:42 +03:00
|
|
|
PROFILE=$(1)
|
2007-03-03 01:13:52 +02:00
|
|
|
endif
|
|
|
|
endef
|
2007-11-15 01:11:07 +02:00
|
|
|
endif
|
2007-03-03 01:13:52 +02:00
|
|
|
|
2007-10-03 22:22:51 +03:00
|
|
|
ifneq ($(PLATFORM_DIR),$(PLATFORM_SUBDIR))
|
|
|
|
define IncludeProfiles
|
|
|
|
-include $(PLATFORM_DIR)/profiles/*.mk
|
2007-09-28 04:23:56 +03:00
|
|
|
-include $(PLATFORM_SUBDIR)/profiles/*.mk
|
2007-10-03 22:22:51 +03:00
|
|
|
endef
|
|
|
|
else
|
|
|
|
define IncludeProfiles
|
|
|
|
-include $(PLATFORM_DIR)/profiles/*.mk
|
|
|
|
endef
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(TARGET_BUILD),1)
|
|
|
|
$(eval $(call IncludeProfiles))
|
|
|
|
else
|
|
|
|
ifeq ($(DUMP),)
|
|
|
|
$(eval $(call IncludeProfiles))
|
2007-09-28 04:23:56 +03:00
|
|
|
endif
|
2007-09-08 23:04:43 +03:00
|
|
|
endif
|
2007-09-08 22:55:42 +03:00
|
|
|
|
2007-09-08 23:04:43 +03:00
|
|
|
$(eval $(call shexport,Target/Description))
|
2007-09-08 22:55:42 +03:00
|
|
|
|
2009-03-03 15:54:29 +02:00
|
|
|
ifneq ($(TARGET_BUILD)$(if $(DUMP),,1),)
|
|
|
|
include $(INCLUDE_DIR)/kernel-version.mk
|
|
|
|
endif
|
2007-09-08 22:55:42 +03:00
|
|
|
|
|
|
|
GENERIC_PLATFORM_DIR := $(TOPDIR)/target/linux/generic-$(KERNEL)
|
2009-03-03 16:55:53 +02:00
|
|
|
GENERIC_PATCH_DIR := $(GENERIC_PLATFORM_DIR)/patches$(if $(wildcard $(GENERIC_PLATFORM_DIR)/patches-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER))
|
2008-10-19 00:43:30 +03:00
|
|
|
GENERIC_FILES_DIR := $(foreach dir,$(wildcard $(GENERIC_PLATFORM_DIR)/files $(GENERIC_PLATFORM_DIR)/files-$(KERNEL_PATCHVER)),"$(dir)")
|
2007-09-08 22:55:42 +03:00
|
|
|
|
2007-09-16 17:09:57 +03:00
|
|
|
GENERIC_LINUX_CONFIG?=$(firstword $(wildcard $(GENERIC_PLATFORM_DIR)/config-$(KERNEL_PATCHVER) $(GENERIC_PLATFORM_DIR)/config-default))
|
2008-06-13 18:28:31 +03:00
|
|
|
LINUX_CONFIG?=$(firstword $(wildcard $(foreach subdir,$(PLATFORM_DIR) $(PLATFORM_SUBDIR),$(subdir)/config-$(KERNEL_PATCHVER) $(subdir)/config-default)) $(PLATFORM_DIR)/config-$(KERNEL_PATCHVER))
|
2007-09-08 22:55:42 +03:00
|
|
|
LINUX_SUBCONFIG?=$(firstword $(wildcard $(PLATFORM_SUBDIR)/config-$(KERNEL_PATCHVER) $(PLATFORM_SUBDIR)/config-default))
|
|
|
|
ifeq ($(LINUX_CONFIG),$(LINUX_SUBCONFIG))
|
|
|
|
LINUX_SUBCONFIG:=
|
|
|
|
endif
|
|
|
|
LINUX_CONFCMD=$(if $(LINUX_CONFIG),$(SCRIPT_DIR)/kconfig.pl + $(GENERIC_LINUX_CONFIG) $(if $(LINUX_SUBCONFIG),+ $(LINUX_CONFIG) $(LINUX_SUBCONFIG),$(LINUX_CONFIG)),true)
|
|
|
|
|
|
|
|
ifeq ($(DUMP),1)
|
|
|
|
BuildTarget=$(BuildTargets/DumpCurrent)
|
|
|
|
|
|
|
|
ifneq ($(BOARD),)
|
|
|
|
TMP_CONFIG:=$(TMP_DIR)/.kconfig-$(call target_conf,$(TARGETID))
|
|
|
|
$(TMP_CONFIG): $(GENERIC_LINUX_CONFIG) $(LINUX_CONFIG) $(LINUX_SUBCONFIG)
|
|
|
|
$(LINUX_CONFCMD) > $@ || rm -f $@
|
|
|
|
-include $(TMP_CONFIG)
|
|
|
|
.SILENT: $(TMP_CONFIG)
|
|
|
|
.PRECIOUS: $(TMP_CONFIG)
|
|
|
|
|
2008-04-20 12:46:45 +03:00
|
|
|
ifneq ($(CONFIG_GENERIC_GPIO),)
|
|
|
|
FEATURES += gpio
|
|
|
|
endif
|
2007-09-08 22:55:42 +03:00
|
|
|
ifneq ($(CONFIG_PCI),)
|
|
|
|
FEATURES += pci
|
|
|
|
endif
|
2008-09-08 14:33:00 +03:00
|
|
|
ifneq ($(CONFIG_USB)$(CONFIG_USB_SUPPORT),)
|
2007-09-08 22:55:42 +03:00
|
|
|
FEATURES += usb
|
|
|
|
endif
|
|
|
|
ifneq ($(CONFIG_PCMCIA)$(CONFIG_PCCARD),)
|
|
|
|
FEATURES += pcmcia
|
|
|
|
endif
|
2007-10-26 00:08:46 +03:00
|
|
|
ifneq ($(CONFIG_VGA_CONSOLE)$(CONFIG_FB),)
|
|
|
|
FEATURES += display
|
|
|
|
endif
|
2007-09-08 22:55:42 +03:00
|
|
|
|
|
|
|
# remove duplicates
|
|
|
|
FEATURES:=$(sort $(FEATURES))
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
define BuildTargets/DumpCurrent
|
2007-10-20 22:10:06 +03:00
|
|
|
.PHONY: dumpinfo
|
2007-09-08 22:55:42 +03:00
|
|
|
dumpinfo:
|
|
|
|
@echo 'Target: $(TARGETID)'; \
|
|
|
|
echo 'Target-Board: $(BOARD)'; \
|
|
|
|
echo 'Target-Kernel: $(KERNEL)'; \
|
2009-02-20 12:32:45 +02:00
|
|
|
echo 'Target-Name: $(BOARDNAME)$(if $(SUBTARGETS),, [$(KERNEL)])$(if $(SUBTARGETS),$(if $(SUBTARGET), [$(KERNEL)]))'; \
|
2007-09-08 22:55:42 +03:00
|
|
|
echo 'Target-Path: $(subst $(TOPDIR)/,,$(PWD))'; \
|
|
|
|
echo 'Target-Arch: $(ARCH)'; \
|
|
|
|
echo 'Target-Features: $(FEATURES)'; \
|
2007-10-06 00:44:43 +03:00
|
|
|
echo 'Target-Depends: $(DEPENDS)'; \
|
2007-09-08 22:55:42 +03:00
|
|
|
echo 'Linux-Version: $(LINUX_VERSION)'; \
|
|
|
|
echo 'Linux-Release: $(LINUX_RELEASE)'; \
|
|
|
|
echo 'Linux-Kernel-Arch: $(LINUX_KARCH)'; \
|
|
|
|
echo 'Target-Description:'; \
|
|
|
|
getvar $(call shvar,Target/Description); \
|
|
|
|
echo '@@'; \
|
|
|
|
echo 'Default-Packages: $(DEFAULT_PACKAGES)'; \
|
|
|
|
$(DUMPINFO)
|
2007-10-20 22:10:06 +03:00
|
|
|
$(if $(SUBTARGET),,@$(foreach SUBTARGET,$(SUBTARGETS),$(SUBMAKE) -s DUMP=1 SUBTARGET=$(SUBTARGET); ))
|
2007-09-08 22:55:42 +03:00
|
|
|
endef
|
2007-03-03 01:36:59 +02:00
|
|
|
|
2007-09-08 22:55:42 +03:00
|
|
|
include $(INCLUDE_DIR)/kernel.mk
|
|
|
|
ifeq ($(TARGET_BUILD),1)
|
|
|
|
include $(INCLUDE_DIR)/kernel-build.mk
|
|
|
|
BuildTarget?=$(BuildKernel)
|
2007-01-10 23:52:28 +02:00
|
|
|
endif
|
2006-06-21 17:02:29 +03:00
|
|
|
|
2007-09-08 22:55:42 +03:00
|
|
|
endif #__target_inc
|