RootConfigureFile.stg 2.49 KB
Newer Older
1
group RootConfigureFile;
Andreas Wandinger's avatar
Andreas Wandinger committed
2

3
RootConfigureFile() ::= <<
Andreas Wandinger's avatar
Andreas Wandinger committed
4
5
#!/bin/sh

Andreas Wandinger's avatar
Andreas Wandinger committed
6
# The directory in which we are operating.
Andreas Wandinger's avatar
Andreas Wandinger committed
7
OP=\$(echo \$0 | sed 's/\/configure\$//g');
Andreas Wandinger's avatar
Andreas Wandinger committed
8

Andreas Wandinger's avatar
Andreas Wandinger committed
9
# The list of the first-level subdirectories.
Andreas Wandinger's avatar
Andreas Wandinger committed
10
11
12
13
DIRS=\$(find \$OP -mindepth 1 -maxdepth 1 -not -name ".*" -type d);

# The absolute path of the Makefile.
MF=\$OP/Makefile;
Andreas Wandinger's avatar
Andreas Wandinger committed
14
15

# Generate the root Makefile.
Andreas Wandinger's avatar
Andreas Wandinger committed
16
17
18
19
20
21
22
23
24
25
26
27
echo "";
echo "  generating root Makefile ...";
rm -f \$MF;
echo "# NOTICE: this Makefile has been generated, so your"                                \>\> \$MF;
echo "#         modifications may get lost. To rebuild this"                              \>\> \$MF;
echo "#         file, run the './configure' script."                                      \>\> \$MF;
echo ""                                                                                   \>\> \$MF;
echo "# The list of the first-level subdirectories."                                      \>\> \$MF;
echo "DIRS=\\\$\\\$(find \$OP -mindepth 1 -maxdepth 1 -not -name \".*\" -type d)"              \>\> \$MF;
echo ""                                                                                   \>\> \$MF;
echo "# The default build target."                                                        \>\> \$MF;
echo "all:"                                                                               \>\> \$MF;
Andreas Wandinger's avatar
Andreas Wandinger committed
28
echo '	@for D in \${DIRS}; do make -C \$\$D || exit \$\$?; done'                              \>\> \$MF;
Andreas Wandinger's avatar
Andreas Wandinger committed
29
30
31
echo ""                                                                                   \>\> \$MF;
echo "# The default clean target."                                                        \>\> \$MF;
echo "clean:"                                                                             \>\> \$MF;
Andreas Wandinger's avatar
Andreas Wandinger committed
32
echo '	@for D in \${DIRS}; do make -C \$\$D clean; done'                                    \>\> \$MF;
33
34
35
36
echo "# The Mr. Proper build target."                                                        \>\> \$MF;
echo "mrproper:"                                                                               \>\> \$MF;
echo '	@for D in \${DIRS}; do make -C \$\$D mrproper; done'                              \>\> \$MF;
echo '	@rm Makefile'                              \>\> \$MF;
Andreas Wandinger's avatar
Andreas Wandinger committed
37
38

# Go down the directory hierarchy.
Andreas Wandinger's avatar
Andreas Wandinger committed
39
40
41
42
43
for D in \$DIRS; do
    echo "  processing directory \$D.";
    export ROOT=\$D && \$D/configure | awk 'BEGIN {OFS=""}; {print "    ", \$0}';
    echo "  leaving directory \$D.";
done;
Andreas Wandinger's avatar
Andreas Wandinger committed
44
45

# Finish.
Andreas Wandinger's avatar
Andreas Wandinger committed
46
47
48
49
echo "";
echo "  Success. Now you can simply run 'make' to build your application.";
echo "";
exit 0;
Andreas Wandinger's avatar
Andreas Wandinger committed
50
51

>>