summaryrefslogtreecommitdiff
path: root/config/prep_buildtree
blob: 4e35b51813b41d7eb7f3bc28d1df8acc180f796a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#! /bin/sh

# This script prepares a PostgreSQL build tree.  It is intended
# to be run by the configure script.

set -e
me=`basename $0`

help="\
Usage: $me sourcetree [buildtree]"

if test -z "$1"; then
    echo "$help" 1>&2
    exit 1
elif test x"$1" = x"--help"; then
    echo "$help"
    exit 0
fi
sourcetree=$1

buildtree=${2:-'.'}

for item in `find "$sourcetree" -type d -\( -name CVS -prune -o -print -\)`; do
    subdir=`expr "$item" : "$sourcetree\(.*\)"` || true
    mkdir -p "$buildtree/$subdir"
done

for item in `find "$sourcetree" -name Makefile -o -name GNUmakefile`; do
    subdir=`expr "$item" : "$sourcetree\(.*\)"` || true
    if test ! -e "${item}.in"; then
        ln -fs "$item" "$buildtree/$subdir"
    fi
done