1 | #!/bin/sh
|
---|
2 |
|
---|
3 | # Find out the path to the script.
|
---|
4 | SOURCE_DIR=`which -- "$0" 2>/dev/null`
|
---|
5 | # Maybe we are running bash.
|
---|
6 | [ -z "$SOURCE_DIR" ] && SOURCE_DIR=`which -- "$BASH_SOURCE"`
|
---|
7 | [ -z "$SOURCE_DIR" ] && exit 1
|
---|
8 | SOURCE_DIR=`dirname -- "$SOURCE_DIR"`
|
---|
9 | SOURCE_DIR=`cd $SOURCE_DIR && echo $PWD`
|
---|
10 |
|
---|
11 | # Make sure we don't make a mess in the source root.
|
---|
12 | if [ "$PWD" = "$SOURCE_DIR" ]; then
|
---|
13 | mkdir -p build_all
|
---|
14 | cd build_all
|
---|
15 | fi
|
---|
16 |
|
---|
17 | CONFIG_RULES="${SOURCE_DIR}/HelenOS.config"
|
---|
18 | CONFIG_DEFAULTS="${SOURCE_DIR}/defaults"
|
---|
19 |
|
---|
20 | # Find all the leaf subdirectories in the defaults directory.
|
---|
21 | PROFILES=`find ${CONFIG_DEFAULTS} -type d -links 2 -printf "%P\n" | sort`
|
---|
22 |
|
---|
23 |
|
---|
24 | echo
|
---|
25 | echo "###################### Configuring all profiles ######################"
|
---|
26 |
|
---|
27 | for profile in $PROFILES; do
|
---|
28 | if [ -f ${profile}/build.ninja ]; then
|
---|
29 | ninja -C ${profile} build.ninja || exit 1
|
---|
30 | continue
|
---|
31 | fi
|
---|
32 |
|
---|
33 | echo "Configuring profile ${profile}"
|
---|
34 |
|
---|
35 | # Let HelenOS config tool write out Makefile.config and config.h.
|
---|
36 | mkdir -p ${profile} || exit 1
|
---|
37 | cd ${profile} || exit 1
|
---|
38 | ${SOURCE_DIR}/tools/config.py ${CONFIG_RULES} ${CONFIG_DEFAULTS} hands-off ${profile} || exit 1
|
---|
39 | cd -
|
---|
40 |
|
---|
41 |
|
---|
42 | if [ "$profile" = 'special/abs32le' ]; then
|
---|
43 | cross_target='ia32'
|
---|
44 | else
|
---|
45 | cross_target=`dirname $profile`
|
---|
46 | if [ "$cross_target" = '.' ]; then
|
---|
47 | cross_target=$profile
|
---|
48 | fi
|
---|
49 | fi
|
---|
50 |
|
---|
51 | meson ${SOURCE_DIR} ${profile} --cross-file ${SOURCE_DIR}/meson/cross/${cross_target} || exit 1
|
---|
52 | done
|
---|
53 |
|
---|
54 | echo
|
---|
55 | echo "###################### Building all profiles ######################"
|
---|
56 |
|
---|
57 | for profile in $PROFILES; do
|
---|
58 | ninja -C ${profile} || exit 1
|
---|
59 | done
|
---|
60 |
|
---|
61 |
|
---|
62 | if [ "$#" -eq 1 ] && [ "$1" = 'images' ]; then
|
---|
63 | echo "###################### Building all images ######################"
|
---|
64 |
|
---|
65 | for profile in $PROFILES; do
|
---|
66 | ninja -C ${profile} image_path || exit 1
|
---|
67 | done
|
---|
68 | else
|
---|
69 | echo
|
---|
70 | echo "Bootable images not built."
|
---|
71 | echo "Run '$0 images' to build them as well."
|
---|
72 | fi
|
---|