summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--BSDmakefile27
-rw-r--r--Config.in8
-rw-r--r--GNUmakefile24
-rw-r--r--Makefile221
-rw-r--r--Makefile.adk181
-rw-r--r--Makefile.inc4
-rw-r--r--README3
-rw-r--r--adk/config/Makefile10
-rw-r--r--mk/build.mk91
-rw-r--r--mk/buildhlp.mk2
-rw-r--r--mk/fetch.mk2
-rw-r--r--mk/host-bottom.mk33
-rw-r--r--mk/kernel-build.mk25
-rw-r--r--mk/os.mk16
-rw-r--r--mk/pkg-bottom.mk20
-rw-r--r--package/Makefile10
-rw-r--r--package/adk-helper/src/makedevs.c2
-rw-r--r--package/pkgconf/Makefile5
-rw-r--r--package/xz/Makefile2
-rw-r--r--rules.mk5
-rwxr-xr-xscripts/prereq.sh514
-rwxr-xr-xscripts/reloc.sh18
-rw-r--r--scripts/scan-pkgs.sh91
-rwxr-xr-xscripts/sha256sum14
-rw-r--r--target/Makefile25
-rw-r--r--target/config/Config.in.adk25
-rw-r--r--target/config/Config.in.target1
-rw-r--r--toolchain/Makefile28
29 files changed, 584 insertions, 826 deletions
diff --git a/.gitignore b/.gitignore
index f5fa5dac6..2a5c6bb3b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,11 +30,12 @@
/toolchain_*/
/.ADK_HAVE_DOT_CONFIG
/.tmpconfig.h
+/.prereq_done
/.config*
/.busyboxcfg
/.rebuild.*
/.defconfig
-/.firstrun
+/.adkinit
/.menu
/all.config
/target_*/
diff --git a/BSDmakefile b/BSDmakefile
new file mode 100644
index 000000000..ddf869106
--- /dev/null
+++ b/BSDmakefile
@@ -0,0 +1,27 @@
+# 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
diff --git a/Config.in b/Config.in
index 62838e64c..3eb25c58b 100644
--- a/Config.in
+++ b/Config.in
@@ -10,7 +10,7 @@ config ADK_MODULES
default y
config ADK_HAVE_DOT_CONFIG
- bool
+ boolean
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
- bool "do not install anything into /etc"
+ boolean "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
- bool "ship custom init-scripts along with packages"
+ boolean "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
- bool "ship custom network-scripts along with packages"
+ boolean "ship custom network-scripts along with packages"
default y
depends on !ADK_LEAVE_ETC_ALONE
help
diff --git a/GNUmakefile b/GNUmakefile
new file mode 100644
index 000000000..1cd73044e
--- /dev/null
+++ b/GNUmakefile
@@ -0,0 +1,24 @@
+# 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
diff --git a/Makefile b/Makefile
index 2f1a58f1c..5ee53356b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,221 @@
# This file is part of the OpenADK project. OpenADK is copyrighted
# material, please see the LICENCE file in the top-level directory.
-# GNU make and BSD make compatible make file wrapper
-all v menuconfig download clean cleankernel cleansystem cleandir distclean hostclean hostpackage package:
- @./scripts/prereq.sh $@
+_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
diff --git a/Makefile.adk b/Makefile.adk
deleted file mode 100644
index 78c328c5d..000000000
--- a/Makefile.adk
+++ /dev/null
@@ -1,181 +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)
-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
diff --git a/Makefile.inc b/Makefile.inc
new file mode 100644
index 000000000..4cc06dfad
--- /dev/null
+++ b/Makefile.inc
@@ -0,0 +1,4 @@
+CC?= gcc
+GMAKE?= env ${GMAKE_ENV} $(PWD)/scripts/make
+GMAKE_FMK= ${GMAKE} -f $(PWD)/mk/build.mk
+GMAKE_INV= ${GMAKE_FMK} --no-print-directory
diff --git a/README b/README
index 48f3a4373..03ac4a48c 100644
--- a/README
+++ b/README
@@ -18,11 +18,12 @@ 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.
diff --git a/adk/config/Makefile b/adk/config/Makefile
index 48e10983b..8481e3bff 100644
--- a/adk/config/Makefile
+++ b/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 $@ 2>/dev/null
+ @$(HOST_CC) $(HOST_CFLAGS) $^ -o $@
mconf: $(MCONF_OBJS) $(SHARED_OBJS)
- @$(HOST_CC) $(HOST_CFLAGS) $^ -o $@ $(LIBS) 2>/dev/null
+ @$(HOST_CC) $(HOST_CFLAGS) $^ -o $@ $(LIBS)
$(CONF_OBJS): %.o : %.c $(SHARED_DEPS)
- @$(HOST_CC) $(HOST_CFLAGS) -I. -c $< -o $@ 2>/dev/null
+ @$(HOST_CC) $(HOST_CFLAGS) -I. -c $< -o $@
$(MCONF_OBJS): %.o : %.c $(SHARED_DEPS)
- @$(HOST_CC) $(HOST_CFLAGS) -I. -c $< -o $@ 2>/dev/null
+ @$(HOST_CC) $(HOST_CFLAGS) -I. -c $< -o $@
glob.o: glob.c $(SHARED_DEPS)
- @$(HOST_CC) $(HOST_CFLAGS) -I. -c glob.c -o $@ 2>/dev/null
+ @$(HOST_CC) $(HOST_CFLAGS) -I. -c glob.c -o $@
lkc_defs.h: lkc_proto.h
@sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
diff --git a/mk/build.mk b/mk/build.mk
index f17a476e7..3d0124cca 100644
--- a/mk/build.mk
+++ b/mk/build.mk
@@ -95,7 +95,9 @@ noconfig_targets:= menuconfig \
defconfig
POSTCONFIG= -@\
- if [ ! -f .firstrun ]; then \
+ if [ -f .adkinit ];then rm .adkinit;\
+ else \
+ if [ -f .config.old ];then \
$(ADK_TOPDIR)/adk/tools/pkgrebuild;\
rebuild=0; \
cleandir=0; \
@@ -131,14 +133,22 @@ 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 cleansystem'";\
+ echo "You should rebuild with 'make cleandir'";\
fi; \
if [ $$rebuild -eq 1 ];then \
cp .config .config.old;\
fi; \
fi; \
- if [ -f .firstrun ]; then rm .firstrun; fi
+ fi
# Pull in the user's configuration file
ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
@@ -151,9 +161,8 @@ 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
- @printf " ---> generating dependencies.. "
+ @echo "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
@@ -161,6 +170,7 @@ ${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
@@ -251,20 +261,17 @@ clean:
rm -f ${ADK_TOPDIR}/package/Depends.mk
cleankernel:
- @printf " ---> cleaning kernel build directories.. "
+ @$(TRACE) cleankernel
@rm -rf $(TOOLCHAIN_BUILD_DIR)/w-linux* $(BUILD_DIR)/linux
- @printf "done\n"
cleandir:
- @printf " ---> cleaning build directories and files.. "
+ @$(TRACE) cleandir
@$(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*
- @rm -f ${ADK_TOPDIR}/package/Depends.mk ${ADK_TOPDIR}/prereq.mk
- @printf "done\n"
+ @rm -f .menu .tmpconfig.h .rebuild* ${ADK_TOPDIR}/package/Depends.mk ${ADK_TOPDIR}/prereq.mk
cleansystem:
@$(TRACE) cleansystem
@@ -273,22 +280,20 @@ 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:
- @printf " ---> cleaning build directories, files and downloads.. "
+ @$(TRACE) distclean
@$(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 .config* .defconfig .tmpconfig.h all.config prereq.mk
- @rm -f .firstrun .menu package/Depends.mk .ADK_HAVE_DOT_CONFIG .rebuild.*
+ @rm -f .adkinit .config* .defconfig .tmpconfig.h all.config prereq.mk
+ @rm -f .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)
@@ -296,7 +301,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 PATH QEMU SHELL SHA256
+export HOST_CC HOST_CXX BASH MAKE LANGUAGE LC_ALL OStype PATH QEMU SHELL
endif
all: menuconfig
@@ -445,8 +450,50 @@ 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)"\$$ \
@@ -495,20 +542,18 @@ _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 .config* .defconfig .tmpconfig.h all.config
+ @rm -f .adkinit .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)
@@ -528,16 +573,14 @@ $(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/*)
- @printf " ---> generating menu structure.. "
+ @echo "Generating menu structure ..."
@$(BASH) $(ADK_TOPDIR)/scripts/create-menu
@$(ADK_TOPDIR)/adk/tools/pkgmaker
@:>.menu
- @printf "done\n"
dep: $(ADK_TOPDIR)/adk/tools/depmaker
- @printf " ---> generating dependencies.. "
+ @echo "Generating dependencies ..."
@$(ADK_TOPDIR)/adk/tools/depmaker > ${ADK_TOPDIR}/package/Depends.mk
- @printf "done\n"
.PHONY: menu dep
diff --git a/mk/buildhlp.mk b/mk/buildhlp.mk
index f664e19b7..ae52fc132 100644
--- a/mk/buildhlp.mk
+++ b/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; \
diff --git a/mk/fetch.mk b/mk/fetch.mk
index ccd2ff327..dfd190a55 100644
--- a/mk/fetch.mk
+++ b/mk/fetch.mk
@@ -31,7 +31,7 @@ ifneq ($(ADK_DISABLE_CHECKSUM),y)
@if [ ! -e $(firstword ${FULLDISTFILES}).nohash ]; then \
OK=n; \
allsums="$(strip ${PKG_HASH})"; \
- ($${SHA256} ${FULLDISTFILES}; echo exit) | while read sum name; do \
+ (PATH='$(HOST_PATH)' sha256sum ${FULLDISTFILES}; echo exit) | while read sum name; do \
if [[ $$sum = exit ]]; then \
[[ $$OK = n ]] && echo >&2 "==> No distfile found!" || :; \
[[ $$OK = 1 ]] || exit 1; \
diff --git a/mk/host-bottom.mk b/mk/host-bottom.mk
index e28b1daf1..caba52f3e 100644
--- a/mk/host-bottom.mk
+++ b/mk/host-bottom.mk
@@ -6,10 +6,10 @@ host-ex