Browse Source

rework prereq check

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
wbx 8 years ago
parent
commit
fba2ff3192

+ 1 - 2
.gitignore

@@ -30,12 +30,11 @@
 /toolchain_*/
 /.ADK_HAVE_DOT_CONFIG
 /.tmpconfig.h
-/.prereq_done
 /.config*
 /.busyboxcfg
 /.rebuild.*
 /.defconfig
-/.adkinit
+/.firstrun
 /.menu
 /all.config
 /target_*/

+ 0 - 27
BSDmakefile

@@ -1,27 +0,0 @@
-# This file is part of the OpenADK project. OpenADK is copyrighted
-# material, please see the LICENCE file in the top-level directory.
-
-ADK_TOPDIR=		${.CURDIR}
-PWD=		${.CURDIR}
-
-.include "${.CURDIR}/Makefile.inc"
-
-.if defined(package) && !empty(package)
-subdir:=	package/${package}
-.  if !make(clean)
-_subdir_dep:=	${ADK_TOPDIR}/.config
-.  endif
-.endif
-
-.if defined(subdir) && !empty(subdir)
-_subdir:=	${.TARGETS}
-${.TARGETS}: _subdir
-
-_subdir: ${_subdir_dep}
-	cd ${.CURDIR}/${subdir} && ADK_TOPDIR=${.CURDIR} DEVELOPER=1 \
-	    ${GMAKE} ADK_VERBOSE=1 ${.MFLAGS} ${_subdir}
-
-.  include "${.CURDIR}/prereq.mk"
-.else
-.  include "${.CURDIR}/Makefile"
-.endif

+ 4 - 4
Config.in

@@ -10,7 +10,7 @@ config ADK_MODULES
 	default y
 
 config ADK_HAVE_DOT_CONFIG
-	boolean
+	bool
 	default y
 
 source "target/config/Config.in.appliances"
@@ -44,7 +44,7 @@ menu "Package options"
 	visible if !ADK_CHOOSE_APPLIANCE
 
 config ADK_LEAVE_ETC_ALONE
-	boolean "do not install anything into /etc"
+	bool "do not install anything into /etc"
 	default n
 	help
 	  Enabling this option will prevent the ADK from installing anything
@@ -60,7 +60,7 @@ config ADK_LEAVE_ETC_ALONE
 	  on will almost certainly render the resulting system unusable.
 
 config ADK_INSTALL_PACKAGE_INIT_SCRIPTS
-	boolean "ship custom init-scripts along with packages"
+	bool "ship custom init-scripts along with packages"
 	default y
 	depends on !ADK_LEAVE_ETC_ALONE
 	help
@@ -72,7 +72,7 @@ config ADK_INSTALL_PACKAGE_INIT_SCRIPTS
 	  off will almost certainly render the resulting system unusable.
 
 config ADK_INSTALL_PACKAGE_NETWORK_SCRIPTS
-	boolean "ship custom network-scripts along with packages"
+	bool "ship custom network-scripts along with packages"
 	default y
 	depends on !ADK_LEAVE_ETC_ALONE
 	help

+ 0 - 24
GNUmakefile

@@ -1,24 +0,0 @@
-# This file is part of the OpenADK project. OpenADK is copyrighted
-# material, please see the LICENCE file in the top-level directory.
-
-ADK_TOPDIR:=	$(shell pwd)
-PWD:=		${ADK_TOPDIR}
-
-include Makefile.inc
-
-ifneq (${package},)
-subdir:=	package/${package}
-_subdir_dep:=	${ADK_TOPDIR}/.config
-endif
-
-ifneq (${subdir},)
-${MAKECMDGOALS}: _subdir
-
-_subdir: ${_subdir_dep}
-	cd ${subdir} && ADK_TOPDIR=${ADK_TOPDIR} DEVELOPER=1 \
-	    make ADK_VERBOSE=1 ${MAKEFLAGS} ${MAKECMDGOALS}
-
-include prereq.mk
-else
-include Makefile
-endif

+ 3 - 218
Makefile

@@ -1,221 +1,6 @@
 # This file is part of the OpenADK project. OpenADK is copyrighted
 # material, please see the LICENCE file in the top-level directory.
 
-_UNLIMIT=	__limit=$$(ulimit -dH 2>/dev/null); \
-		test -n "$$__limit" && ulimit -Sd $$__limit; ulimit -n 1024;
-
-all: .prereq_done checkreloc
-	@${_UNLIMIT} ${GMAKE_INV} all
-
-v: .prereq_done
-	@(echo; echo "Build started on $$(LC_ALL=C LANGUAGE=C date)"; \
-	    set -x; ${_UNLIMIT} ${GMAKE_FMK} ADK_VERBOSE=1 all) 2>&1 | tee -a make.log
-
-help:
-	@echo 'Configuration targets:'
-	@echo '  config       - Update current config utilising a line-oriented program'
-	@echo '  menuconfig   - Update current config utilising a menu based program'
-	@echo '                 (default when .config does not exist)'
-	@echo '  oldconfig    - Update current config utilising a provided .configs base'
-	@echo '  defconfig    - New config with defaults'
-	@echo '  allmodconfig - New config selecting all symbols with m'
-	@echo '  allyesconfig - New config selecting all symbols with y'
-	@echo '  allnoconfig  - New config where all options are answered with no'
-	@echo ''
-	@echo 'Help targets:'
-	@echo '  help         - Print this help text'
-	@echo '  pkg-help     - Print help about selectively compiling single packages'
-	@echo '  dev-help     - Print help for developers / package maintainers'
-	@echo ''
-	@echo 'Common targets:'
-	@echo '  download     - fetches all needed distfiles'
-	@echo '  kernelconfig - view the target kernel configuration'
-	@echo ''
-	@echo 'Cleaning targets:'
-	@echo '  clean        - Remove firmware and build directories'
-	@echo '  cleandir     - Same as "clean", but also remove all built toolchains'
-	@echo '  cleansystem  - Same as "cleandir", but only remove active system'
-	@echo '  cleankernel  - Remove kernel dir, useful if you changed any kernel patches'
-	@echo '  distclean    - Same as "cleandir", but also remove downloaded'
-	@echo '                 distfiles and .config'
-	@echo ''
-	@echo 'Other generic targets:'
-	@echo '  all          - Build everything as specified in .config'
-	@echo '                 (default if .config exists)'
-	@echo '  v            - Same as "all" but with logging to make.log enabled'
-
-pkg-help:
-	@echo 'Package specific targets (use with "package=<pkg-name>" parameter):'
-	@echo '  fetch        - Download the necessary distfile'
-	@echo '  extract      - Same as "fetch", but also extract the distfile'
-	@echo '  patch        - Same as "extract", but also patch the source'
-	@echo '  build        - Same as "patch", but also build the binaries'
-	@echo '  fake         - Same as "build", but also install the binaries'
-	@echo '  package      - Same as "fake", but also create the package'
-	@echo '  clean        - Deinstall and remove the build area'
-	@echo '  distclean    - Same as "clean", but also remove the distfiles'
-	@echo ''
-	@echo 'Short package rebuilding guide:'
-	@echo '  run "make package=<pkgname> clean" to remove all generated binaries'
-	@echo '  run "make package=<pkgname> package" to build everything and create the package(s)'
-	@echo ''
-	@echo 'This does not automatically resolve package dependencies!'
-
-dev-help:
-	@echo 'Fast way of updating package patches:'
-	@echo '  run "make package=<pkgname> clean" to start with a good base'
-	@echo '  run "make package=<pkgname> patch" to fetch, unpack and patch the source'
-	@echo '  edit the package sources at build_dir/w-<pkgname>-*/<pkgname>-<version>'
-	@echo '  run "make package=<pkgname> update-patches" to regenerate patch files'
-	@echo ''
-	@echo 'All changed patches will be opened with your $$EDITOR,'
-	@echo 'so you can add a description and verify the modifications.'
-	@echo ''
-	@echo 'Adding a new package:'
-	@echo 'make PKG=foo VER=1.0 newpackage'
-	@echo 'Adding a new simple library package:'
-	@echo 'make PKG=foo VER=1.0 TYPE=lib newpackage'
-	@echo 'Adding a new simple program package:'
-	@echo 'make PKG=foo VER=1.0 TYPE=prog newpackage'
-
-clean: .prereq_done
-	-@rm -f nohup.out
-	@${GMAKE_INV} clean
-
-config: .prereq_done
-	@${GMAKE_INV} _config W=
-
-oldconfig: .prereq_done
-	@${GMAKE_INV} _config W=--oldconfig
-
-download: .prereq_done
-	@${GMAKE_INV} toolchain/download
-	@${GMAKE_INV} dep
-	@${GMAKE_INV} package/download
-
-cleankernel kernelclean: .prereq_done
-	-@${GMAKE_INV} cleankernel
-
-cleandir dirclean: .prereq_done
-	-@${GMAKE_INV} cleandir
-	@-rm -f make.log .prereq_done
-
-cleansystem: .prereq_done
-	-@${GMAKE_INV} cleansystem
-	@-rm -f make.log .prereq_done
-
-distclean cleandist:
-	-@${GMAKE_INV} distclean
-	@-rm -f make.log .prereq_done
-
-image: .prereq_done
-	@${GMAKE_INV} image
-
-targethelp: .prereq_done
-	@${GMAKE_INV} targethelp
-
-kernelconfig: .prereq_done
-	@${GMAKE_INV} kernelconfig
-
-newpackage: .prereq_done
-	@${GMAKE_INV} newpackage
-
-image_clean imageclean cleanimage: .prereq_done
-	@${GMAKE_INV} image_clean
-
-menuconfig: .prereq_done
-	@${GMAKE_INV} menuconfig
-
-defconfig: .prereq_done
-	@${GMAKE_INV} defconfig
-
-allnoconfig: .prereq_done
-	@${GMAKE_INV} KCONFIG_ALLCONFIG=all.config _config W=--allnoconfig
-
-allyesconfig: .prereq_done
-	@${GMAKE_INV} KCONFIG_ALLCONFIG=all.config _config W=--allyesconfig
-
-allmodconfig: .prereq_done
-	@${GMAKE_INV} KCONFIG_ALLCONFIG=all.config _config W=--allmodconfig
-
-package_index: .prereq_done
-	@${GMAKE_INV} package_index
-
-buildall: .prereq_done
-	@${GMAKE_INV} buildall
-
-check: .prereq_done
-	@${GMAKE_INV} check
-
-check-gcc: .prereq_done
-	@${GMAKE_INV} check-gcc
-
-check-g++: .prereq_done
-	@${GMAKE_INV} check-g++
-
-menu: .prereq_done
-	@${GMAKE_INV} menu
-
-dep: .prereq_done
-	@${GMAKE_INV} dep
-
-world: .prereq_done
-	@${GMAKE_INV} world
-
-prereq:
-	@rm -f .prereq_done
-	@${GMAKE} .prereq_done
-
-prereq-noerror:
-	@rm -f .prereq_done
-	@${GMAKE} .prereq_done NO_ERROR=1
-
-NO_ERROR=0
-.prereq_done:
-	@-rm -rf .prereq_done
-	@if ! bash --version 2>&1 | grep -F 'GNU bash' >/dev/null 2>&1; then \
-		echo "GNU bash needs to be installed."; \
-		exit 1; \
-	fi
-	@echo "ADK_TOPDIR:=$$(readlink -nf . 2>/dev/null || pwd -P)" >prereq.mk
-	@echo "BASH:=$$(which bash)" >>prereq.mk
-	@if [ -z "$$(which gmake 2>/dev/null )" ]; then \
-		echo "GMAKE:=$$(which make)" >>prereq.mk ;\
-	else \
-		echo "GMAKE:=$$(which gmake)" >>prereq.mk ;\
-	fi
-	@echo "GNU_HOST_NAME:=$$(${CC} -dumpmachine)" >>prereq.mk
-	@echo "ARCH_FOR_BUILD:=$$(${CC} -dumpmachine | sed \
-	    -e 's/x86_64-linux-gnux32/x32/' \
-	    -e s'/-.*//' \
-	    -e 's/sparc.*/sparc/' \
-	    -e 's/armeb.*/armeb/g' \
-	    -e 's/arm.*/arm/g' \
-	    -e 's/m68k.*/m68k/' \
-	    -e 's/sh[234]/sh/' \
-	    -e 's/mips-.*/mips/' \
-	    -e 's/mipsel-.*/mipsel/' \
-	    -e 's/i[3-9]86/x86/' \
-	    )" >>prereq.mk
-	@echo 'HOST_CC:=${CC}' >>prereq.mk
-	@echo 'HOST_CXX:=${CXX}' >>prereq.mk
-	@echo 'LANGUAGE:=C' >>prereq.mk
-	@echo 'LC_ALL:=C' >>prereq.mk
-	@echo 'MAKE:=$${GMAKE}' >>prereq.mk
-	@echo "OStype:=$$(env uname)" >>prereq.mk
-	@echo "_PATH:=$$PATH" >>prereq.mk
-	@echo "PATH:=\$${ADK_TOPDIR}/scripts:/usr/sbin:$$PATH" >>prereq.mk
-	@echo "SHELL:=$$(which bash)" >>prereq.mk
-	@echo "GIT:=$$(which git 2>/dev/null)" >>prereq.mk
-	@env NO_ERROR=${NO_ERROR} BASH="$$(which bash)" \
-		CC='${CC}' CPPFLAGS='${CPPFLAGS}' \
-	    	bash scripts/scan-tools.sh
-	@echo '===> Prerequisites checked successfully.'
-	@touch .adkinit
-	@touch $@
-
-checkreloc:
-	@bash scripts/reloc.sh
-
-.PHONY: prereq prereq-noerror checkreloc
-# DO NOT DELETE
+# GNU make and BSD make compatible make file wrapper
+all v menuconfig download clean cleankernel cleansystem cleandir distclean hostclean hostpackage package:
+	@./scripts/prereq.sh $@

+ 181 - 0
Makefile.adk

@@ -0,0 +1,181 @@
+# This file is part of the OpenADK project. OpenADK is copyrighted
+# material, please see the LICENCE file in the top-level directory.
+
+ADK_TOPDIR:=	$(shell pwd)
+GMAKE?=		env ${GMAKE_ENV} $(PWD)/scripts/make
+GMAKE_FMK=	${MAKE} -f $(PWD)/mk/build.mk
+GMAKE_INV=	${GMAKE_FMK} --no-print-directory
+
+_UNLIMIT=	__limit=$$(ulimit -dH 2>/dev/null); \
+		test -n "$$__limit" && ulimit -Sd $$__limit; ulimit -n 1024;
+
+ifneq (${package},)
+subdir:=	package/${package}
+_subdir_dep:=	${ADK_TOPDIR}/.config
+endif
+
+ifneq (${subdir},)
+${MAKECMDGOALS}: _subdir
+
+_subdir: ${_subdir_dep}
+	cd ${subdir} && ADK_TOPDIR=${ADK_TOPDIR} DEVELOPER=1 \
+	    $(GMAKE_INV) ADK_VERBOSE=1 ${MAKECMDGOALS}
+
+endif
+
+all:
+	@${_UNLIMIT} $(GMAKE_INV) world
+
+v:
+	@(echo; echo "Build started on $$(LC_ALL=C LANGUAGE=C date)"; \
+	    set -x; ${_UNLIMIT} ${GMAKE_FMK} ADK_VERBOSE=1 all) 2>&1 | tee -a make.log
+
+help:
+	@echo 'Configuration targets:'
+	@echo '  config       - Update current config utilising a line-oriented program'
+	@echo '  menuconfig   - Update current config utilising a menu based program'
+	@echo '                 (default when .config does not exist)'
+	@echo '  oldconfig    - Update current config utilising a provided .configs base'
+	@echo '  defconfig    - New config with defaults'
+	@echo '  allmodconfig - New config selecting all symbols with m'
+	@echo '  allyesconfig - New config selecting all symbols with y'
+	@echo '  allnoconfig  - New config where all options are answered with no'
+	@echo ''
+	@echo 'Help targets:'
+	@echo '  help         - Print this help text'
+	@echo '  pkg-help     - Print help about selectively compiling single packages'
+	@echo '  dev-help     - Print help for developers / package maintainers'
+	@echo ''
+	@echo 'Common targets:'
+	@echo '  download     - fetches all needed distfiles'
+	@echo '  kernelconfig - view the target kernel configuration'
+	@echo ''
+	@echo 'Cleaning targets:'
+	@echo '  clean        - Remove firmware and build directories'
+	@echo '  cleandir     - Same as "clean", but also remove all built toolchains'
+	@echo '  cleansystem  - Same as "cleandir", but only remove active system'
+	@echo '  cleankernel  - Remove kernel dir, useful if you changed any kernel patches'
+	@echo '  distclean    - Same as "cleandir", but also remove downloaded'
+	@echo '                 distfiles and .config'
+	@echo ''
+	@echo 'Other generic targets:'
+	@echo '  all          - Build everything as specified in .config'
+	@echo '                 (default if .config exists)'
+	@echo '  v            - Same as "all" but with logging to make.log enabled'
+
+pkg-help:
+	@echo 'Package specific targets (use with "package=<pkg-name>" parameter):'
+	@echo '  fetch        - Download the necessary distfile'
+	@echo '  extract      - Same as "fetch", but also extract the distfile'
+	@echo '  patch        - Same as "extract", but also patch the source'
+	@echo '  build        - Same as "patch", but also build the binaries'
+	@echo '  fake         - Same as "build", but also install the binaries'
+	@echo '  package      - Same as "fake", but also create the package'
+	@echo '  clean        - Deinstall and remove the build area'
+	@echo '  distclean    - Same as "clean", but also remove the distfiles'
+	@echo ''
+	@echo 'Short package rebuilding guide:'
+	@echo '  run "make package=<pkgname> clean" to remove all generated binaries'
+	@echo '  run "make package=<pkgname> package" to build everything and create the package(s)'
+	@echo ''
+	@echo 'This does not automatically resolve package dependencies!'
+
+dev-help:
+	@echo 'Fast way of updating package patches:'
+	@echo '  run "make package=<pkgname> clean" to start with a good base'
+	@echo '  run "make package=<pkgname> patch" to fetch, unpack and patch the source'
+	@echo '  edit the package sources at build_dir/w-<pkgname>-*/<pkgname>-<version>'
+	@echo '  run "make package=<pkgname> update-patches" to regenerate patch files'
+	@echo ''
+	@echo 'All changed patches will be opened with your $$EDITOR,'
+	@echo 'so you can add a description and verify the modifications.'
+	@echo ''
+	@echo 'Adding a new package:'
+	@echo 'make PKG=foo VER=1.0 newpackage'
+	@echo 'Adding a new simple library package:'
+	@echo 'make PKG=foo VER=1.0 TYPE=lib newpackage'
+	@echo 'Adding a new simple program package:'
+	@echo 'make PKG=foo VER=1.0 TYPE=prog newpackage'
+
+clean:
+	-@rm -f nohup.out
+	${GMAKE_INV} clean
+
+config:
+	@${GMAKE_INV} _config W=
+
+oldconfig:
+	@${GMAKE_INV} _config W=--oldconfig
+
+download:
+	@${GMAKE_INV} toolchain/download
+	@${GMAKE_INV} dep
+	@${GMAKE_INV} package/download
+
+cleankernel kernelclean:
+	-@${GMAKE_INV} cleankernel
+
+cleandir dirclean:
+	-@${GMAKE_INV} cleandir
+
+cleansystem:
+	-@${GMAKE_INV} cleansystem
+
+distclean cleandist:
+	-${GMAKE_INV} distclean
+
+image:
+	@${GMAKE_INV} image
+
+targethelp:
+	@${GMAKE_INV} targethelp
+
+kernelconfig:
+	@${GMAKE_INV} kernelconfig
+
+newpackage:
+	@${GMAKE_INV} newpackage
+
+image_clean imageclean cleanimage:
+	@${GMAKE_INV} image_clean
+
+menuconfig:
+	@${GMAKE_INV} menuconfig
+
+defconfig:
+	@${GMAKE_INV} defconfig
+
+allnoconfig:
+	@${GMAKE_INV} KCONFIG_ALLCONFIG=all.config _config W=--allnoconfig
+
+allyesconfig:
+	@${GMAKE_INV} KCONFIG_ALLCONFIG=all.config _config W=--allyesconfig
+
+allmodconfig:
+	@${GMAKE_INV} KCONFIG_ALLCONFIG=all.config _config W=--allmodconfig
+
+package_index:
+	@${GMAKE_INV} package_index
+
+buildall:
+	@${GMAKE_INV} buildall
+
+check:
+	@${GMAKE_INV} check
+
+check-gcc:
+	@${GMAKE_INV} check-gcc
+
+check-g++:
+	@${GMAKE_INV} check-g++
+
+menu:
+	@${GMAKE_INV} menu
+
+dep:
+	@${GMAKE_INV} dep
+
+world:
+	@${GMAKE_INV} world
+
+# DO NOT DELETE

+ 0 - 4
Makefile.inc

@@ -1,4 +0,0 @@
-CC?=		gcc
-GMAKE?=		env ${GMAKE_ENV} $(PWD)/scripts/make
-GMAKE_FMK=	${GMAKE} -f $(PWD)/mk/build.mk
-GMAKE_INV=	${GMAKE_FMK} --no-print-directory

+ 1 - 2
README

@@ -18,12 +18,11 @@ Before you can start you need to install some software:
 - zlib library and header
 
 There is a check for the required versions of these software in advance, though.
-(to re-issue the checks, use "make prereq").
 
 Please use "make menuconfig" to choose your target architecture and
 embedded system and configure like you want to.
 
-Simply running 'make' will build the firmware for your embedded system.  The
+Simply running 'make' will build the firmware for your embedded system. The
 buildsystem will download all sources, build the toolchain, the kernel and all
 applications.
 

+ 5 - 5
adk/config/Makefile

@@ -69,19 +69,19 @@ MCONF_OBJS=$(patsubst %.c,%.o, $(MCONF_SRC))
 SHARED_OBJS=$(patsubst %.c,%.o, $(SHARED_SRC))
 
 conf: $(CONF_OBJS) $(SHARED_OBJS)
-	@$(HOST_CC) $(HOST_CFLAGS) $^ -o $@
+	@$(HOST_CC) $(HOST_CFLAGS) $^ -o $@ 2>/dev/null
 
 mconf: $(MCONF_OBJS) $(SHARED_OBJS)
-	@$(HOST_CC) $(HOST_CFLAGS) $^ -o $@ $(LIBS)
+	@$(HOST_CC) $(HOST_CFLAGS) $^ -o $@ $(LIBS) 2>/dev/null
 
 $(CONF_OBJS): %.o : %.c $(SHARED_DEPS)
-	@$(HOST_CC) $(HOST_CFLAGS) -I. -c $< -o $@
+	@$(HOST_CC) $(HOST_CFLAGS) -I. -c $< -o $@ 2>/dev/null
 
 $(MCONF_OBJS): %.o : %.c $(SHARED_DEPS)
-	@$(HOST_CC) $(HOST_CFLAGS) -I. -c $< -o $@
+	@$(HOST_CC) $(HOST_CFLAGS) -I. -c $< -o $@ 2>/dev/null
 
 glob.o: glob.c $(SHARED_DEPS)
-	@$(HOST_CC) $(HOST_CFLAGS) -I. -c glob.c -o $@
+	@$(HOST_CC) $(HOST_CFLAGS) -I. -c glob.c -o $@ 2>/dev/null
 
 lkc_defs.h: lkc_proto.h
 	@sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'

+ 24 - 67
mk/build.mk

@@ -95,9 +95,7 @@ noconfig_targets:=	menuconfig \
 			defconfig
 
 POSTCONFIG=		-@\
-	if [ -f .adkinit ];then rm .adkinit;\
-	else \
-	if [ -f .config.old ];then \
+	if [ ! -f .firstrun ]; then \
 		$(ADK_TOPDIR)/adk/tools/pkgrebuild;\
 		rebuild=0; \
 		cleandir=0; \
@@ -133,22 +131,14 @@ POSTCONFIG=		-@\
 			cleandir=1;\
 			rebuild=1;\
 		fi; \
-		if [ "$$(grep ^ADK_TARGET_ARCH .config|md5sum)" != "$$(grep ^ADK_TARGET_ARCH .config.old|md5sum)" ];then \
-			cleandir=1;\
-			rebuild=1;\
-		fi; \
-		if [ "$$(grep ^ADK_TARGET_SYSTEM .config|md5sum)" != "$$(grep ^ADK_TARGET_SYSTEM .config.old|md5sum)" ];then \
-			cleandir=1;\
-			rebuild=1;\
-		fi; \
 		if [ $$cleandir -eq 1 ];then \
-			echo "You should rebuild with 'make cleandir'";\
+			echo "You should rebuild with 'make cleansystem'";\
 		fi; \
 		if [ $$rebuild -eq 1 ];then \
 			cp .config .config.old;\
 		fi; \
 	fi; \
-	fi
+	if [ -f .firstrun ]; then rm .firstrun; fi
 
 # Pull in the user's configuration file
 ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
@@ -161,8 +151,9 @@ include $(ADK_TOPDIR)/rules.mk
 all: world
 
 ${ADK_TOPDIR}/package/Depends.mk: ${ADK_TOPDIR}/.config $(wildcard ${ADK_TOPDIR}/package/*/Makefile) $(ADK_TOPDIR)/adk/tools/depmaker
-	@echo "Generating dependencies ..."
+	@printf " --->  generating dependencies.. "
 	$(ADK_TOPDIR)/adk/tools/depmaker > ${ADK_TOPDIR}/package/Depends.mk
+	@printf "done\n"
 
 .NOTPARALLEL:
 .PHONY: all world clean cleandir cleansystem distclean image_clean
@@ -170,7 +161,6 @@ ${ADK_TOPDIR}/package/Depends.mk: ${ADK_TOPDIR}/.config $(wildcard ${ADK_TOPDIR}
 world:
 	@mkdir -p $(DL_DIR) $(HOST_BUILD_DIR) $(BUILD_DIR) $(TARGET_DIR) $(FW_DIR) \
 		$(STAGING_HOST_DIR) $(TOOLCHAIN_BUILD_DIR) $(STAGING_PKG_DIR)/stamps
-	${BASH} ${ADK_TOPDIR}/scripts/scan-pkgs.sh
 ifeq ($(ADK_TARGET_TOOLCHAIN),y)
 ifeq ($(ADK_TOOLCHAIN_ONLY),y)
 	$(MAKE) -f mk/build.mk package/hostcompile toolchain/final package/compile
@@ -261,17 +251,20 @@ clean:
 	rm -f ${ADK_TOPDIR}/package/Depends.mk
 
 cleankernel:
-	@$(TRACE) cleankernel
+	@printf " --->  cleaning kernel build directories.. "
 	@rm -rf $(TOOLCHAIN_BUILD_DIR)/w-linux* $(BUILD_DIR)/linux
+	@printf "done\n"
 
 cleandir:
-	@$(TRACE) cleandir
+	@printf " --->  cleaning build directories and files.. "
 	@$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE) 
 	@rm -rf $(BUILD_DIR_PFX) $(FW_DIR_PFX) $(TARGET_DIR_PFX) \
 	    ${ADK_TOPDIR}/package/pkglist.d ${ADK_TOPDIR}/package/pkgconfigs.d
 	@rm -rf $(TOOLCHAIN_DIR_PFX) $(STAGING_HOST_DIR_PFX)
 	@rm -rf $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
-	@rm -f .menu .tmpconfig.h .rebuild* ${ADK_TOPDIR}/package/Depends.mk ${ADK_TOPDIR}/prereq.mk
+	@rm -f .menu .tmpconfig.h .rebuild* 
+	@rm -f ${ADK_TOPDIR}/package/Depends.mk ${ADK_TOPDIR}/prereq.mk
+	@printf "done\n"
 
 cleansystem:
 	@$(TRACE) cleansystem
@@ -280,20 +273,22 @@ cleansystem:
 	    ${ADK_TOPDIR}/package/pkglist.d ${ADK_TOPDIR}/package/pkgconfigs.d
 	@rm -rf $(TOOLCHAIN_DIR) $(STAGING_TARGET_DIR) $(STAGING_PKG_DIR) $(TOOLCHAIN_BUILD_DIR)
 	@rm -f .menu .tmpconfig.h .rebuild* ${ADK_TOPDIR}/package/Depends.mk ${ADK_TOPDIR}/prereq.mk
+	@printf "done\n"
 
 distclean:
-	@$(TRACE) distclean
+	@printf " --->  cleaning build directories, files and downloads.. "
 	@$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE)
 	@rm -rf $(TOOLCHAIN_DIR_PFX) $(STAGING_HOST_DIR_PFX)
 	@rm -rf $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
 	@rm -rf $(BUILD_DIR_PFX) $(FW_DIR_PFX) $(TARGET_DIR_PFX) $(DL_DIR)
 	@rm -rf package/pkglist.d package/pkgconfigs.d
-	@rm -f .adkinit .config* .defconfig .tmpconfig.h all.config prereq.mk
-	@rm -f .menu package/Depends.mk .ADK_HAVE_DOT_CONFIG .rebuild.*
+	@rm -f .config* .defconfig .tmpconfig.h all.config prereq.mk
+	@rm -f .firstrun .menu package/Depends.mk .ADK_HAVE_DOT_CONFIG .rebuild.*
 	@rm -f target/*/Config.in.arch* target/*/Config.in.system*
 	@rm -f package/Config.in.auto* package/Config.in.appliances
 	@rm -f target/config/Config.in.prereq target/config/Config.in.scripts
 	@rm -f adk/tools/pkgmaker adk/tools/depmaker adk/tools/pkgrebuild
+	@printf "done\n"
 
 else # ! ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
 
@@ -301,7 +296,7 @@ ifeq ($(filter-out distclean,${MAKECMDGOALS}),)
 include ${ADK_TOPDIR}/mk/vars.mk
 else
 include $(ADK_TOPDIR)/prereq.mk
-export HOST_CC HOST_CXX BASH MAKE LANGUAGE LC_ALL OStype PATH QEMU SHELL
+export HOST_CC HOST_CXX BASH MAKE LANGUAGE LC_ALL PATH QEMU SHELL SHA256
 endif
 
 all: menuconfig
@@ -450,50 +445,8 @@ defconfig: .menu $(CONFIG)/conf
 	@if [ ! -z "$(ADK_APPLIANCE)" ];then \
 		$(CONFIG)/conf --defconfig=.defconfig $(CONFIG_CONFIG_IN); \
 	fi
-ifeq (${OStype},Linux)
-	@echo ADK_HOST_LINUX=y >> $(ADK_TOPDIR)/.config
-endif
-ifeq (${OStype},FreeBSD)
-	@echo ADK_HOST_FREEBSD=y >> $(ADK_TOPDIR)/.config
-endif
-ifeq (${OStype},MirBSD)
-	@echo ADK_HOST_MIRBSD=y >> $(ADK_TOPDIR)/.config
-endif
-ifeq (${OStype},OpenBSD)
-	@echo ADK_HOST_OPENBSD=y >> $(ADK_TOPDIR)/.config
-endif
-ifeq (${OStype},NetBSD)
-	@echo ADK_HOST_NETBSD=y >> $(ADK_TOPDIR)/.config
-endif
-ifeq (${OStype},Darwin)
-	@echo ADK_HOST_DARWIN=y >> $(ADK_TOPDIR)/.config
-endif
-ifneq (,$(filter CYGWIN%,${OStype}))
-	@echo ADK_HOST_CYGWIN=y >> $(ADK_TOPDIR)/.config
-endif
 
 allconfig:
-ifeq (${OStype},Linux)
-	@echo ADK_HOST_LINUX=y > $(ADK_TOPDIR)/all.config
-endif
-ifeq (${OStype},FreeBSD)
-	@echo ADK_HOST_FREEBSD=y > $(ADK_TOPDIR)/all.config
-endif
-ifeq (${OStype},MirBSD)
-	@echo ADK_HOST_MIRBSD=y > $(ADK_TOPDIR)/all.config
-endif
-ifeq (${OStype},OpenBSD)
-	@echo ADK_HOST_OPENBSD=y > $(ADK_TOPDIR)/all.config
-endif
-ifeq (${OStype},NetBSD)
-	@echo ADK_HOST_NETBSD=y > $(ADK_TOPDIR)/all.config
-endif
-ifeq (${OStype},Darwin)
-	@echo ADK_HOST_DARWIN=y > $(ADK_TOPDIR)/all.config
-endif
-ifneq (,$(filter CYGWIN%,${OStype}))
-	@echo ADK_HOST_CYGWIN=y > $(ADK_TOPDIR)/all.config
-endif
 	@if [ ! -z "$(ADK_APPLIANCE)" ];then \
 		grep "^config" target/config/Config.in.appliances \
 			|grep -i "_$(ADK_APPLIANCE)"\$$ \
@@ -542,18 +495,20 @@ _config: $(CONFIG)/conf allconfig .menu
 	${POSTCONFIG}
 
 distclean:
+	@printf " --->  cleaning build directories, files and downloads.. "
 	@$(MAKE) -C $(CONFIG) clean
 	@rm -rf $(BUILD_DIR_PFX) $(FW_DIR_PFX) $(TARGET_DIR_PFX) $(DL_DIR)
 	@rm -rf $(TOOLCHAIN_DIR_PFX) $(STAGING_TARGET_DIR_PFX)
 	@rm -rf $(STAGING_HOST_DIR_PFX) $(STAGING_TARGET_DIR_PFX) $(STAGING_PKG_DIR_PFX)
 	@rm -rf package/pkglist.d package/pkgconfigs.d
-	@rm -f .adkinit .config* .defconfig .tmpconfig.h all.config
+	@rm -f .config* .defconfig .tmpconfig.h all.config
 	@rm -f .menu .rebuild.* package/Depends.mk .ADK_HAVE_DOT_CONFIG prereq.mk
 	@rm -f target/*/Config.in.arch*
 	@rm -f target/*/Config.in.system*
 	@rm -f package/Config.in.auto* package/Config.in.appliances
 	@rm -f target/config/Config.in.prereq target/config/Config.in.scripts
 	@rm -f adk/tools/pkgmaker adk/tools/depmaker adk/tools/pkgrebuild
+	@printf "done\n"
 
 endif # ! ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y)
 
@@ -573,14 +528,16 @@ $(ADK_TOPDIR)/adk/tools/depmaker: $(ADK_TOPDIR)/adk/tools/depmaker.c
 	@$(HOST_CC) $(HOST_CFLAGS) -o $@ $(ADK_TOPDIR)/adk/tools/depmaker.c
 
 menu .menu: $(wildcard package/*/Makefile) $(wildcard target/*/systems) $(wildcard target/*/systems/*) $(ADK_TOPDIR)/adk/tools/pkgmaker $(ADK_TOPDIR)/adk/tools/pkgrebuild $(wildcard target/appliances/*)
-	@echo "Generating menu structure ..."
+	@printf " --->  generating menu structure.. "
 	@$(BASH) $(ADK_TOPDIR)/scripts/create-menu
 	@$(ADK_TOPDIR)/adk/tools/pkgmaker
 	@:>.menu
+	@printf "done\n"
 
 dep: $(ADK_TOPDIR)/adk/tools/depmaker
-	@echo "Generating dependencies ..."
+	@printf " --->  generating dependencies.. "
 	@$(ADK_TOPDIR)/adk/tools/depmaker > ${ADK_TOPDIR}/package/Depends.mk
+	@printf "done\n"
 
 .PHONY: menu dep
 

+ 1 - 1
mk/buildhlp.mk

@@ -82,7 +82,7 @@ ${WRKDIST}/.prepared: ${WRKDIST}/.extract_done
 		$(MAKE_TRACE)
 	@${MAKE} post-patch $(MAKE_TRACE)
 	# always use latest config.sub/config.guess from OpenADK scripts directory
-	cd ${WRKDIST}; \
+	@cd ${WRKDIST}; \
 	    for i in $$(find . -name config.sub);do \
 		if [ -f $$i ]; then \
 			${CP} ${SCRIPT_DIR}/config.sub $$i; \

+ 1 - 1
mk/fetch.mk

@@ -31,7 +31,7 @@ ifneq ($(ADK_DISABLE_CHECKSUM),y)
 	@if [ ! -e $(firstword ${FULLDISTFILES}).nohash ]; then \
 	OK=n; \
 	allsums="$(strip ${PKG_HASH})"; \
-	(PATH='$(HOST_PATH)' sha256sum ${FULLDISTFILES}; echo exit) | while read sum name; do \
+	($${SHA256} ${FULLDISTFILES}; echo exit) | while read sum name; do \
 		if [[ $$sum = exit ]]; then \
 			[[ $$OK = n ]] && echo >&2 "==> No distfile found!" || :; \
 			[[ $$OK = 1 ]] || exit 1; \

+ 12 - 21
mk/host-bottom.mk

@@ -6,10 +6,10 @@ host-extract: ${_HOST_PATCH_COOKIE}
 hostpre-configure:
 host-configure:
 ${_HOST_CONFIGURE_COOKIE}: ${_HOST_PATCH_COOKIE}
-	@mkdir -p ${WRKBUILD}
-	@$(CMD_TRACE) "host configuring... "
+	mkdir -p ${WRKBUILD}
+	@$(CMD_TRACE) "configuring.. "
 ifneq (,$(filter autogen,${AUTOTOOL_STYLE}))
-	@$(CMD_TRACE) "autotool configuring... "
+	@$(CMD_TRACE) "autotool configuring.. "
 	@cd ${WRKSRC}; env ${AUTOTOOL_ENV} $(BASH) autogen.sh $(MAKE_TRACE)
 endif
 ifneq (,$(filter autoreconf,${AUTOTOOL_STYLE}))
@@ -17,17 +17,6 @@ ifneq (,$(filter autoreconf,${AUTOTOOL_STYLE}))
 	@rm -rf ${WRKSRC}/autom4te.cache
 	@touch ${WRKDIR}/.autoreconf_done
 endif
-	@cd ${WRKBUILD}; \
-	    for i in $$(find . -name config.sub);do \
-		if [ -f $$i ]; then \
-			${CP} ${SCRIPT_DIR}/config.sub $$i; \
-		fi; \
-	    done; \
-	    for i in $$(find . -name config.guess);do \
-		if [ -f $$i ]; then \
-			${CP} ${SCRIPT_DIR}/config.guess $$i; \
-	        fi; \
-	    done;
 	@${MAKE} hostpre-configure $(MAKE_TRACE)
 ifeq (${HOST_STYLE},)
 	cd ${WRKBUILD}; \
@@ -70,7 +59,7 @@ ifeq (${HOST_STYLE},manual)
 	${MAKE} host-configure $(MAKE_TRACE)
 endif
 ifeq (${HOST_STYLE},perl)
-	@$(CMD_TRACE) "configuring perl module... "
+	@$(CMD_TRACE) "configuring perl module.. "
 	cd ${WRKBUILD}; \
 		PATH='${HOST_PATH}' \
 		PERL_MM_USE_DEFAULT=1 \
@@ -83,7 +72,7 @@ endif
 host-build:
 ${_HOST_BUILD_COOKIE}: ${_HOST_CONFIGURE_COOKIE}
 ifneq (${HOST_STYLE},manual)
-	@$(CMD_TRACE) "host compiling... "
+	@$(CMD_TRACE) "compiling.. "
 	cd ${WRKBUILD} && env ${HOST_MAKE_ENV} ${MAKE} -f ${MAKE_FILE} \
 	    ${HOST_MAKE_FLAGS} ${HOST_ALL_TARGET} $(MAKE_TRACE)
 endif
@@ -93,7 +82,7 @@ endif
 hostpost-install:
 host-install: ${ALL_HOSTINST}
 ${_HOST_FAKE_COOKIE}: ${_HOST_BUILD_COOKIE}
-	@$(CMD_TRACE) "host installing... "
+	@$(CMD_TRACE) "installing.. "
 	@mkdir -p ${HOST_WRKINST}
 ifeq (${HOST_STYLE},)
 	cd ${WRKBUILD} && env ${HOST_MAKE_ENV} ${MAKE} -f ${MAKE_FILE} \
@@ -113,16 +102,18 @@ endif
 		$(SED) "s,^prefix=.*,prefix=$(STAGING_HOST_DIR)/usr," $$a; \
 		chmod u+x $(STAGING_HOST_DIR)/usr/bin/$$(basename $$a); \
 	done
-	@touch $@
+	touch $@
 
 ${_HOST_COOKIE}:
+	printf wbxdebug
 	exec ${MAKE} hostpackage
 
 ifeq ($(HOST_LINUX_ONLY),)
 hostpackage: ${ALL_HOSTDIRS}
-	@touch ${_HOST_COOKIE}
+	touch ${_HOST_COOKIE}
 endif
 
 hostclean:
-	@$(CMD_TRACE) "cleaning... "
-	rm -rf ${WRKDIR} ${STAGING_PKG_DIR}/stamps/${PKG_NAME}*-host
+	@$(CMD_TRACE) "cleaning.. "
+	rm -r ${STAGING_PKG_DIR}/stamps/${PKG_NAME}*-host
+	rm -rf ${WRKDIR} 

+ 18 - 7
mk/kernel-build.mk

@@ -34,13 +34,12 @@ ADK_DEPMOD:=true
 endif
 
 $(LINUX_DIR)/.prepared: $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/linux-$(KERNEL_FILE_VER)/.patched
-	$(TRACE) target/kernel-prepare
 	ln -sf $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/linux-$(KERNEL_FILE_VER) $(LINUX_DIR)
 	mkdir -p $(LINUX_BUILD_DIR)/kmod-control
 	touch $@
 
 $(LINUX_DIR)/.config: $(LINUX_DIR)/.prepared $(BUILD_DIR)/.kernelconfig
-	$(TRACE) target/$(ADK_TARGET_ARCH)-kernel-configure
+	$(START_TRACE) "target/$(ADK_TARGET_ARCH)-kernel-configure.. "
 	-for f in $(TARGETS);do if [ -f $$f ];then rm $$f;fi;done
 ifeq ($(ADK_TARGET_KERNEL_USE_DEFCONFIG),y)
 	${KERNEL_MAKE_ENV} $(MAKE) -C "${LINUX_DIR}" ${KERNEL_MAKE_OPTS} $(ADK_TARGET_KERNEL_DEFCONFIG) $(MAKE_TRACE)
@@ -50,23 +49,31 @@ else
 	${KERNEL_MAKE_ENV} $(MAKE) -C "${LINUX_DIR}" ${KERNEL_MAKE_OPTS} KCONFIG_ALLCONFIG=mini.config allnoconfig $(MAKE_TRACE)
 endif
 	touch -c $(LINUX_DIR)/.config
+	$(CMD_TRACE) " done"
+	$(END_TRACE)
 
 $(LINUX_DIR)/$(KERNEL_FILE): $(LINUX_DIR)/.config
-	$(TRACE) target/$(ADK_TARGET_ARCH)-kernel-compile
+	$(START_TRACE) "target/$(ADK_TARGET_ARCH)-kernel-compile.. "
 	${KERNEL_MAKE_ENV} $(MAKE) -C "${LINUX_DIR}" ${KERNEL_MAKE_OPTS} -j${ADK_MAKE_JOBS} $(KERNEL_TARGET) $(MAKE_TRACE)
 	touch -c $(LINUX_DIR)/$(KERNEL_FILE)
+	$(CMD_TRACE) " done"
+	$(END_TRACE)
 
 $(LINUX_BUILD_DIR)/modules: $(LINUX_DIR)/$(KERNEL_FILE)
-	$(TRACE) target/$(ADK_TARGET_ARCH)-kernel-modules-compile
+	$(START_TRACE) "target/$(ADK_TARGET_ARCH)-kernel-modules-compile.. "
 	${KERNEL_MAKE_ENV} $(MAKE) -C "${LINUX_DIR}" ${KERNEL_MAKE_OPTS} -j${ADK_MAKE_JOBS} modules $(MAKE_TRACE)
-	$(TRACE) target/$(ADK_TARGET_ARCH)-kernel-modules-install
+	$(CMD_TRACE) " done"
+	$(END_TRACE)
+	$(START_TRACE) "target/$(ADK_TARGET_ARCH)-kernel-modules-install.. "
 	rm -rf $(LINUX_BUILD_DIR)/modules
 	${KERNEL_MAKE_ENV} $(MAKE) -C "${LINUX_DIR}" ${KERNEL_MAKE_OPTS} \
 		DEPMOD=$(ADK_DEPMOD) \
 		INSTALL_MOD_PATH=$(LINUX_BUILD_DIR)/modules \
 		modules_install $(MAKE_TRACE)
+	$(CMD_TRACE) " done"
+	$(END_TRACE)
 ifneq ($(ADK_RUNTIME_DEV_UDEV),y)
-	$(TRACE) target/$(ADK_TARGET_ARCH)-create-packages
+	$(START_TRACE) "target/$(ADK_TARGET_ARCH)-create-packages.. "
 	@mkdir -p ${PACKAGE_DIR}
 	PATH='${HOST_PATH}' ${BASH} ${SCRIPT_DIR}/make-module-ipkgs.sh \
 		"${ADK_TARGET_CPU_ARCH}" \
@@ -74,6 +81,8 @@ ifneq ($(ADK_RUNTIME_DEV_UDEV),y)
 		"${LINUX_BUILD_DIR}" \
 		"${PKG_BUILD}" \
 		"${PACKAGE_DIR}"
+	$(CMD_TRACE) " done"
+	$(END_TRACE)
 endif
 
 prepare:
@@ -83,12 +92,14 @@ else
 compile: $(LINUX_DIR)/$(KERNEL_FILE)
 endif
 install: compile
-	$(TRACE) target/${ADK_TARGET_ARCH}-modules-install
+	$(START_TRACE) "target/${ADK_TARGET_ARCH}-modules-install.. "
 ifeq ($(ADK_TARGET_PACKAGE_IPKG)$(ADK_TARGET_PACKAGE_OPKG),y)
 	$(PKG_INSTALL) $(wildcard ${PACKAGE_DIR}/kmod-*) $(MAKE_TRACE)
 else
 	$(foreach pkg,$(wildcard ${PACKAGE_DIR}/kmod-*),$(shell $(PKG_INSTALL) $(pkg)))
 endif
+	$(CMD_TRACE) " done"
+	$(END_TRACE)
 
 clean:
 	rm -rf $(LINUX_BUILD_DIR)

+ 0 - 16
mk/os.mk

@@ -1,16 +0,0 @@
-# This file is part of the OpenADK project. OpenADK is copyrighted
-# material, please see the LICENCE file in the top-level directory.
-
-# operating system quirks
-ifeq (${OStype},Darwin)
-HOST_CC:=clang -fbracket-depth=1024
-HOST_CXX:=clang++ -fbracket-depth=1024
-else
-ifeq (${OStype},FreeBSD)
-HOST_CC:=clang -fbracket-depth=1024
-HOST_CXX:=clang++ -fbracket-depth=1024
-else
-HOST_CC:=${CC}
-HOST_CXX:=${CXX}
-endif
-endif

+ 10 - 10
mk/pkg-bottom.mk

@@ -24,19 +24,19 @@ do-configure:
 post-configure:
 ${_CONFIGURE_COOKIE}: ${_PATCH_COOKIE}
 ifneq (,$(filter bootstrap,${AUTOTOOL_STYLE}))
-	@$(CMD_TRACE) "autotool configuring... "
+	@$(CMD_TRACE) "autotool configuring.. "
 	@cd ${WRKSRC}; env ${AUTOTOOL_ENV} $(BASH) bootstrap.sh $(MAKE_TRACE)
 endif
 ifneq (,$(filter autogen,${AUTOTOOL_STYLE}))
-	@$(CMD_TRACE) "autotool configuring... "
+	@$(CMD_TRACE) "autotool configuring.. "
 	@cd ${WRKSRC}; env ${AUTOTOOL_ENV} $(BASH) autogen.sh $(MAKE_TRACE)
 endif
 ifneq (,$(filter autoconf,${AUTOTOOL_STYLE}))
-	@$(CMD_TRACE) "autotool configuring... "
+	@$(CMD_TRACE) "autotool configuring.. "
 	@cd ${WRKSRC}; env ${AUTOTOOL_ENV} autoconf $(MAKE_TRACE)
 endif
 ifneq (,$(filter autoreconf,${AUTOTOOL_STYLE}))
-	@$(CMD_TRACE) "autotool configuring... "
+	@$(CMD_TRACE) "autotool configuring.. "
 	@cd ${WRKSRC}; env ${AUTOTOOL_ENV} autoreconf -vif $(MAKE_TRACE)
 	@rm -rf ${WRKSRC}/autom4te.cache
 	@touch ${WRKDIR}/.autoreconf_done
@@ -47,7 +47,7 @@ endif
 ifneq ($(filter manual,${CONFIG_STYLE}),)
 	env ${CONFIGURE_ENV} ${MAKE} do-configure $(MAKE_TRACE)
 else ifneq ($(filter cmake,${CONFIG_STYLE}),)
-	@$(CMD_TRACE) "configuring cmake... "
+	@$(CMD_TRACE) "configuring cmake.. "
 	sed -e "s#@@TARGET_CC@@#$(TARGET_CC)#" \
 	 	-e "s#@@TARGET_CXX@@#$(TARGET_CXX)#" \
 		-e "s#@@TARGET_CFLAGS@@#$(TARGET_CFLAGS)#" \
@@ -61,19 +61,19 @@ else ifneq ($(filter cmake,${CONFIG_STYLE}),)
 			-DCMAKE_TOOLCHAIN_FILE="$(SCRIPT_DIR)/toolchain.cmake" \
 			${CMAKE_FLAGS} ${WRKSRC}) $(MAKE_TRACE)
 else ifneq ($(filter minimal,${CONFIG_STYLE}),)
-	@$(CMD_TRACE) "configuring... "
+	@$(CMD_TRACE) "configuring.. "
 	cd ${WRKBUILD}; rm -f config.{cache,status}; \
 	    env ${CONFIGURE_ENV} \
 	    ${BASH} ${WRKSRC}/${CONFIGURE_PROG} \
 	    ${CONFIGURE_ARGS} $(MAKE_TRACE)
 else ifneq ($(filter basic,${CONFIG_STYLE}),)
-	@$(CMD_TRACE) "configuring... "
+	@$(CMD_TRACE) "configuring.. "
 	cd ${WRKBUILD}; rm -f config.{cache,status}; \
 	    env ${CONFIGURE_ENV} \
 	    ${BASH} ${WRKSRC}/${CONFIGURE_PROG} ${CONFIGURE_TRIPLE} \
 	    ${CONFIGURE_ARGS} $(MAKE_TRACE)
 else ifneq ($(filter perl,${CONFIG_STYLE}),)
-	@$(CMD_TRACE) "configuring perl module... "
+	@$(CMD_TRACE) "configuring perl module.. "
 	if [ -f ${WRKBUILD}/Makefile.PL ]; then \
 		cd ${WRKBUILD}; \
 			PATH='${HOST_PATH}' \
@@ -88,7 +88,7 @@ else ifneq ($(filter perl,${CONFIG_STYLE}),)
 			perl-host Build.PL; \
 	fi
 else ifeq ($(strip ${CONFIG_STYLE}),)
-	@$(CMD_TRACE) "configuring... "
+	@$(CMD_TRACE) "configuring.. "
 	cd ${WRKBUILD}; rm -f config.{cache,status}; \
 	    env ${CONFIGURE_ENV} \
 	    ${BASH} ${WRKSRC}/${CONFIGURE_PROG} ${CONFIGURE_TRIPLE} \
@@ -125,7 +125,7 @@ do-build:
 post-build:
 ${_BUILD_COOKIE}: ${_CONFIGURE_COOKIE}
 	@env ${MAKE_ENV} ${MAKE} pre-build $(MAKE_TRACE)
-	@$(CMD_TRACE) "compiling... "
+	@$(CMD_TRACE) "compiling.. "
 ifneq ($(filter manual,${BUILD_STYLE}),)
 	env ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} do-build $(MAKE_TRACE)
 else ifeq ($(strip ${BUILD_STYLE}),)

+ 5 - 5
package/Makefile

@@ -50,19 +50,19 @@ install: base-files-install $(INSTALL_ICONV) $(INSTALL_PACKAGES)
 endif
 
 %-download:
-	$(START_TRACE) "package/$(patsubst %-download,%,$@)-download: "
+	$(START_TRACE) "package/$(patsubst %-download,%,$@)-download.. "
 	$(MAKE) -C $(patsubst %-download,%,$@) fetch
 	$(CMD_TRACE) " done"
 	$(END_TRACE)
 
 %-host-compile:
-	$(START_TRACE) "package/$(patsubst %-host-compile,%,$@)-host-compile: "
+	$(START_TRACE) "package/$(patsubst %-host-compile,%,$@)-host.. "
 	$(MAKE) -C $(patsubst %-host-compile,%,$@) hostpackage
 	$(CMD_TRACE) " done"
 	$(END_TRACE)
 
 %-compile:
-	$(START_TRACE) "package/$(patsubst %-compile,%,$@)-compile: "
+	$(START_TRACE) "package/$(patsubst %-compile,%,$@)-compile.. "
 	@if test -f $(ADK_TOPDIR)/.rebuild.$(patsubst %-compile,%,$@); then \
 		$(MAKE) -C $(patsubst %-compile,%,$@) clean ; \
 		rm $(ADK_TOPDIR)/.rebuild.$(patsubst %-compile,%,$@) ; \
@@ -72,13 +72,13 @@ endif
 	$(END_TRACE)
 
 %-install:
-	$(START_TRACE) "package/$(patsubst %-install,%,$@)-install: "
+	$(START_TRACE) "package/$(patsubst %-install,%,$@)-install.. "
 	$(MAKE) -C $(patsubst %-install,%,$@) install
 	$(CMD_TRACE) " done"
 	$(END_TRACE)
 
 %-clean:
-	$(START_TRACE) "package/$(patsubst %-clean,%,$@)-clean: "
+	$(START_TRACE) "package/$(patsubst %-clean,%,$@)-clean.. "
 	$(MAKE) -C $(patsubst %-clean,%,$@) clean
 	$(CMD_TRACE) " done"
 	$(END_TRACE)

+ 1 - 1
package/adk-helper/src/makedevs.c

@@ -31,7 +31,7 @@
 #include <stdarg.h>
 #include <sys/stat.h>
 #include <sys/types.h>
-#if !defined(__APPLE__) && !defined(__FreeBSD__)
+#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
 #include <sys/sysmacros.h>     /* major() and minor() */
 #endif
 #include <ftw.h>

+ 3 - 2
package/pkgconf/Makefile

@@ -9,6 +9,7 @@ PKG_RELEASE:=		1
 PKG_HASH:=		8f5f48e52ddef0c3cbffe93f32d5148041e0030b8798b49b0b5fe72f4968d7ec
 PKG_DESCR:=		smart pkg-config replacement
 PKG_SECTION:=		dev/tools
+HOST_BUILDDEP:=		sed-host
 PKG_URL:=		https://github.com/pkgconf/pkgconf
 PKG_SITES:=		http://rabbit.dereferenced.org/~nenolod/distfiles/
 
@@ -23,9 +24,9 @@ $(eval $(call PKG_template,PKGCONF,pkgconf,$(PKG_VERSION)-${PKG_RELEASE},${PKG_D
 hostpost-install:
 	$(CP) ./files/pkg-config $(STAGING_HOST_DIR)/usr/bin
 ifeq ($(ADK_TARGET_USE_STATIC_LIBS),y)
-	$(SED) "s#@@OPTS@@#--static#" $(STAGING_HOST_DIR)/usr/bin/pkg-config
+	PATH="$(HOST_PATH)" $(SED) "s#@@OPTS@@#--static#" $(STAGING_HOST_DIR)/usr/bin/pkg-config
 else
-	$(SED) "s#@@OPTS@@##" $(STAGING_HOST_DIR)/usr/bin/pkg-config
+	PATH="$(HOST_PATH)" $(SED) "s#@@OPTS@@##" $(STAGING_HOST_DIR)/usr/bin/pkg-config
 endif
 	(cd $(STAGING_HOST_DIR)/usr/bin && ln -sf pkg-config $(GNU_TARGET_NAME)-pkg-config)
 

+ 1 - 1
package/xz/Makefile

@@ -10,9 +10,9 @@ PKG_HASH:=		73df4d5d34f0468bd57d09f2d8af363e95ed6cc3a4a86129d2f2c366259902a2
 PKG_DESCR:=		compression utility
 PKG_SECTION:=		app/archive
 PKG_DEPENDS:=		libxz
+HOST_BUILDDEP:=		heirloom-cpio-host
 PKG_URL:=		http://tukaani.org/xz/
 PKG_SITES:=		http://tukaani.org/xz/
-PKG_OPTS:=		dev
 PKG_LIBNAME:=		libxz
 PKG_OPTS:=		dev
 PKG_BB:=		1

+ 2 - 3
rules.mk

@@ -2,7 +2,6 @@
 # material, please see the LICENCE file in the top-level directory.
 
 include $(ADK_TOPDIR)/prereq.mk
-include $(ADK_TOPDIR)/mk/os.mk
 -include $(ADK_TOPDIR)/.config
 
 ifeq ($(ADK_VERBOSE),1)
@@ -15,9 +14,9 @@ MAKE_TRACE:=
 EXTRA_MAKEFLAGS:=
 SET_DASHX:=		set -x
 else
-START_TRACE:=		echo -n "---> "
+START_TRACE:=		echo -n " ---> "
 END_TRACE:=		echo
-TRACE:=			echo "---> "
+TRACE:=			echo " ---> "
 CMD_TRACE:=		echo -n
 PKG_TRACE:=		echo "------> "
 EXTRA_MAKEFLAGS:=	-s

+ 514 - 0
scripts/prereq.sh

@@ -0,0 +1,514 @@
+#!/bin/sh
+# This file is part of the OpenADK project. OpenADK is copyrighted
+# material, please see the LICENCE file in the top-level directory.
+
+# resolve prerequisites for OpenADK build
+
+topdir=$(pwd)
+target="$@"
+flags="$MAKEFLAGS"
+out=0
+
+# detect operating system
+os=$(env uname)
+osver=$(env uname -r)
+printf " --->  $os $osver for build detected.\n"
+
+# check if the filesystem is case sensitive
+rm -f foo
+echo >FOO
+if [[ -e foo ]]; then
+  printf "ERROR: OpenADK cannot be built in a case-insensitive file system." 
+  case $os in
+    CYG*)
+      printf "Building OpenADK on $os needs a small registry change."
+      printf "http://cygwin.com/cygwin-ug-net/using-specialnames.html"
+      ;;
+    Darwin*)
+      printf "Building OpenADK on $os needs a case-sensitive disk partition."
+      printf "For Snow Leopard and above you can use diskutil to resize your existing disk."
+      printf "Example: sudo diskutil resizeVolume disk0s2 90G 1 jhfsx adk 30G"
+      printf "For older versions you might consider to use a disk image:"
+      printf "hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 30g ~/openadk.dmg"
+      ;;
+  esac
+  rm -f FOO
+  exit 1
+fi
+rm -f FOO
+
+# relocation of topdir?
+olddir=$(grep "^ADK_TOPDIR" prereq.mk 2>/dev/null |cut -d '=' -f 2)
+newdir=$(pwd)
+
+if [ ! -z "$olddir" ]; then
+  if [ "$olddir" != "$newdir" ]; then
+    printf " --->  adk directory was relocated, fixing .."
+    printf "old directory: $olddir"
+    printf "new directory: $newdir"
+    sed -i -e "s#$olddir#$newdir#g" $(find target_* -name \*.pc|xargs)
+    sed -i -e "s#$olddir#$newdir#g" $(find target_*/scripts -type f|xargs)
+    sed -i -e "s#$olddir#$newdir#" target_*/etc/ipkg.conf
+  fi
+fi
+
+# do we have a download tool?
+tools="curl wget ftp lftp"
+for tool in $tools; do
+  printf " --->  checking if $tool is installed.. "
+  if which $tool >/dev/null; then
+    printf "found\n"
+    DLTOOL=$(which $tool)
+    break
+  else
+    printf "not found\n"
+    continue
+  fi
+done
+if [ -z $DLTOOL ]; then
+  printf "ERROR: no download tool found. Fatal error.\n"
+  exit 1
+fi
+
+# do we have a checksum tool?
+tools="sha256sum sha256"
+for tool in $tools; do
+  printf " --->  checking if $tool is installed.. "
+  if which $tool >/dev/null 2>/dev/null; then
+    printf "found\n"
+    if [ $tool = "sha256" ]; then
+      SHA256="$(which $tool) -q"
+    else
+      SHA256=$(which $tool)
+    fi
+    break
+  else
+    printf "not found\n"
+    continue
+  fi
+done
+if [ -z "$SHA256" ]; then
+  printf "ERROR: no checksum tool found. Fatal error.\n"
+  exit 1
+fi
+
+# create download dir
+if [ ! -d $topdir/dl ]; then
+  mkdir -p $topdir/dl
+fi
+
+# check for GNU make
+makebins="gmake make"
+for makebin in $makebins; do
+  printf " --->  checking if $makebin is installed.. "
+  if which $makebin >/dev/null; then
+    printf "found\n"
+    printf " --->  checking if it is GNU make.. "
+    $makebin --version 2>/dev/null| grep GNU >/dev/null
+    if [ $? -eq 0 ]; then
+      printf "yes\n"
+      MAKE=$(which $makebin)
+      break
+    fi
+  else
+    printf "not found\n"
+    continue
+  fi
+done
+
+# skip the script if distclean / cleandir
+if [ "$target" = "distclean" -o "$target" = "cleandir" ]; then
+  touch prereq.mk
+  $makebin -s -f Makefile.adk $flags $target
+  exit 0
+fi
+
+# check for c compiler
+compilerbins="cc gcc clang"
+for compilerbin in $compilerbins; do
+  printf " --->  checking if $compilerbin is installed.. "
+  if which $compilerbin >/dev/null; then
+    printf "found\n"
+    CC=$compilerbin
+    break
+  fi
+done
+
+# check for c++ compiler
+compilerbins="c++ g++ clang++"
+for compilerbin in $compilerbins; do
+  printf " --->  checking if $compilerbin is installed.. "
+  if which $compilerbin >/dev/null; then
+    printf "found\n"
+    CXX=$compilerbin
+    break
+  fi
+done
+
+if ! which perl >/dev/null 2>&1; then
+  echo You must install perl to continue.
+  echo
+  out=1
+fi
+
+# creating prereq.mk
+echo "ADK_TOPDIR:=$(readlink -nf . 2>/dev/null || pwd -P)" > $topdir/prereq.mk
+echo "BASH:=$(which bash)" >> $topdir/prereq.mk
+echo "SHELL:=$BASH" >> $topdir/prereq.mk
+echo "GMAKE:=$MAKE" >> $topdir/prereq.mk
+echo "MAKE:=$MAKE" >> $topdir/prereq.mk
+echo "SHA256:=$SHA256" >> $topdir/prereq.mk
+echo "GNU_HOST_NAME:=$(${CC} -dumpmachine)" >> $topdir/prereq.mk
+echo "OS_FOR_BUILD:=${os}" >> $topdir/prereq.mk
+echo "ARCH_FOR_BUILD:=$(${CC} -dumpmachine | sed \
+    -e 's/x86_64-linux-gnux32/x32/' \
+    -e s'/-.*//' \
+    -e 's/sparc.*/sparc/' \
+    -e 's/armeb.*/armeb/g' \
+    -e 's/arm.*/arm/g' \
+    -e 's/m68k.*/m68k/' \
+    -e 's/sh[234]/sh/' \
+    -e 's/mips-.*/mips/' \
+    -e 's/mipsel-.*/mipsel/' \
+    -e 's/i[3-9]86/x86/' \
+    )" >>prereq.mk
+
+if [ "$CC" = "clang" ]; then
+  echo "HOST_CC:=${CC} -fbracket-depth=1024" >> $topdir/prereq.mk
+else
+  echo "HOST_CC:=${CC}" >> $topdir/prereq.mk
+fi
+if [ "$CXX" = "clang++" ]; then
+  echo "HOST_CXX:=${CXX} -fbracket-depth=1024" >> $topdir/prereq.mk
+else
+  echo "HOST_CXX:=${CXX}" >> $topdir/prereq.mk
+fi
+
+echo 'LANGUAGE:=C' >> $topdir/prereq.mk
+echo 'LC_ALL:=C' >> $topdir/prereq.mk
+echo "_PATH:=$PATH" >> $topdir/prereq.mk
+echo "PATH:=${topdir}/scripts:/usr/sbin:$PATH" >> $topdir/prereq.mk
+echo "GIT:=$(which git 2>/dev/null)" >> $topdir/prereq.mk
+echo "export GIT SHA256" >> $topdir/prereq.mk
+
+# check if compiler works
+cat >Makefile.tmp <<'EOF'
+include ${ADK_TOPDIR}/prereq.mk
+all: run-test
+
+test: test.c
+	${HOST_CC} ${HOST_CFLAGS} -o $@ $^ ${LDADD}
+
+run-test: test
+	./test
+EOF
+cat >test.c <<-'EOF'
+	#include <stdio.h>
+	int
+	main()
+	{
+		printf("Yay! Native compiler works.\n");
+		return (0);
+	}
+EOF
+
+X=$($MAKE --no-print-directory ADK_TOPDIR=$topdir -f Makefile.tmp HOST_CFLAGS=${HOST_CFLAGS} 2>&1)
+if [[ $X != *@(Native compiler works)* ]]; then
+  echo "$X" | sed 's/^/| /'
+  echo Cannot compile a simple test programme.
+  echo You must install a host make and C compiler.
+  echo
+  out=1
+fi
+rm test.c test Makefile.tmp 2>/dev/null
+
+# error out on any required prerequisite
+if [ $out -ne 0 ]; then
+  exit $out
+fi
+
+# always required, but can be provided by host
+host_build_bc=0
+if which bc >/dev/null 2>&1; then
+  if ! echo quit|bc -q 2>/dev/null >/dev/null; then
+    host_build_bc=1
+  else 
+    if bc -v 2>&1| grep -q BSD >/dev/null 2>&1; then
+      host_build_bc=1
+    fi 
+  fi
+else
+  host_build_bc=1
+fi
+
+host_build_bison=0
+if ! which bison >/dev/null 2>&1; then
+  host_build_bison=1
+fi
+
+host_build_bzip2=0
+if ! which bzip2 >/dev/null 2>&1; then
+  host_build_bzip2=1
+fi
+
+host_build_file=0
+if ! which file >/dev/null 2>&1; then
+  host_build_file=1
+fi
+
+host_build_flex=0
+if ! which flex >/dev/null 2>&1; then
+  host_build_flex=1
+fi
+
+host_build_m4=0
+if ! which m4 >/dev/null 2>&1; then
+  host_build_m4=1
+fi
+
+host_build_mksh=0
+if ! which mksh >/dev/null 2>&1; then
+  host_build_mksh=1
+fi
+
+host_build_patch=0
+if ! which patch >/dev/null 2>&1; then
+  host_build_patch=1
+fi
+
+host_build_pkgconf=0
+if ! which pkgconf >/dev/null 2>&1; then
+  host_build_pkgconf=1
+fi
+
+host_build_tar=0
+if which tar >/dev/null 2>&1; then
+  if ! tar --version 2>/dev/null|grep GNU >/dev/null;then
+    host_build_tar=1
+  fi
+else
+  host_build_tar=1
+fi
+
+host_build_findutils=0
+if ! which gxargs >/dev/null 2>&1; then
+  if which xargs >/dev/null 2>&1; then
+    if ! xargs --version 2>/dev/null|grep GNU >/dev/null;then
+      host_build_findutils=1
+    fi
+  fi
+fi
+
+if which find >/dev/null 2>&1; then
+  if ! find --version 2>/dev/null|grep GNU >/dev/null;then
+    host_build_findutils=1
+  fi
+fi
+
+host_build_grep=0
+if which grep >/dev/null 2>&1; then
+  if ! grep --version 2>/dev/null|grep GNU >/dev/null;then
+    host_build_grep=1
+  fi
+fi
+
+host_build_gawk=0
+if ! which gawk >/dev/null 2>&1; then
+  host_build_gawk=1
+fi
+
+host_build_sed=0
+if which sed >/dev/null 2>&1; then
+  if ! sed --version 2>/dev/null|grep GNU >/dev/null;then
+    host_build_sed=1
+  fi
+fi
+
+host_build_xz=0
+if ! which xz >/dev/null 2>&1; then
+  host_build_xz=1
+fi
+
+# optional
+host_build_cdrtools=0
+if ! which mkisofs >/dev/null 2>&1; then
+  host_build_cdrtools=1
+fi
+
+host_build_ccache=0
+if ! which ccache >/dev/null 2>&1; then
+  host_build_ccache=1
+fi
+
+host_build_genext2fs=0
+if ! which genext2fs >/dev/null 2>&1; then
+  host_build_genext2fs=1
+fi
+
+host_build_lzma=0
+if ! which lzma >/dev/null 2>&1; then
+  host_build_lzma=1
+fi
+
+host_build_lz4=0
+if ! which lz4c >/dev/null 2>&1; then
+  host_build_lz4=1
+fi
+
+host_build_lzop=0
+if ! which lzop >/dev/null 2>&1; then
+  host_build_lzop=1
+fi
+
+host_build_qemu=0
+if ! which qemu-img >/dev/null 2>&1; then
+  host_build_qemu=1
+fi
+
+echo "config ADK_HOST_BUILD_TOOLS" > $topdir/target/config/Config.in.prereq
+printf "\t%s\n" "bool" >> $topdir/target/config/Config.in.prereq
+printf "\t%s\n" "default y" >> $topdir/target/config/Config.in.prereq
+# always required
+if [ $host_build_bc -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_BC" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_bison -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_BISON" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_bzip2 -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_BZIP2" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_file -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_FILE" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_flex -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_FLEX" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_gawk -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_GAWK" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_grep -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_GREP" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_m4 -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_M4" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_mksh -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_MKSH" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_patch -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_PATCH" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_pkgconf -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_PKGCONF" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_findutils -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_FINDUTILS" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_sed -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_SED" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_tar -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_TAR" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_xz -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_XZ" >> $topdir/target/config/Config.in.prereq ;fi
+# optional
+if [ $host_build_ccache -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_CCACHE if ADK_HOST_NEED_CCACHE" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_cdrtools -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_CDRTOOLS if ADK_HOST_NEED_CDRTOOLS" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_genext2fs -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_GENEXT2FS if ADK_HOST_NEED_GENEXT2FS" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_lzma -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_LZMA if ADK_HOST_NEED_LZMA" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_lz4 -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_LZ4 if ADK_HOST_NEED_LZ4" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_lzop -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_LZOP if ADK_HOST_NEED_LZOP" >> $topdir/target/config/Config.in.prereq ;fi
+if [ $host_build_qemu -eq 1 ];then printf "\t%s\n" "select ADK_HOST_BUILD_QEMU if ADK_HOST_NEED_QEMU" >> $topdir/target/config/Config.in.prereq ;fi
+
+# create Host OS symbols
+case $os in
+  Linux)
+    printf "\nconfig ADK_HOST_LINUX\n" >> $topdir/target/config/Config.in.prereq
+    printf "\tbool\n" >> $topdir/target/config/Config.in.prereq
+    printf "\tdefault y\n" >> $topdir/target/config/Config.in.prereq
+    ;;
+  Darwin)
+    printf "\nconfig ADK_HOST_DARWIN\n" >> $topdir/target/config/Config.in.prereq
+    printf "\tbool\n" >> $topdir/target/config/Config.in.prereq
+    printf "\tdefault y\n" >> $topdir/target/config/Config.in.prereq
+    ;;
+  OpenBSD)
+    printf "\nconfig ADK_HOST_OPENBSD\n" >> $topdir/target/config/Config.in.prereq
+    printf "\tbool\n" >> $topdir/target/config/Config.in.prereq
+    printf "\tdefault y\n" >> $topdir/target/config/Config.in.prereq
+    ;;
+  FreeBSD)
+    printf "\nconfig ADK_HOST_FREEBSD\n" >> $topdir/target/config/Config.in.prereq
+    printf "\tbool\n" >> $topdir/target/config/Config.in.prereq
+    printf "\tdefault y\n" >> $topdir/target/config/Config.in.prereq
+    ;;
+  NetBSD)
+    printf "\nconfig ADK_HOST_NETBSD\n" >> $topdir/target/config/Config.in.prereq
+    printf "\tbool\n" >> $topdir/target/config/Config.in.prereq
+    printf "\tdefault y\n" >> $topdir/target/config/Config.in.prereq
+    ;;
+  MirBSD)
+    printf "\nconfig ADK_HOST_MIRBSD\n" >> $topdir/target/config/Config.in.prereq
+    printf "\tbool\n" >> $topdir/target/config/Config.in.prereq
+    printf "\tdefault y\n" >> $topdir/target/config/Config.in.prereq
+    ;;
+  Cygwin*)
+    printf "\nconfig ADK_HOST_CYGWIN\n" >> $topdir/target/config/Config.in.prereq
+    printf "\tbool\n" >> $topdir/target/config/Config.in.prereq
+    printf "\tdefault y\n" >> $topdir/target/config/Config.in.prereq
+    ;;
+esac
+
+if [ ! -f $topdir/.config ]; then
+  # create a config if no exist
+  touch .firstrun
+  $makebin --no-print-directory -f Makefile.adk menuconfig
+else
+  # scan host-tool prerequisites of certain packages before building.
+  . $topdir/.config
+  if [[ -n $ADK_PACKAGE_KODI ]]; then
+    NEED_JAVA="$NEED_JAVA kodi"
+  fi
+
+  if [[ -n $ADK_PACKAGE_ICU4C ]]; then
+    NEED_STATIC_LIBSTDCXX="$NEED_STATIC_LIBSTDCXX icu4c"
+  fi
+
+  if [[ -n $ADK_PACKAGE_XKEYBOARD_CONFIG ]]; then
+    NEED_XKBCOMP="$NEED_XKBCOMP xkeyboard-config"
+  fi
+
+  if [[ -n $ADK_PACKAGE_FONT_BITSTREAM_100DPI ]]; then
+    NEED_MKFONTDIR="$NEED_MKFONTDIR font-bitstream-100dpi"
+  fi
+
+  if [[ -n $ADK_PACKAGE_FONT_BITSTREAM_75DPI ]]; then
+    NEED_MKFONTDIR="$NEED_MKFONTDIR font-bitstream-75dpi"
+  fi
+
+  if [[ -n $ADK_PACKAGE_FONT_ADOBE_100DPI ]]; then
+    NEED_MKFONTDIR="$NEED_MKFONTDIR font-adobe-100dpi"
+  fi
+
+  if [[ -n $ADK_PACKAGE_FONT_ADOBE_75DPI ]]; then
+    NEED_MKFONTDIR="$NEED_MKFONTDIR font-adobe-75dpi"
+  fi
+
+  if [[ -n $NEED_MKFONTDIR ]]; then
+    if ! which mkfontdir >/dev/null 2>&1; then
+      echo >&2 You need mkfontdir to build $NEED_MKFONTDIR
+      out=1
+    fi
+  fi
+
+  if [[ -n $NEED_XKBCOMP ]]; then
+    if ! which xkbcomp >/dev/null 2>&1; then
+      echo >&2 You need xkbcomp to build $NEED_XKBCOMP
+      out=1
+    fi
+  fi
+
+  if [[ -n $NEED_JAVA ]]; then
+    if ! which java >/dev/null 2>&1; then
+      echo >&2 You need java to build $NEED_JAVA
+      out=1
+    fi
+  fi
+
+  if [[ -n $NEED_STATIC_LIBSTDCXX ]]; then
+cat >test.c <<-'EOF'
+	#include <stdio.h>
+	int
+	main()
+	{
+		return (0);
+	}
+EOF
+    if ! $CXX -static-libstdc++ -o test test.c ; then
+      echo >&2 You need static version of libstdc++ installed to build $NEED_STATIC_LIBSTDCXX
+      out=1
+      rm test 2>/dev/null
+    fi
+  fi
+
+  # error out
+  if [ $out -ne 0 ]; then
+    exit $out
+  fi
+
+  # start build
+  $makebin --no-print-directory -f Makefile.adk $flags $target
+fi

+ 0 - 18
scripts/reloc.sh

@@ -1,18 +0,0 @@
-#!/usr/bin/env bash
-# execute this after relocation of adk directory
-
-olddir=$(grep "^ADK_TOPDIR" prereq.mk 2>/dev/null |cut -d '=' -f 2)
-newdir=$(pwd)
-
-if [ ! -z "$olddir" ];then
-  if [ "$olddir" != "$newdir" ];then
-	echo "adk directory relocated!"
-	echo "old directory: $olddir"
-	echo "new directory: $newdir"
-	sed -i -e "s#$olddir#$newdir#g" $(find target_* -name \*.pc|xargs)
-	sed -i -e "s#$olddir#$newdir#g" $(find target_* -name \*.la|xargs)
-	sed -i -e "s#$olddir#$newdir#g" $(find target_*/scripts -type f|xargs)
-	sed -i -e "s#$olddir#$newdir#" target_*/etc/ipkg.conf
-	sed -i -e "s#$olddir#$newdir#" prereq.mk
-  fi
-fi

+ 0 - 91
scripts/scan-pkgs.sh

@@ -1,91 +0,0 @@
-# This file is part of the OpenADK project. OpenADK is copyrighted
-# material, please see the LICENCE file in the top-level directory.
-#
-# Scan host-tool prerequisites of certain packages before building.
-
-if test -z "$BASH_VERSION"; then
-	foo=`$BASH -c 'echo "$BASH_VERSION"'`
-else
-	foo=$BASH_VERSION
-fi
-
-if test -z "$foo"; then
-	echo OpenADK requires GNU bash to be installed.
-	exit 1
-fi
-
-test -z "$BASH_VERSION$KSH_VERSION" && exec $BASH $0 "$@"
-
-[[ -n $BASH_VERSION ]] && shopt -s extglob
-topdir=$(readlink -nf $(dirname $0)/.. 2>/dev/null || (cd $(dirname $0)/..; pwd -P))
-OStype=$(uname)
-out=0
-
-. $topdir/.config
-
-if [[ -n $ADK_PACKAGE_KODI ]]; then
-	NEED_JAVA="$NEED_JAVA kodi"
-fi
-
-if [[ -n $ADK_PACKAGE_ICU4C ]]; then
-	NEED_STATIC_LIBSTDCXX="$NEED_STATIC_LIBSTDCXX icu4c"
-fi
-
-if [[ -n $ADK_PACKAGE_XKEYBOARD_CONFIG ]]; then
-	NEED_XKBCOMP="$NEED_XKBCOMP xkeyboard-config"
-fi
-
-if [[ -n $ADK_PACKAGE_FONT_BITSTREAM_100DPI ]]; then
-	NEED_MKFONTDIR="$NEED_MKFONTDIR font-bitstream-100dpi"
-fi
-
-if [[ -n $ADK_PACKAGE_FONT_BITSTREAM_75DPI ]]; then
-	NEED_MKFONTDIR="$NEED_MKFONTDIR font-bitstream-75dpi"
-fi
-
-if [[ -n $ADK_PACKAGE_FONT_ADOBE_100DPI ]]; then
-	NEED_MKFONTDIR="$NEED_MKFONTDIR font-adobe-100dpi"
-fi
-
-if [[ -n $ADK_PACKAGE_FONT_ADOBE_75DPI ]]; then
-	NEED_MKFONTDIR="$NEED_MKFONTDIR font-adobe-75dpi"
-fi
-
-if [[ -n $NEED_MKFONTDIR ]]; then
-	if ! which mkfontdir >/dev/null 2>&1; then
-		echo >&2 You need mkfontdir to build $NEED_MKFONTDIR
-		out=1
-	fi
-fi
-
-if [[ -n $NEED_XKBCOMP ]]; then
-	if ! which xkbcomp >/dev/null 2>&1; then
-		echo >&2 You need xkbcomp to build $NEED_XKBCOMP
-		out=1
-	fi
-fi
-
-if [[ -n $NEED_JAVA ]]; then
-	if ! which java >/dev/null 2>&1; then
-		echo >&2 You need java to build $NEED_JAVA
-		out=1
-	fi
-fi
-
-if [[ -n $NEED_STATIC_LIBSTDCXX ]]; then
-cat >test.c <<-'EOF'
-	#include <stdio.h>
-	int
-	main()
-	{
-		return (0);
-	}
-EOF
-	if ! g++ -static-libstdc++ -o test test.c ; then
-		echo >&2 You need static version of libstdc++ installed to build $NEED_STATIC_LIBSTDCXX
-		out=1
-		rm test 2>/dev/null
-	fi
-fi
-
-exit $out

+ 0 - 14
scripts/sha256sum

@@ -1,14 +0,0 @@
-#!/usr/bin/env bash
-# This file is part of the OpenADK project. OpenADK is copyrighted
-# material, please see the LICENCE file in the top-level directory.
-
-if [ -x /usr/bin/sha256sum ]; then
-	/usr/bin/sha256sum "$@"
-elif [ -x /bin/cksum ] && [ $(echo | cksum -a sha256) = 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b ]; then
-	# we assume the arguments are exactly "-c" or "-c -"
-	x=$(sed 's/^\([0-9a-fA-F]*\) *\([^ ].*\)$/SHA256 (\2) = \1/' | cksum -c -a sha256)
-	[[ $x = *FAILED* ]] && exit 1
-	exit 0
-else
-	shasum -a 256 "$@"
-fi

+ 18 - 7
target/Makefile

@@ -122,19 +122,25 @@ install: $(ADK_TARGET_ARCH)-imageclean $(ADK_TARGET_ARCH)-install $(ADK_TARGET_A
 clean: $(ADK_TARGET_ARCH)-clean $(ADK_TARGET_ARCH)-imageclean
 
 %-clean:
-	$(TRACE) target/$(patsubst %-clean,%,$@)-clean
+	$(START_TRACE) "target/$(patsubst %-clean,%,$@)-clean.. "
 	$(MAKE) -C $(patsubst %-clean,%,$@) clean
+	$(CMD_TRACE) " done"
+	$(END_TRACE)
 
 %-imageclean:
-	$(TRACE) target/$(patsubst %-imageclean,%,$@)-imageclean
+	$(START_TRACE) "target/$(patsubst %-imageclean,%,$@)-imageclean.. "
 	$(MAKE) -C $(patsubst %-imageclean,%,$@) imageclean
+	$(CMD_TRACE) " done"
+	$(END_TRACE)
 
 %-prepare:
-	$(TRACE) target/$(patsubst %-prepare,%,$@)-prepare
+	$(START_TRACE) "target/$(patsubst %-prepare,%,$@)-prepare.. "
 	$(MAKE) -C $(patsubst %-prepare,%,$@) prepare
+	$(CMD_TRACE) " done"
+	$(END_TRACE)
 
 %-imageprepare:
-	$(TRACE) target/$(patsubst %-imageprepare,%,$@)-imageprepare
+	$(START_TRACE) "target/$(patsubst %-imageprepare,%,$@)-imageprepare.. "
 ifeq ($(ADK_RUNTIME_DEV_UDEV),y)
 	# This should be made a package instead
 	$(CP) -a $(BUILD_DIR)/linux-$(ADK_TARGET_ARCH)/modules/lib $(TARGET_DIR)
@@ -146,23 +152,28 @@ endif
 		break; \
 	done
 	$(MAKE) -C $(patsubst %-imageprepare,%,$@) imageprepare
+	$(CMD_TRACE) " done"
+	$(END_TRACE)
 
 %-compile: %-prepare
-	$(TRACE) target/$(patsubst %-compile,%,$@)-compile
 	$(MAKE) -C $(patsubst %-compile,%,$@) compile
 
 %-install: %-compile
-	$(TRACE) target/$(patsubst %-install,%,$@)-install
+	$(START_TRACE) "target/$(patsubst %-install,%,$@)-install.. "
 	$(MAKE) -C $(patsubst %-install,%,$@) install
+	$(CMD_TRACE) " done"
+	$(END_TRACE)
 
 %-targethelp:
 	$(MAKE) -C $(patsubst %-targethelp,%,$@) targethelp
 
 %-imageinstall: %-imageprepare
-	$(TRACE) target/$(patsubst %-imageinstall,%,$@)-imageinstall
+	$(START_TRACE) "target/$(patsubst %-imageinstall,%,$@)-imageinstall.. "
 	$(MAKE) -C $(patsubst %-imageinstall,%,$@) imageinstall
 	@for x in $$(ls $(ADK_TOPDIR)/scripts/postimage/*.sh 2>/dev/null); do \
 		[[ -x "$$x" ]] && $$x; \
 		break; \
 	done
+	$(CMD_TRACE) " done"
+	$(END_TRACE)
 	@echo "Login as user root via ssh or console."

+ 0 - 25
target/config/Config.in.adk

@@ -101,31 +101,6 @@ config ADK_TARGET_PORT
 	help
 	  Port to use for SSH when running make check.
 
-choice 
-prompt "Hostsystem (do not change!)"
-config ADK_HOST_LINUX
-	bool "Linux"
-
-config ADK_HOST_FREEBSD
-	bool "FreeBSD"
-
-config ADK_HOST_MIRBSD
-	bool "MirBSD"
-
-config ADK_HOST_OPENBSD
-	bool "OpenBSD"
-
-config ADK_HOST_NETBSD
-	bool "NetBSD"
-
-config ADK_HOST_DARWIN
-	bool "Darwin"
-
-config ADK_HOST_CYGWIN
-	bool "Cygwin"
-
-endchoice
-
 config ADK_PRELINK
 	prompt "Prelink binaries and libraries in Image"
 	boolean

+ 0 - 1
target/config/Config.in.target

@@ -131,7 +131,6 @@ config ADK_TARGET_ROOTFS_ISO
 	select ADK_HOST_NEED_CDRTOOLS
 	select ADK_HOST_NEED_SYSLINUX
 	select ADK_TARGET_QEMU_WITH_BLOCK if ADK_TARGET_QEMU
-	depends on ADK_HOST_LINUX
 	depends on ADK_TARGET_ARCH_X86
 	help
 	  Use this option to create a bootable ISO image.

+ 21 - 7
toolchain/Makefile

@@ -61,11 +61,13 @@ gcc-install: $(ELF2FLT) $(CLIB)-install
 gcc-final: gcc-install $(GDB)
 
 %-download:
-	$(TRACE) toolchain/$(patsubst %-download,%,$@)/download
+	$(START_TRACE) "toolchain/$(patsubst %-download,%,$@)/download.. "
 	$(MAKE) -C $(patsubst %-download,%,$@) fetch
+	$(CMD_TRACE) " done"
+	$(END_TRACE)
 
 %-prepare:
-	$(TRACE) toolchain/$(patsubst %-prepare,%,$@)/prepare
+	$(START_TRACE) "toolchain/$(patsubst %-prepare,%,$@)/prepare.. "
 	@if test x"$(patsubst %-prepare,%,$@)" = x"$(CLIB)"; then \
 		$(MAKE) -C $(patsubst %-prepare,%,$@) prepare \
 		    $(MAKE_TRACE); \
@@ -73,9 +75,11 @@ gcc-final: gcc-install $(GDB)
 		$(MAKE) -C $(patsubst %-prepare,%,$@) prepare \
 		    CC='$(HOST_CC)' CFLAGS='$(HOST_CFLAGS)' $(MAKE_TRACE); \
 	fi
+	$(CMD_TRACE) " done"
+	$(END_TRACE)
 
 %-configure: %-prepare
-	$(TRACE) toolchain/$(patsubst %-configure,%,$@)/configure
+	$(START_TRACE) "toolchain/$(patsubst %-configure,%,$@)/configure.. "
 	@if test x"$(patsubst %-configure,%,$@)" = x"$(CLIB)"; then \
 		$(MAKE) -C $(patsubst %-configure,%,$@) configure \
 		    $(MAKE_TRACE); \
@@ -83,9 +87,11 @@ gcc-final: gcc-install $(GDB)
 		$(MAKE) -C $(patsubst %-configure,%,$@) configure \
 		    CC='$(HOST_CC)' CFLAGS='$(HOST_CFLAGS)' $(MAKE_TRACE); \
 	fi
+	$(CMD_TRACE) " done"
+	$(END_TRACE)
 
 %-compile: %-configure
-	$(TRACE) toolchain/$(patsubst %-compile,%,$@)/compile
+	$(START_TRACE) "toolchain/$(patsubst %-compile,%,$@)/compile.. "
 	@if test x"$(patsubst %-compile,%,$@)" = x"$(CLIB)"; then \
 		$(MAKE) -C $(patsubst %-compile,%,$@) compile \
 		    $(MAKE_TRACE); \
@@ -93,9 +99,11 @@ gcc-final: gcc-install $(GDB)
 		$(MAKE) -C $(patsubst %-compile,%,$@) compile \
 		    CC='$(HOST_CC)' CFLAGS='$(HOST_CFLAGS)' CXXFLAGS='$(HOST_STATIC_CXXFLAGS)' $(MAKE_TRACE); \
 	fi
+	$(CMD_TRACE) " done"
+	$(END_TRACE)
 
 %-install: %-compile
-	$(TRACE) toolchain/$(patsubst %-install,%,$@)/install
+	$(START_TRACE) "toolchain/$(patsubst %-install,%,$@)/install.. "
 	@if test x"$(patsubst %-install,%,$@)" = x"$(CLIB)"; then \
 		$(MAKE) -C $(patsubst %-install,%,$@) install \
 		    $(MAKE_TRACE); \
@@ -103,11 +111,17 @@ gcc-final: gcc-install $(GDB)
 		$(MAKE) -C $(patsubst %-install,%,$@) install \
 		    CC='$(HOST_CC)' CFLAGS='$(HOST_CFLAGS)' CXXFLAGS='$(HOST_STATIC_CXXFLAGS)' $(MAKE_TRACE); \
 	fi
+	$(CMD_TRACE) " done"
+	$(END_TRACE)
 
 %-final: %-install
-	$(TRACE) toolchain/$(patsubst %-final,%,$@)/final
+	$(START_TRACE) "toolchain/$(patsubst %-final,%,$@)/final.. "
 	@$(MAKE) -C $(patsubst %-final,%,$@) final $(MAKE_TRACE)
+	$(CMD_TRACE) " done"
+	$(END_TRACE)
 
 %-clean:
-	$(TRACE) toolchain/$(patsubst %-clean,%,$@)/clean
+	$(START_TRACE) "toolchain/$(patsubst %-clean,%,$@)/clean.. "
 	@$(MAKE) -C $(patsubst %-clean,%,$@) clean $(MAKE_TRACE)
+	$(CMD_TRACE) " done"
+	$(END_TRACE)