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 libc libgcc busybox dropbear mtd uci opkg
17 DEFAULT_PACKAGES.router
:=dnsmasq iptables ppp ppp-mod-pppoe kmod-ipt-nathelper firewall
18 DEFAULT_PACKAGES.bootloader
:=
20 # Additional packages for Linux 2.6
22 DEFAULT_PACKAGES
+= udevtrigger hotplug2
25 # Add device specific packages
26 DEFAULT_PACKAGES
+= $(DEFAULT_PACKAGES.
$(DEVICE_TYPE
))
32 target_conf
=$(subst .
,_
,$(subst -,_
,$(subst /,_
,$(1))))
34 PLATFORM_DIR
:=$(TOPDIR
)/target
/linux
/$(BOARD
)
35 SUBTARGET
:=$(strip $(foreach subdir
,$(patsubst $(PLATFORM_DIR
)/%/target.mk
,%,$(wildcard $(PLATFORM_DIR
)/*/target.mk
)),$(if
$(CONFIG_TARGET_
$(call target_conf
,$(BOARD
)_
$(subdir
))),$(subdir
))))
37 PLATFORM_DIR
:=${CURDIR}
40 TARGETID
:=$(BOARD
)$(if
$(SUBTARGET
),/$(SUBTARGET
))
41 PLATFORM_SUBDIR
:=$(PLATFORM_DIR
)$(if
$(SUBTARGET
),/$(SUBTARGET
))
43 ifneq ($(TARGET_BUILD
),1)
45 include $(PLATFORM_DIR
)/Makefile
46 ifneq ($(PLATFORM_DIR
),$(PLATFORM_SUBDIR
))
47 include $(PLATFORM_SUBDIR
)/target.mk
52 -include .
/$(SUBTARGET
)/target.mk
56 define Profile
/Default
63 $(eval
$(call Profile
/Default
))
64 $(eval
$(call Profile
/$(1)))
65 $(eval
$(call shexport
,Profile
/$(1)/Config
))
66 $(eval
$(call shexport
,Profile
/$(1)/Description
))
68 echo
"Target-Profile: $(1)"; \
69 echo
"Target-Profile-Name: $(NAME)"; \
70 echo
"Target-Profile-Packages: $(PACKAGES)"; \
71 if
[ -f .
/config
/profile-
$(1) ]; then \
72 echo
"Target-Profile-Kconfig: yes"; \
74 echo
"Target-Profile-Config: "; \
75 getvar
"$(call shvar,Profile/$(1)/Config)"; \
77 echo
"Target-Profile-Description:"; \
78 getvar
"$(call shvar,Profile/$(1)/Description)"; \
81 ifeq ($(CONFIG_TARGET_
$(call target_conf
,$(BOARD
)_
$(if
$(SUBTARGET
),$(SUBTARGET
)_
)$(1))),y
)
87 ifneq ($(PLATFORM_DIR
),$(PLATFORM_SUBDIR
))
88 define IncludeProfiles
89 -include $(PLATFORM_DIR
)/profiles
/*.mk
90 -include $(PLATFORM_SUBDIR
)/profiles
/*.mk
93 define IncludeProfiles
94 -include $(PLATFORM_DIR
)/profiles
/*.mk
98 ifeq ($(TARGET_BUILD
),1)
99 $(eval
$(call IncludeProfiles
))
102 $(eval
$(call IncludeProfiles
))
106 $(eval
$(call shexport
,Target
/Description
))
108 ifneq ($(TARGET_BUILD
)$(if
$(DUMP
),,1),)
109 include $(INCLUDE_DIR
)/kernel-version.mk
112 GENERIC_PLATFORM_DIR
:= $(TOPDIR
)/target
/linux
/generic-
$(KERNEL
)
113 GENERIC_PATCH_DIR
:= $(GENERIC_PLATFORM_DIR
)/patches
$(if
$(wildcard $(GENERIC_PLATFORM_DIR
)/patches-
$(KERNEL_PATCHVER
)),-$(KERNEL_PATCHVER
))
114 GENERIC_FILES_DIR
:= $(foreach dir,$(wildcard $(GENERIC_PLATFORM_DIR
)/files
$(GENERIC_PLATFORM_DIR
)/files-
$(KERNEL_PATCHVER
)),"$(dir)")
116 GENERIC_LINUX_CONFIG?
=$(firstword $(wildcard $(GENERIC_PLATFORM_DIR
)/config-
$(KERNEL_PATCHVER
) $(GENERIC_PLATFORM_DIR
)/config-default
))
117 LINUX_CONFIG?
=$(firstword $(wildcard $(foreach subdir
,$(PLATFORM_DIR
) $(PLATFORM_SUBDIR
),$(subdir
)/config-
$(KERNEL_PATCHVER
) $(subdir
)/config-default
)) $(PLATFORM_DIR
)/config-
$(KERNEL_PATCHVER
))
118 LINUX_SUBCONFIG?
=$(firstword $(wildcard $(PLATFORM_SUBDIR
)/config-
$(KERNEL_PATCHVER
) $(PLATFORM_SUBDIR
)/config-default
))
119 ifeq ($(LINUX_CONFIG
),$(LINUX_SUBCONFIG
))
122 LINUX_CONFCMD
=$(if
$(LINUX_CONFIG
),$(SCRIPT_DIR
)/kconfig.pl
+ $(GENERIC_LINUX_CONFIG
) $(if
$(LINUX_SUBCONFIG
),+ $(LINUX_CONFIG
) $(LINUX_SUBCONFIG
),$(LINUX_CONFIG
)),true
)
125 BuildTarget
=$(BuildTargets
/DumpCurrent
)
128 TMP_CONFIG
:=$(TMP_DIR
)/.kconfig-
$(call target_conf
,$(TARGETID
))
129 $(TMP_CONFIG
): $(GENERIC_LINUX_CONFIG
) $(LINUX_CONFIG
) $(LINUX_SUBCONFIG
)
130 $(LINUX_CONFCMD
) > $@ ||
rm -f
$@
131 -include $(TMP_CONFIG
)
132 .SILENT
: $(TMP_CONFIG
)
133 .PRECIOUS
: $(TMP_CONFIG
)
135 ifneq ($(CONFIG_GENERIC_GPIO
),)
138 ifneq ($(CONFIG_PCI
),)
141 ifneq ($(CONFIG_USB
)$(CONFIG_USB_SUPPORT
),)
144 ifneq ($(CONFIG_PCMCIA
)$(CONFIG_PCCARD
),)
147 ifneq ($(CONFIG_VGA_CONSOLE
)$(CONFIG_FB
),)
152 FEATURES
:=$(sort $(FEATURES
))
154 DEFAULT_CFLAGS_i386
=-O2
-pipe
-march
=i486
-funit-at-a-time
155 DEFAULT_CFLAGS_x86_64
=-O2
-pipe
-march
=athlon64
-funit-at-a-time
156 DEFAULT_CFLAGS_mips
=-Os
-pipe
-mips32
-mtune
=mips32
-funit-at-a-time
157 DEFAULT_CFLAGS_mipsel
=$(DEFAULT_CFLAGS_mips
)
158 DEFAULT_CFLAGS_arm
=-Os
-pipe
-march
=armv5te
-mtune
=xscale
-funit-at-a-time
159 DEFAULT_CFLAGS_armeb
=$(DEFAULT_CFLAGS_arm
)
160 DEFAULT_CFLAGS
=$(if
$(DEFAULT_CFLAGS_
$(ARCH
)),$(DEFAULT_CFLAGS_
$(ARCH
)),-Os
-pipe
-funit-at-a-time
)
163 define BuildTargets
/DumpCurrent
166 @echo
'Target: $(TARGETID)'; \
167 echo
'Target-Board: $(BOARD)'; \
168 echo
'Target-Kernel: $(KERNEL)'; \
169 echo
'Target-Name: $(BOARDNAME)$(if $(SUBTARGETS),, [$(KERNEL)])$(if $(SUBTARGETS),$(if $(SUBTARGET), [$(KERNEL)]))'; \
170 echo
'Target-Path: $(subst $(TOPDIR)/,,$(PWD))'; \
171 echo
'Target-Arch: $(ARCH)'; \
172 echo
'Target-Features: $(FEATURES)'; \
173 echo
'Target-Depends: $(DEPENDS)'; \
174 echo
'Target-Optimization: $(if $(CFLAGS),$(CFLAGS),$(DEFAULT_CFLAGS))'; \
175 echo
'Linux-Version: $(LINUX_VERSION)'; \
176 echo
'Linux-Release: $(LINUX_RELEASE)'; \
177 echo
'Linux-Kernel-Arch: $(LINUX_KARCH)'; \
178 echo
'Target-Description:'; \
179 getvar
$(call shvar
,Target
/Description
); \
181 echo
'Default-Packages: $(DEFAULT_PACKAGES)'; \
183 $(if
$(SUBTARGET
),,@
$(foreach SUBTARGET
,$(SUBTARGETS
),$(SUBMAKE
) -s DUMP
=1 SUBTARGET
=$(SUBTARGET
); ))
186 include $(INCLUDE_DIR
)/kernel.mk
187 ifeq ($(TARGET_BUILD
),1)
188 include $(INCLUDE_DIR
)/kernel-build.mk
189 BuildTarget?
=$(BuildKernel
)