1 # This file is part of the OpenADK project. OpenADK is copyrighted
2 # material, please see the LICENCE file in the top-level directory.
7 ifneq ($(shell umask
2>/dev
/null | sed
's/0*022/OK/'),OK
)
8 $(error your umask is not
022)
11 CONFIG_CONFIG_IN
= Config.in
13 DEFCONFIG
= ADK_DEVELSYSTEM
=n \
17 ADK_FORCE_PARALLEL
=n \
20 ADK_PACKAGE_BASE_FILES
=y \
21 ADK_COMPILE_HEIMDAL
=n \
22 ADK_PACKAGE_HEIMDAL_PKINIT
=n \
23 ADK_PACKAGE_HEIMDAL_SERVER
=n \
24 ADK_PACKAGE_LIBHEIMDAL
=n \
25 ADK_PACKAGE_LIBHEIMDAL_CLIENT
=n \
28 BUSYBOX_MODPROBE_SMALL
=n \
30 BUSYBOX_BUILD_LIBBUSYBOX
=n \
31 BUSYBOX_FEATURE_2_4_MODULES
=n \
32 BUSYBOX_LOCALE_SUPPORT
=n \
33 BUSYBOX_FEATURE_PREFER_APPLETS
=n \
34 BUSYBOX_FEATURE_SUID
=n \
35 BUSYBOX_SELINUXENABLED
=n \
36 BUSYBOX_FEATURE_INSTALLER
=n \
38 BUSYBOX_FLASH_LOCK
=n \
39 BUSYBOX_FLASH_UNLOCK
=n \
40 BUSYBOX_FLASH_ERASEALL
=n \
47 BUSYBOX_FEATURE_AIX_LABEL
=n \
48 BUSYBOX_FEATURE_SUN_LABEL
=n \
49 BUSYBOX_FEATURE_OSF_LABEL
=n \
50 BUSYBOX_FEATURE_SGI_LABEL
=n \
51 ADK_KERNEL_RT2X00_DEBUG
=n \
52 ADK_KERNEL_ATH5K_DEBUG
=n \
53 ADK_KERNEL_DEBUG_WITH_KGDB
=n
55 noconfig_targets
:= menuconfig \
63 if
[ -f .config.old
];then \
64 if
[ -f .busyboxcfg
];then \
69 # Pull in the user's configuration file
70 ifeq ($(filter $(noconfig_targets
),$(MAKECMDGOALS
)),)
71 -include $(TOPDIR
)/.config
74 ifeq ($(strip $(ADK_HAVE_DOT_CONFIG
)),y
)
75 include $(TOPDIR
)/rules.mk
76 include ${TOPDIR}/mk
/split-cfg.mk
80 ${TOPDIR}/package
/Depends.mk
: ${TOPDIR}/.config
$(wildcard ${TOPDIR}/package
/*/Makefile
)
81 mksh
${TOPDIR}/package
/depmaker
84 .PHONY
: all world
clean cleantarget cleandir
distclean image_clean
86 world
: $(DISTDIR
) $(BUILD_DIR
) $(TARGET_DIR
) $(PACKAGE_DIR
) ${TOPDIR}/.ADK_HAVE_DOT_CONFIG
87 ${BASH} ${TOPDIR}/scripts
/scan-pkgs.sh
88 ifeq ($(ADK_NATIVE
),y
)
89 $(MAKE
) -f mk
/build.mk toolchain
/kernel-headers-prepare target
/config-prepare target
/compile package
/compile root_clean package
/install package_index target
/install
91 ifeq ($(ADK_TOOLCHAIN_ONLY
),y
)
92 $(MAKE
) -f mk
/build.mk toolchain
/install package
/compile
94 $(MAKE
) -f mk
/build.mk toolchain
/install target
/config-prepare target
/compile package
/compile root_clean package
/install package_index target
/install
99 ifeq ($(ADK_TARGET_PACKAGE_IPKG
),y
)
100 -cd
${PACKAGE_DIR} && \
101 ${BASH} ${TOPDIR}/scripts
/ipkg-make-index.sh .
>Packages
108 mkdir
-p
$(BUILD_DIR
)
111 mkdir
-p
$(TARGET_DIR
)
114 mkdir
-p
${PACKAGE_DIR}/.stamps
116 ${STAGING_DIR} ${STAGING_DIR}/etc
${STAGING_TOOLS}:
117 mkdir
-p
${STAGING_DIR}/{bin
,etc
,lib
,usr
/include} \
118 ${STAGING_TOOLS}/{bin
,lib
}
120 ${STAGING_DIR}/etc
/ipkg.conf
: ${STAGING_DIR}/etc
121 ifeq ($(ADK_TARGET_PACKAGE_IPKG
),y
)
122 echo
"dest root /" >${STAGING_DIR}/etc
/ipkg.conf
123 echo
"option offline_root ${TARGET_DIR}" >>$(STAGING_DIR
)/etc
/ipkg.conf
126 package
/%: ${TOPDIR}/.ADK_HAVE_DOT_CONFIG
${STAGING_DIR}/etc
/ipkg.conf
${TOPDIR}/package
/Depends.mk
127 $(MAKE
) -C package
$(patsubst package
/%,%,$@
)
129 target
/%: ${TOPDIR}/.ADK_HAVE_DOT_CONFIG
130 $(MAKE
) -C target
$(patsubst target
/%,%,$@
)
132 toolchain
/%: ${STAGING_DIR}
133 $(MAKE
) -C toolchain
$(patsubst toolchain
/%,%,$@
)
136 $(MAKE
) -C target image
139 echo
"Saving configuration for target: ${ADK_TARGET}"
140 cp
-p .config .config.
${ADK_TARGET}
141 if
[ -f .config.old
];then cp
-p .config.old .config.old.
${ADK_TARGET};fi
142 if
[ -f .config.split
];then cp
-p .config.split .config.split.
${ADK_TARGET};fi
143 if
[ -f .config.
${TARGET} ];then cp
-p .config.
${TARGET} .config
; \
144 cp
-p .config.old.
${TARGET} .config.old
; \
145 cp
-p .config.split.
${TARGET} .config.split
; \
146 echo
"Setting configuration to target: ${TARGET}"; \
147 else echo
"No old target config found";mv .config .config.bak
; make TARGET
=${TARGET};fi
150 cp
$(TOPDIR
)/target
/$(ADK_TARGET
)/kernel.config
$(BUILD_DIR
)/linux
/.config
151 $(MAKE
) -C
$(BUILD_DIR
)/linux
/ ARCH
=$(ARCH
) menuconfig
152 cp
$(BUILD_DIR
)/linux
/.config
$(TOPDIR
)/target
/$(ADK_TARGET
)/kernel.config
154 # create a new package from package/.template
156 @echo
"Creating new package $(PKG)"
157 $(CP
) $(TOPDIR
)/package
/.template
$(TOPDIR
)/package
/$(PKG
)
158 pkg
=$$(echo
$(PKG
)|tr
'[:lower:]-' '[:upper:]_'); \
159 $(SED
) "s#@UPKG@#$$pkg#" $(TOPDIR
)/package
/$(PKG
)/Makefile
160 $(SED
) 's#@PKG@#$(PKG)#' $(TOPDIR
)/package
/$(PKG
)/Makefile
161 $(SED
) 's#@VER@#$(VER)#' $(TOPDIR
)/package
/$(PKG
)/Makefile
162 @echo
"Edit package/$(PKG)/Makefile to complete"
163 @echo
"Do not forget to add package to package/Config.in"
165 #############################################################
167 # Cleanup and misc junk
169 #############################################################
173 mkdir
-p
$(TARGET_DIR
)
175 # Do a per-package clean here, too. This way stale headers and
176 # libraries from cross_*/target/ get wiped away, which keeps
177 # future package build's configure scripts from returning false
178 # dependencies information.
182 $(MAKE
) -C
$(CONFIG
) clean
183 for d in
${STAGING_PARENT}; do \
184 for f in
$$(ls
$$d/pkg
/[a-z
]* 2>/dev
/null
); do \
185 while read file
; do \
186 rm $$d/target
/$$file 2>/dev
/null
; \
191 rm -rf
$(BUILD_DIR
) $(BIN_DIR
) $(TARGET_DIR
) \
192 ${TOPDIR}/.cfg_
${ADK_TARGET}_
${ADK_LIBC} \
193 ${TOPDIR}/package
/pkglist.d
194 rm -f
${TOPDIR}/package
/*/info.mk
${TOPDIR}/package
/Depends.mk
197 @
$(TRACE
) cleankernel
198 rm -rf
$(TOOLCHAIN_BUILD_DIR
)/linux
* $(BUILD_DIR
)/linux
202 @
$(MAKE
) -C
$(CONFIG
) clean $(MAKE_TRACE
)
203 rm -rf
$(BUILD_DIR_PFX
) $(BIN_DIR_PFX
) $(TARGET_DIR_PFX
) \
204 ${TOPDIR}/.cfg
* ${TOPDIR}/package
/pkglist.d
205 rm -rf
$(TOOLCHAIN_BUILD_DIR_PFX
) $(STAGING_PARENT_PFX
) \
207 rm -f .menu .tmpconfig.h
${TOPDIR}/package
/*/info.mk \
208 ${TOPDIR}/package
/Depends.mk
${TOPDIR}/prereq.mk \
212 @
$(TRACE
) cleantarget
213 @
$(MAKE
) -C
$(CONFIG
) clean $(MAKE_TRACE
)
214 rm -rf
$(BUILD_DIR
) $(BIN_DIR
) $(TARGET_DIR
) \
215 ${TOPDIR}/.cfg_
${ADK_TARGET}_
${ADK_LIBC}
216 rm -rf
$(TOOLCHAIN_BUILD_DIR
) $(STAGING_PARENT
)
217 rm -f .tmpconfig.h
${TOPDIR}/package
/*/info.mk \
218 .busyboxcfg
all.config .defconfig
222 @
$(MAKE
) -C
$(CONFIG
) clean $(MAKE_TRACE
)
223 @
rm -rf
$(BUILD_DIR_PFX
) $(BIN_DIR_PFX
) $(TARGET_DIR_PFX
) $(DISTDIR
) \
224 ${TOPDIR}/.cfg
* ${TOPDIR}/package
/pkglist.d
225 @
rm -rf
$(TOOLCHAIN_BUILD_DIR_PFX
) $(STAGING_PARENT_PFX
) \
227 @
rm -f .config
* .defconfig .tmpconfig.h
all.config
${TOPDIR}/prereq.mk \
228 .menu
${TOPDIR}/package
/*/info.mk
${TOPDIR}/package
/Depends.mk \
229 .busyboxcfg .ADK_HAVE_DOT_CONFIG
231 else # ! ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
233 ifeq ($(filter-out distclean,${MAKECMDGOALS}),)
234 include ${TOPDIR}/mk
/vars.mk
236 include $(TOPDIR
)/prereq.mk
237 export BASH HOSTCC HOSTCFLAGS MAKE LANGUAGE LC_ALL OStype PATH
241 @echo
"Start the build with \"make\" or with \"make v\" to be verbose"
244 # ---------------------------------------------------------------------------
246 # force entering the subdir, as dependency checking is done there
247 .PHONY
: $(CONFIG
)/conf
$(CONFIG
)/mconf
250 @
$(MAKE
) -C
$(CONFIG
) conf
253 @
$(MAKE
) -C
$(CONFIG
)
255 defconfig
: .menu
$(CONFIG
)/conf
256 ifeq (${OStype},Linux
)
257 @echo ADK_HOST_LINUX
=y
> $(TOPDIR
)/.defconfig
259 ifeq (${OStype},FreeBSD
)
260 @echo ADK_HOST_FREEBSD
=y
> $(TOPDIR
)/.defconfig
262 ifeq (${OStype},MirBSD
)
263 @echo ADK_HOST_MIRBSD
=y
> $(TOPDIR
)/.defconfig
265 ifeq (${OStype},OpenBSD
)
266 @echo ADK_HOST_OPENBSD
=y
> $(TOPDIR
)/.defconfig
268 ifeq (${OStype},NetBSD
)
269 @echo ADK_HOST_NETBSD
=y
> $(TOPDIR
)/.defconfig
271 ifneq (,$(filter CYGWIN
%,${OStype}))
272 @echo ADK_HOST_CYGWIN
=y
> $(TOPDIR
)/.defconfig
274 @if
[ ! -z
"$(TARGET)" ];then \
275 grep
"^config" target
/Config.in \
276 |grep
-i
"$(TARGET)"\
$$ \
277 |sed
-e
"s#^config \(.*\)#\1=y#" \
278 >> $(TOPDIR
)/.defconfig
; \
279 for symbol in
${DEFCONFIG}; do \
280 echo
$$symbol >> $(TOPDIR
)/.defconfig
; \
283 @if
[ ! -z
"$(FS)" ];then \
284 grep
"^config" target
/Config.in \
286 |sed
-e
"s#^config \(.*\)#\1=y#" \
287 >> $(TOPDIR
)/.defconfig
; \
289 @if
[ ! -z
"$(PKG)" ];then \
290 grep
"^config" target
/Config.in \
292 |sed
-e
"s#^config \(.*\)#\1=y#" \
293 >> $(TOPDIR
)/.defconfig
; \
295 @if
[ ! -z
"$(LIBC)" ];then \
296 grep
"^config" target
/Config.in \
298 |sed
-e
"s#^config \(.*\)#\1=y#" \
299 >> $(TOPDIR
)/.defconfig
; \
301 ifneq (,$(filter %_qemu
,${TARGET}))
302 @echo ADK_LINUX_QEMU
=y
>> $(TOPDIR
)/.defconfig
304 ifneq (,$(filter %_toolchain
,${TARGET}))
305 @echo ADK_LINUX_TOOLCHAIN
=y
>> $(TOPDIR
)/.defconfig
307 ifneq (,$(filter rescue
%,${TARGET}))
308 @echo ADK_LINUX_RESCUE
=y
>> $(TOPDIR
)/.defconfig
310 ifneq (,$(filter rb
%,${TARGET}))
311 @echo ADK_LINUX_MIKROTIK
=y
>> $(TOPDIR
)/.defconfig
313 ifneq (,$(filter alix
%,${TARGET}))
314 @echo ADK_LINUX_ALIX
=y
>> $(TOPDIR
)/.defconfig
316 ifneq (,$(filter wrap
%,${TARGET}))
317 @echo ADK_LINUX_ALIX
=y
>> $(TOPDIR
)/.defconfig
319 @if
[ ! -z
"$(TARGET)" ];then \
320 $(CONFIG
)/conf
-D .defconfig
$(CONFIG_CONFIG_IN
); \
324 ifeq (${OStype},Linux
)
325 @echo ADK_HOST_LINUX
=y
> $(TOPDIR
)/all.config
327 ifeq (${OStype},FreeBSD
)
328 @echo ADK_HOST_FREEBSD
=y
> $(TOPDIR
)/all.config
330 ifeq (${OStype},MirBSD
)
331 @echo ADK_HOST_MIRBSD
=y
> $(TOPDIR
)/all.config
333 ifeq (${OStype},OpenBSD
)
334 @echo ADK_HOST_OPENBSD
=y
> $(TOPDIR
)/all.config
336 ifeq (${OStype},NetBSD
)
337 @echo ADK_HOST_NETBSD
=y
> $(TOPDIR
)/all.config
339 ifneq (,$(filter CYGWIN
%,${OStype}))
340 @echo ADK_HOST_CYGWIN
=y
> $(TOPDIR
)/all.config
342 @if
[ ! -z
"$(TARGET)" ];then \
343 grep
"^config" target
/Config.in \
344 |grep
-i
"$(TARGET)"\
$$ \
345 |sed
-e
"s#^config \(.*\)#\1=y#" \
346 >> $(TOPDIR
)/all.config
; \
347 for symbol in
${DEFCONFIG}; do \
348 echo
$$symbol >> $(TOPDIR
)/all.config
; \
351 @if
[ ! -z
"$(FS)" ];then \
352 grep
"^config" target
/Config.in \
354 |sed
-e
"s#^config \(.*\)#\1=y#" \
355 >> $(TOPDIR
)/all.config
; \
357 @if
[ ! -z
"$(PKG)" ];then \
358 grep
"^config" target
/Config.in \
360 |sed
-e
"s#^config \(.*\)#\1=y#" \
361 >> $(TOPDIR
)/all.config
; \
363 @if
[ ! -z
"$(LIBC)" ];then \
364 grep
"^config" target
/Config.in \
366 |sed
-e
"s#^config \(.*\)#\1=y#" \
367 >> $(TOPDIR
)/all.config
; \
369 ifneq (,$(filter %_qemu
,${TARGET}))
370 @echo ADK_LINUX_QEMU
=y
>> $(TOPDIR
)/all.config
372 ifneq (,$(filter %_toolchain
,${TARGET}))
373 @echo ADK_LINUX_TOOLCHAIN
=y
>> $(TOPDIR
)/all.config
375 ifneq (,$(filter %_rescue
,${TARGET}))
376 @echo ADK_LINUX_RESCUE
=y
>> $(TOPDIR
)/all.config
378 ifneq (,$(filter rb
%,${TARGET}))
379 @echo ADK_LINUX_MIKROTIK
=y
>> $(TOPDIR
)/all.config
381 ifneq (,$(filter alix
%,${TARGET}))
382 @echo ADK_LINUX_ALIX
=y
>> $(TOPDIR
)/all.config
384 ifneq (,$(filter wrap
%,${TARGET}))
385 @echo ADK_LINUX_ALIX
=y
>> $(TOPDIR
)/all.config
388 menuconfig
: $(CONFIG
)/mconf defconfig .menu
389 @if
[ ! -f .config
];then \
390 $(CONFIG
)/conf
-D .defconfig
$(CONFIG_CONFIG_IN
); \
392 @
$(CONFIG
)/mconf
$(CONFIG_CONFIG_IN
)
395 _config
: $(CONFIG
)/conf .menu
397 @
$(CONFIG
)/conf
${W} $(CONFIG_CONFIG_IN
)
400 .NOTPARALLEL
: _mconfig
401 _mconfig
: ${CONFIG}/conf _mconfig2 _config
402 _mconfig2
: ${CONFIG}/conf modconfig .menu
403 @
${CONFIG}/conf
-m
${RCONFIG} >/dev
/null
406 @
$(MAKE
) -C
$(CONFIG
) clean
407 @
rm -rf
$(BUILD_DIR_PFX
) $(BIN_DIR_PFX
) $(TARGET_DIR_PFX
) $(DISTDIR
) \
408 ${TOPDIR}/.cfg
* ${TOPDIR}/package
/pkglist.d
409 @
rm -rf
$(TOOLCHAIN_BUILD_DIR_PFX
) $(STAGING_PARENT_PFX
) $(TOOLS_BUILD_DIR
)
410 @
rm -f .config
* .defconfig .tmpconfig.h
all.config
${TOPDIR}/prereq.mk \
411 .menu
${TOPDIR}/package
/*/info.mk
${TOPDIR}/package
/Depends.mk .ADK_HAVE_DOT_CONFIG
413 endif # ! ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
415 # build all targets and combinations
417 while read target libc fs
; do \
418 mkdir
-p
$(TOPDIR
)/bin
/$${target}_
$$libc; \
420 echo
=== building
$$target $$libc $$fs on
$$(date
); \
422 $(GMAKE
) TARGET
=$$target LIBC
=$$libc FS
=$$fs defconfig
; \
423 $(GMAKE
) VERBOSE
=1 all; \
425 ) 2>&1 | tee
$(TOPDIR
)/bin
/$${target}_
$$libc/$$target-$$libc-$$fs.log
; \
426 done
<${TOPDIR}/target
/bulk.lst
429 while read target libc fs
; do \
430 mkdir
-p
$(TOPDIR
)/bin
/$${target}_
$$libc; \
432 echo
=== building
$$target $$libc $$fs on
$$(date
); \
434 $(GMAKE
) TARGET
=$$target LIBC
=$$libc FS
=$$fs allconfig
; \
435 $(GMAKE
) VERBOSE
=1 all; \
437 ) 2>&1 | tee
$(TOPDIR
)/bin
/$${target}_
$$libc/$$target-$$libc-$$fs.log
; \
438 done
<${TOPDIR}/target
/bulk.lst
441 while read target libc fs
; do \
442 mkdir
-p
$(TOPDIR
)/bin
/$${target}_
$$libc; \
444 echo
=== building
$$target $$libc $$fs on
$$(date
); \
446 $(GMAKE
) TARGET
=$$target LIBC
=$$libc FS
=$$fs allmodconfig
; \
447 $(GMAKE
) VERBOSE
=1 all; \
449 ) 2>&1 | tee
$(TOPDIR
)/bin
/$${target}_
$$libc/$$target-$$libc-$$fs.log
; \
450 done
<${TOPDIR}/target
/bulk.lst
452 menu .menu
: $(wildcard ${TOPDIR}/package
/*/Makefile
)
453 mksh
$(TOPDIR
)/package
/pkgmaker
457 mksh
$(TOPDIR
)/package
/depmaker