2 # Copyright (C) 2007-2008 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 ifneq ($(__target_inc
),1)
14 # Default packages - the really basic set
15 DEFAULT_PACKAGES
:=base-files libgcc uclibc busybox dropbear mtd uci opkg
17 DEFAULT_PACKAGES.router
:=dnsmasq iptables ppp ppp-mod-pppoe kmod-ipt-nathelper firewall
19 DEFAULT_PACKAGES.router
+=luci-admin-full luci-admin-mini luci-i18n-english luci-app-firewall luci-sgi-cgi
21 # Additional packages for Linux 2.6
23 DEFAULT_PACKAGES
+= udevtrigger hotplug2
26 # Add device specific packages
27 DEFAULT_PACKAGES
+= $(DEFAULT_PACKAGES.
$(DEVICE_TYPE
))
33 target_conf
=$(subst .
,_
,$(subst -,_
,$(subst /,_
,$(1))))
35 PLATFORM_DIR
:=$(TOPDIR
)/target
/linux
/$(BOARD
)
36 SUBTARGET
:=$(strip $(foreach subdir
,$(patsubst $(PLATFORM_DIR
)/%/target.mk
,%,$(wildcard $(PLATFORM_DIR
)/*/target.mk
)),$(if
$(CONFIG_TARGET_
$(call target_conf
,$(BOARD
)_
$(subdir
))),$(subdir
))))
38 PLATFORM_DIR
:=${CURDIR}
41 TARGETID
:=$(BOARD
)$(if
$(SUBTARGET
),/$(SUBTARGET
))
42 PLATFORM_SUBDIR
:=$(PLATFORM_DIR
)$(if
$(SUBTARGET
),/$(SUBTARGET
))
44 ifneq ($(TARGET_BUILD
),1)
45 include $(PLATFORM_DIR
)/Makefile
46 ifneq ($(PLATFORM_DIR
),$(PLATFORM_SUBDIR
))
47 include $(PLATFORM_SUBDIR
)/target.mk
51 -include .
/$(SUBTARGET
)/target.mk
55 define Profile
/Default
62 $(eval
$(call Profile
/Default
))
63 $(eval
$(call Profile
/$(1)))
64 $(eval
$(call shexport
,Profile
/$(1)/Config
))
65 $(eval
$(call shexport
,Profile
/$(1)/Description
))
67 echo
"Target-Profile: $(1)"; \
68 echo
"Target-Profile-Name: $(NAME)"; \
69 echo
"Target-Profile-Packages: $(PACKAGES)"; \
70 if
[ -f .
/config
/profile-
$(1) ]; then \
71 echo
"Target-Profile-Kconfig: yes"; \
73 echo
"Target-Profile-Config: "; \
74 getvar
"$(call shvar,Profile/$(1)/Config)"; \
76 echo
"Target-Profile-Description:"; \
77 getvar
"$(call shvar,Profile/$(1)/Description)"; \
80 ifeq ($(CONFIG_TARGET_
$(call target_conf
,$(BOARD
)_
$(if
$(SUBTARGET
),$(SUBTARGET
)_
)$(1))),y
)
86 ifneq ($(PLATFORM_DIR
),$(PLATFORM_SUBDIR
))
87 define IncludeProfiles
88 -include $(PLATFORM_DIR
)/profiles
/*.mk
89 -include $(PLATFORM_SUBDIR
)/profiles
/*.mk
92 define IncludeProfiles
93 -include $(PLATFORM_DIR
)/profiles
/*.mk
97 ifeq ($(TARGET_BUILD
),1)
98 $(eval
$(call IncludeProfiles
))
101 $(eval
$(call IncludeProfiles
))
105 $(eval
$(call shexport
,Target
/Description
))
107 include $(INCLUDE_DIR
)/kernel-version.mk
109 GENERIC_PLATFORM_DIR
:= $(TOPDIR
)/target
/linux
/generic-
$(KERNEL
)
110 GENERIC_PATCH_DIR
:= $(GENERIC_PLATFORM_DIR
)/patches
$(shell [ -d
"$(GENERIC_PLATFORM_DIR)/patches-$(KERNEL_PATCHVER)" ] && printf
-- "-$(KERNEL_PATCHVER)" || true
)
111 GENERIC_FILES_DIR
:= $(foreach dir,$(wildcard $(GENERIC_PLATFORM_DIR
)/files
$(GENERIC_PLATFORM_DIR
)/files-
$(KERNEL_PATCHVER
)),"$(dir)")
113 GENERIC_LINUX_CONFIG?
=$(firstword $(wildcard $(GENERIC_PLATFORM_DIR
)/config-
$(KERNEL_PATCHVER
) $(GENERIC_PLATFORM_DIR
)/config-default
))
114 LINUX_CONFIG?
=$(firstword $(wildcard $(foreach subdir
,$(PLATFORM_DIR
) $(PLATFORM_SUBDIR
),$(subdir
)/config-
$(KERNEL_PATCHVER
) $(subdir
)/config-default
)) $(PLATFORM_DIR
)/config-
$(KERNEL_PATCHVER
))
115 LINUX_SUBCONFIG?
=$(firstword $(wildcard $(PLATFORM_SUBDIR
)/config-
$(KERNEL_PATCHVER
) $(PLATFORM_SUBDIR
)/config-default
))
116 ifeq ($(LINUX_CONFIG
),$(LINUX_SUBCONFIG
))
119 LINUX_CONFCMD
=$(if
$(LINUX_CONFIG
),$(SCRIPT_DIR
)/kconfig.pl
+ $(GENERIC_LINUX_CONFIG
) $(if
$(LINUX_SUBCONFIG
),+ $(LINUX_CONFIG
) $(LINUX_SUBCONFIG
),$(LINUX_CONFIG
)),true
)
122 BuildTarget
=$(BuildTargets
/DumpCurrent
)
125 TMP_CONFIG
:=$(TMP_DIR
)/.kconfig-
$(call target_conf
,$(TARGETID
))
126 $(TMP_CONFIG
): $(GENERIC_LINUX_CONFIG
) $(LINUX_CONFIG
) $(LINUX_SUBCONFIG
)
127 $(LINUX_CONFCMD
) > $@ ||
rm -f
$@
128 -include $(TMP_CONFIG
)
129 .SILENT
: $(TMP_CONFIG
)
130 .PRECIOUS
: $(TMP_CONFIG
)
132 ifneq ($(CONFIG_GENERIC_GPIO
),)
135 ifneq ($(CONFIG_PCI
),)
138 ifneq ($(CONFIG_USB
)$(CONFIG_USB_SUPPORT
),)
141 ifneq ($(CONFIG_PCMCIA
)$(CONFIG_PCCARD
),)
144 ifneq ($(CONFIG_VGA_CONSOLE
)$(CONFIG_FB
),)
149 FEATURES
:=$(sort $(FEATURES
))
153 define BuildTargets
/DumpCurrent
156 @echo
'Target: $(TARGETID)'; \
157 echo
'Target-Board: $(BOARD)'; \
158 echo
'Target-Kernel: $(KERNEL)'; \
159 echo
'Target-Name: $(BOARDNAME)$(if $(SUBTARGET),, [$(KERNEL)])'; \
160 echo
'Target-Path: $(subst $(TOPDIR)/,,$(PWD))'; \
161 echo
'Target-Arch: $(ARCH)'; \
162 echo
'Target-Features: $(FEATURES)'; \
163 echo
'Target-Depends: $(DEPENDS)'; \
164 echo
'Linux-Version: $(LINUX_VERSION)'; \
165 echo
'Linux-Release: $(LINUX_RELEASE)'; \
166 echo
'Linux-Kernel-Arch: $(LINUX_KARCH)'; \
167 echo
'Target-Description:'; \
168 getvar
$(call shvar
,Target
/Description
); \
170 echo
'Default-Packages: $(DEFAULT_PACKAGES)'; \
172 $(if
$(SUBTARGET
),,@
$(foreach SUBTARGET
,$(SUBTARGETS
),$(SUBMAKE
) -s DUMP
=1 SUBTARGET
=$(SUBTARGET
); ))
175 include $(INCLUDE_DIR
)/kernel.mk
176 ifeq ($(TARGET_BUILD
),1)
177 include $(INCLUDE_DIR
)/kernel-build.mk
178 BuildTarget?
=$(BuildKernel
)