]> rtime.felk.cvut.cz Git - sysless.git/commitdiff
Add support for building all provided configurations
authorMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 18 Jul 2010 20:44:10 +0000 (22:44 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 18 Jul 2010 20:44:10 +0000 (22:44 +0200)
This is just a migration of recently created sysless-build-all
repository to this repository. I realized that it has no sense to have a
separate repository for one Makefile and one shell script.

build-all/.gitignore [new file with mode: 0644]
build-all/Makefile [new file with mode: 0644]
build-all/create-build-tree.sh [new file with mode: 0755]

diff --git a/build-all/.gitignore b/build-all/.gitignore
new file mode 100644 (file)
index 0000000..a18fc5a
--- /dev/null
@@ -0,0 +1,2 @@
+/board/
+/Makefile.dirs
diff --git a/build-all/Makefile b/build-all/Makefile
new file mode 100644 (file)
index 0000000..cee28d4
--- /dev/null
@@ -0,0 +1,14 @@
+include Makefile.dirs
+
+all $(MAKECMDGOALS): Makefile.dirs $(BUILD_DIRS)
+
+Makefile.dirs:
+       ./create-build-tree.sh
+
+define subdir
+.PHONY: $1
+$1:
+       $$(MAKE) -C $1 $(MAKECMDGOALS)
+endef
+
+$(foreach d,$(BUILD_DIRS),$(eval $(call subdir,$d)))   
diff --git a/build-all/create-build-tree.sh b/build-all/create-build-tree.sh
new file mode 100755 (executable)
index 0000000..6d8ad7b
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+set -e
+
+cat <<EOF > Makefile.dirs
+# Automatically generated - do not edit
+BUILD_DIRS = \\
+EOF
+
+find ../board -name 'config.*' | while read config; do
+    ext=${config##*.}
+    dir=${config%/*}
+    dir=${dir%/config}
+    board=${dir#../board/}
+    name=${board#*/}
+
+    if [ x$name = x$ext -o x$ext = xtarget ]; then
+       build=board/$board
+    else
+       build=board/$board-$ext
+    fi
+    mkdir -p ${build}
+
+    back=$(echo $build|sed -e 's|[^/]\+|..|g')
+
+    (
+       cd $build
+       ln -s $back/../{app,arch,board,doc,libs4c,Makefile,Makefile.omk,Makefile.rules} .
+       ln -s $back/$config config.target
+    )
+
+    echo "     $build \\" >> Makefile.dirs
+done