2 # Copyright (C) 2007 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
17 DEFAULT_PACKAGES.router
:=dnsmasq iptables ppp ppp-mod-pppoe iptables kmod-ipt-nathelper bridge
19 # Additional packages for Linux 2.6
21 DEFAULT_PACKAGES
+= udevtrigger hotplug2
24 # Add device specific packages
25 DEFAULT_PACKAGES
+= $(DEFAULT_PACKAGES.
$(DEVICE_TYPE
))
31 target_conf
=$(subst .
,_
,$(subst -,_
,$(subst /,_
,$(1))))
33 PLATFORM_DIR
:=$(TOPDIR
)/target
/linux
/$(BOARD
)
34 SUBTARGET
:=$(strip $(foreach subdir
,$(patsubst $(PLATFORM_DIR
)/%/target.mk
,%,$(wildcard $(PLATFORM_DIR
)/*/target.mk
)),$(if
$(CONFIG_TARGET_
$(call target_conf
,$(BOARD
)_
$(subdir
))),$(subdir
))))
36 PLATFORM_DIR
:=${CURDIR}
39 TARGETID
:=$(BOARD
)$(if
$(SUBTARGET
),/$(SUBTARGET
))
40 PLATFORM_SUBDIR
:=$(PLATFORM_DIR
)$(if
$(SUBTARGET
),/$(SUBTARGET
))
42 ifneq ($(TARGET_BUILD
),1)
43 include $(PLATFORM_DIR
)/Makefile
44 ifneq ($(PLATFORM_DIR
),$(PLATFORM_SUBDIR
))
45 include $(PLATFORM_SUBDIR
)/target.mk
49 -include .
/$(SUBTARGET
)/target.mk
53 define Profile
/Default
60 $(eval
$(call Profile
/Default
))
61 $(eval
$(call Profile
/$(1)))
62 $(eval
$(call shexport
,Profile
/$(1)/Config
))
63 $(eval
$(call shexport
,Profile
/$(1)/Description
))
65 echo
"Target-Profile: $(1)"; \
66 echo
"Target-Profile-Name: $(NAME)"; \
67 echo
"Target-Profile-Packages: $(PACKAGES)"; \
68 if
[ -f .
/config
/profile-
$(1) ]; then \
69 echo
"Target-Profile-Kconfig: yes"; \
71 echo
"Target-Profile-Config: "; \
72 getvar
"$(call shvar,Profile/$(1)/Config)"; \
74 echo
"Target-Profile-Description:"; \
75 getvar
"$(call shvar,Profile/$(1)/Description)"; \
78 ifeq ($(CONFIG_TARGET_
$(call target_conf
,$(BOARD
)_
$(if
$(SUBTARGET
),$(SUBTARGET
)_
)$(1))),y
)
84 ifneq ($(PLATFORM_DIR
),$(PLATFORM_SUBDIR
))
85 define IncludeProfiles
86 -include $(PLATFORM_DIR
)/profiles
/*.mk
87 -include $(PLATFORM_SUBDIR
)/profiles
/*.mk
90 define IncludeProfiles
91 -include $(PLATFORM_DIR
)/profiles
/*.mk
95 ifeq ($(TARGET_BUILD
),1)
96 $(eval
$(call IncludeProfiles
))
99 $(eval
$(call IncludeProfiles
))
103 $(eval
$(call shexport
,Target
/Description
))
105 include $(INCLUDE_DIR
)/kernel-version.mk
107 GENERIC_PLATFORM_DIR
:= $(TOPDIR
)/target
/linux
/generic-
$(KERNEL
)
108 GENERIC_PATCH_DIR
:= $(GENERIC_PLATFORM_DIR
)/patches
$(shell [ -d
"$(GENERIC_PLATFORM_DIR)/patches-$(KERNEL_PATCHVER)" ] && printf
-- "-$(KERNEL_PATCHVER)" || true
)
110 GENERIC_LINUX_CONFIG?
=$(firstword $(wildcard $(GENERIC_PLATFORM_DIR
)/config-
$(KERNEL_PATCHVER
) $(GENERIC_PLATFORM_DIR
)/config-default
))
111 LINUX_CONFIG?
=$(firstword $(wildcard $(foreach subdir
,$(PLATFORM_DIR
) $(PLATFORM_SUBDIR
),$(subdir
)/config-
$(KERNEL_PATCHVER
) $(subdir
)/config-default
)))
112 LINUX_SUBCONFIG?
=$(firstword $(wildcard $(PLATFORM_SUBDIR
)/config-
$(KERNEL_PATCHVER
) $(PLATFORM_SUBDIR
)/config-default
))
113 ifeq ($(LINUX_CONFIG
),$(LINUX_SUBCONFIG
))
116 LINUX_CONFCMD
=$(if
$(LINUX_CONFIG
),$(SCRIPT_DIR
)/kconfig.pl
+ $(GENERIC_LINUX_CONFIG
) $(if
$(LINUX_SUBCONFIG
),+ $(LINUX_CONFIG
) $(LINUX_SUBCONFIG
),$(LINUX_CONFIG
)),true
)
119 BuildTarget
=$(BuildTargets
/DumpCurrent
)
122 TMP_CONFIG
:=$(TMP_DIR
)/.kconfig-
$(call target_conf
,$(TARGETID
))
123 $(TMP_CONFIG
): $(GENERIC_LINUX_CONFIG
) $(LINUX_CONFIG
) $(LINUX_SUBCONFIG
)
124 $(LINUX_CONFCMD
) > $@ ||
rm -f
$@
125 -include $(TMP_CONFIG
)
126 .SILENT
: $(TMP_CONFIG
)
127 .PRECIOUS
: $(TMP_CONFIG
)
129 ifneq ($(CONFIG_PCI
),)
132 ifneq ($(CONFIG_USB
),)
135 ifneq ($(CONFIG_PCMCIA
)$(CONFIG_PCCARD
),)
138 ifneq ($(CONFIG_VGA_CONSOLE
)$(CONFIG_FB
),)
143 FEATURES
:=$(sort $(FEATURES
))
147 define BuildTargets
/DumpCurrent
150 @echo
'Target: $(TARGETID)'; \
151 echo
'Target-Board: $(BOARD)'; \
152 echo
'Target-Kernel: $(KERNEL)'; \
153 echo
'Target-Name: $(BOARDNAME)$(if $(SUBTARGET),, [$(KERNEL)])'; \
154 echo
'Target-Path: $(subst $(TOPDIR)/,,$(PWD))'; \
155 echo
'Target-Arch: $(ARCH)'; \
156 echo
'Target-Features: $(FEATURES)'; \
157 echo
'Target-Depends: $(DEPENDS)'; \
158 echo
'Linux-Version: $(LINUX_VERSION)'; \
159 echo
'Linux-Release: $(LINUX_RELEASE)'; \
160 echo
'Linux-Kernel-Arch: $(LINUX_KARCH)'; \
161 echo
'Target-Description:'; \
162 getvar
$(call shvar
,Target
/Description
); \
164 echo
'Default-Packages: $(DEFAULT_PACKAGES)'; \
166 $(if
$(SUBTARGET
),,@
$(foreach SUBTARGET
,$(SUBTARGETS
),$(SUBMAKE
) -s DUMP
=1 SUBTARGET
=$(SUBTARGET
); ))
169 include $(INCLUDE_DIR
)/kernel.mk
170 ifeq ($(TARGET_BUILD
),1)
171 include $(INCLUDE_DIR
)/kernel-build.mk
172 BuildTarget?
=$(BuildKernel
)