File: makeall

package info (click to toggle)
vrweb 1.5-5.1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 15,124 kB
  • ctags: 27,485
  • sloc: cpp: 134,333; ansic: 95,670; sh: 1,072; asm: 712; makefile: 610; pascal: 536; perl: 347; csh: 26
file content (149 lines) | stat: -rwxr-xr-x 3,089 bytes parent folder | download | duplicates (4)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#!/bin/sh
#
# makeall - little helper for calling
# make in the appropriate subdirs
#
# created: mpichler, 19960523
# changed: mpichler, 19970516


usage()
{
  echo '
usage: makeall [-]OPTION
       makeall [-]i [MAKEOPTS]

OPTION is one (cannot be combined) of:
  h  print this usage help
  r  set root dir
  m  make Makefiles from Imakefiles
  a  make Makefiles and make depend
  i  make and "install" binaries (into ./installed)
     MAKEOPTS (e.g. -n or -k) are passed to make call

See file INSTALLATION for more information.

sample usage (set root dir, create Makefiles, do compilation):
  makeall -r
  makeall -m
  makeall -i
'
  exit 0
} # usage


echo "VRweb 1.5 source code compilation script."


# here you may hardcode your CPU type
# CPU=

# try to determine CPU type from system name (if unset)
if [ _"$CPU" = _ ]
then
  case "`uname -s`" in
    AIX )     CPU=IBMAIX_GNU ;;
    FreeBSD ) CPU=FREEBSD    ;;
    HP-UX )   CPU=HPUX9_GNU  ;;
    IRIX* )   CPU=SGI_GNU    ;;
    Linux )
      case "`uname -r`" in
        1* )  CPU=LINUX      ;;
        2* )  CPU=LINUX_ELF  ;;
      esac
    ;;
    OSF1 )    CPU=ALPHA_GNU  ;;
    SunOS )
      case "`uname -r`" in
        4* )  CPU=SUN4_GNU   ;;
        5* )  CPU=SUN5_GNU   ;;
      esac
    ;;
    ULTRIX )  CPU=PMAX_GNU   ;;
  esac
fi

if [ _"$CPU" = _ ]
then
  echo "makeall. error: unable to set CPU"
  exit 1
fi

echo "CPU set to: $CPU"
export CPU

# make sure scripts are found
if [ ! -d `pwd`/config/scripts ]
then
  echo "makeall. error: could not find script directory ./config/scripts"
  echo "(must run makeall in directory where it is located)"
  exit 1
fi

PATH=`pwd`/config/scripts:"$PATH" ; export PATH
echo "PATH set to: $PATH"
# echo "`pwd`/config/scripts prepended to PATH"

# here you may prepend the path to GNU make
# (or create link in scripts dir, see INSTALLATION guide)
# PATH=/usr/local/bin:"$PATH" ; export PATH
echo "make command used: `type make`"
if make --help 2>/dev/null >&2
then
  echo "make seems to be GNU make"
else
  echo "makeall. error: make is not GNU make; please set PATH to GNU make"
  exit 1
fi

# now ready to compile
date


setrootdir()
{
# usage (internal): setrootdir file prefix
  pfile=`pwd`/$1
  if [ ! -f "$pfile" ]
  then
    echo "makeall. error: could not find ./$1"
    exit 1
  fi
  mv "$pfile" "$pfile"~
  echo "setting RootDir in ./$1 to" `pwd`
  # this will fail if the current path contains a '%' sign, do it manually then
  sed 's%^\('"$2"'\).*%\1'`pwd`'%' "$pfile"~ > "$pfile"
} # setrootdir


case "$1" in
  *h* | *\?* )
    usage
  ;;
  r | -r )
    setrootdir config/hg_path.def "#define RootDir "
    setrootdir config/scripts/hgmkmf "RootDir="
    chmod +x config/scripts/hgmkmf
    exit
  ;;
  m | -m )
    cd src ; hgmkmf ; make Makefiles
  ;;
  a | -a )
    cd src ; hgmkmf -a
  ;;
  i | -i )
    shift
    cd src ; make $* install
    # install (into ./installed) or .h files are not found
  ;;
  * )
    echo '
makeall: invalid or missing option.'
    usage
  ;;
esac

# output no longer logged by this script itself
echo "... makeall finished."
date