]> git.saurik.com Git - wxWidgets.git/blob - install/unix/setup/general/createall
-somewhat more elegant method, supporting the src subdir (-Markus)
[wxWidgets.git] / install / unix / setup / general / createall
1 #! /bin/sh
2
3 # Just grab dirbase/dir(s)
4 readbase ()
5 {
6 DIRBASE=$1
7 DIRCONTENTS=$2
8 for each in $DIRBASE/*
9 do
10 if test -d $each
11 then
12 DIRCONTENTS="$DIRCONTENTS $each"
13 fi
14 done
15 echo $DIRCONTENTS
16 }
17
18 # Prefer subdir/src over subdir, use whichever available
19 readbase2 ()
20 {
21 DIRBASE=$1
22 DIRCONTENTS=$2
23 for each in $DIRBASE/*
24 do
25 if test -d $each
26 then
27 if test -d $each/src
28 then
29 DIRCONTENTS="$DIRCONTENTS $each/src"
30 else
31 DIRCONTENTS="$DIRCONTENTS $each"
32 fi
33 fi
34 done
35 echo $DIRCONTENTS
36 }
37
38 OS=$OSTYPE
39
40 if test "x$OS" = x; then
41 echo "please set the environment variable OSTYPE "
42 echo "to a value appropriate for your system."
43 echo "to do so type: setenv OSTYPE `uname` for the csh, tcsh"
44 echo " export OSTYPE=`uname` for other shells"
45 exit 1
46 fi
47
48 SRC_DIR=`readbase src src`
49 SAMPLES_DIR=`readbase2 samples`
50 UTILS_DIR=`readbase2 utils`
51 USER_DIR=`readbase2 user`
52
53 ALL_DIR="$SRC_DIR $SAMPLES_DIR $UTILS_DIR $USER_DIR"
54
55 echo Creating for: $OS
56
57 # create defaults
58 if test ! -d install/unix/setup/$OS; then
59 mkdir install/unix/setup/$OS
60 fi
61
62 SUBSTFILE=install/unix/setup/$OS/substit
63
64 # the substit file first
65 if test -f install/unix/setup/substit ; then
66 cat install/unix/setup/substit | sed "s/*/@/g" > $SUBSTFILE;
67 rm -f install/unix/setup/substit
68 fi
69 # now the template file
70 cat install/unix/setup/maketmpl.in | sed -f $SUBSTFILE > install/unix/setup/$OS/maketmpl
71
72 # now the config header file
73 #if test -f setup/wx_setup.h ; then
74 # cat setup/wx_setup.h > setup/$OS/wx_setup.h;
75 # rm -f setup/wx_setup.h
76 #fi
77
78 # create lib and bin directory
79 if test ! -d lib; then
80 mkdir lib
81 fi
82 if test ! -d lib/$OS; then
83 mkdir lib/$OS
84 fi
85 if test ! -d bin; then
86 mkdir bin
87 fi
88 if test ! -d bin/$OS; then
89 mkdir bin/$OS
90 fi
91
92 # create makefiles
93 for each in $ALL_DIR; do
94 DIR=$each/$OS
95 # create Makefile in directory
96 if test -r $each/Makefile.in ; then
97 # create directory
98 if test ! -d $DIR; then
99 echo "Creating Directory: $DIR..."
100 mkdir $DIR
101 fi
102 echo "Creating: $DIR/Makefile..."
103 cat $each/Makefile.in | sed -f $SUBSTFILE > $DIR/Makefile
104 (cd $DIR; make subdirs > /dev/null;)
105 fi
106 done