]> granicus.if.org Git - apache/blob - build/fastgen.sh
These are in 2.4.x
[apache] / build / fastgen.sh
1 #! /bin/sh
2 #
3 # Licensed to the Apache Software Foundation (ASF) under one or more
4 # contributor license agreements.  See the NOTICE file distributed with
5 # this work for additional information regarding copyright ownership.
6 # The ASF licenses this file to You under the Apache License, Version 2.0
7 # (the "License"); you may not use this file except in compliance with
8 # the License.  You may obtain a copy of the License at
9 #
10 #     http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #
18 #
19 # The build environment was provided by Sascha Schumann.
20
21 srcdir=$1
22 shift
23
24 mkdir_p=$1
25 shift
26
27 bsd_makefile=$1
28 shift
29
30 top_srcdir=`(cd $srcdir; pwd)`
31 top_builddir=`pwd`
32
33 if test "$mkdir_p" = "yes"; then
34   mkdir_p="mkdir -p"
35 else
36   mkdir_p="$top_srcdir/build/mkdir.sh"
37 fi
38
39 if test "$bsd_makefile" = "yes"; then
40   (cd $top_srcdir; ./build/bsd_makefile)  
41
42   for makefile in $@; do
43     echo "creating $makefile"
44     dir=`echo $makefile|sed 's%/*[^/][^/]*$%%'`
45
46     if test -z "$dir"; then
47         real_srcdir=$top_srcdir
48         real_builddir=$top_builddir
49         dir="."
50     else
51         $mkdir_p "$dir/"
52         real_srcdir=$top_srcdir/$dir
53         real_builddir=$top_builddir/$dir
54     fi
55     cat - $top_srcdir/$makefile.in <<EOF      | \
56        sed 's/^include \(.*\)/.include "\1"/' | \
57        sed 's/^ifdef \(.*\)/.ifdef \1/'       | \
58        sed 's/^else\(.*\)/.else\1/'           | \
59        sed 's/^endif\(.*\)/.endif\1/' >$makefile 
60 top_srcdir   = $top_srcdir
61 top_builddir = $top_builddir
62 srcdir       = $real_srcdir
63 builddir     = $real_builddir
64 VPATH        = $real_srcdir
65 EOF
66     
67     touch $dir/.deps
68   done
69 else  
70   for makefile in $@; do
71     echo "creating $makefile"
72     dir=`echo $makefile|sed 's%/*[^/][^/]*$%%'`
73
74     if test -z "$dir"; then
75         real_srcdir=$top_srcdir
76         real_builddir=$top_builddir
77         dir="."
78     else
79         $mkdir_p "$dir/"
80         real_srcdir=$top_srcdir/$dir
81         real_builddir=$top_builddir/$dir
82     fi
83     cat - $top_srcdir/$makefile.in <<EOF >$makefile
84 top_srcdir   = $top_srcdir
85 top_builddir = $top_builddir
86 srcdir       = $real_srcdir
87 builddir     = $real_builddir
88 VPATH        = $real_srcdir
89 EOF
90
91     touch $dir/.deps
92   done
93 fi