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 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291
|
#!/bin/sh
#
# cook - file construction tool
# Copyright (C) 1994-1999, 2001 Peter Miller;
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
#
# MANIFEST: shell script to generate Makefile file
#
clean_files="core y.tab.c y.tab.h y.output .bin .bindir common/lib.\$(LIBEXT)"
#
# list of progams to be linked and installed
#
progs=
#
# Emit the rules to build a directory, and all the ones above it.
#
recursive_mkdir()
{
src_dir="$1"
dst_dir="$2"
flavor="${3-datadir}"
while :
do
dirvar=`echo $src_dir | sed 's|[^a-zA-Z]|_|g'`
dotdot1=`dirname ${src_dir-.}`
dotdot2=`dirname ${dst_dir-.}`
if eval "test \${${dirvar}_${flavor}-no} != yes" ; then
echo ""
if test "$dotdot1" != "." -a "$dotdot2" != "." ; then
echo "$src_dir/.${flavor}: $dotdot1/.${flavor}"
else
echo "$src_dir/.${flavor}:"
fi
echo " -\$(INSTALL) -m 0755 -d $dst_dir"
echo " @-test -d $dst_dir && touch \$@"
echo " @sleep 1"
eval "${dirvar}_${flavor}=yes"
clean_files="$clean_files $src_dir/.${flavor}"
fi
src_dir=$dotdot1
dst_dir=$dotdot2
if test "$src_dir" = "." -o "$dst_dir" = "." ; then break; fi
done
}
remember_prog()
{
if eval "test \"\${prog_${1}-no}\" != yes"
then
progs="$progs $dir"
eval "prog_${1}=yes"
fi
}
all=
install_bin=
for file in $*
do
case $file in
*.y)
dir=`echo $file | sed 's|^\([^/]*\)/.*$|\1|'`
stem=`echo $file | sed 's/\.y$//'`
eval "${dir}_files=\"\$${dir}_files ${stem}.gen.\\\$(OBJEXT)\""
clean_files="$clean_files ${stem}.gen.c ${stem}.gen.h \
${stem}.gen.\$(OBJEXT)"
remember_prog $dir
;;
*.c)
dir=`echo $file | sed 's|^\([^/]*\)/.*$|\1|'`
stem=`echo $file | sed 's/\.c$//'`
eval "${dir}_files=\"\$${dir}_files ${stem}.\\\$(OBJEXT)\""
clean_files="$clean_files ${stem}.\$(OBJEXT)"
remember_prog $dir
;;
test/*/*)
root=`basename $file .sh`
test_files="$test_files ${root}"
;;
lib/*/LC_MESSAGES/common.po)
;;
lib/*.po)
stem=`echo $file | sed 's|^lib/\(.*\)\.po$|\1|'`
src="lib/$stem.mo"
po_files="$po_files $src"
dst="\$(libdir)/$stem.mo"
po_install_files="$po_install_files $dst"
recursive_mkdir `dirname $src` `dirname $dst` libdir
;;
lib/*/*/*.so)
;;
lib/*/*/*.pic)
# the "train track" syntax diagrams
# in the User Guide
;;
lib/*/man?/*)
stem=`echo $file | sed 's|^lib/||'`
man_files="$man_files \$(datadir)/$stem"
case $file in
lib/en/*)
stem2=`echo $file | sed 's|^lib/en/||'`
man_files="$man_files \$(mandir)/$stem2"
src="lib/$stem"
dst="\$(mandir)/$stem2"
recursive_mkdir `dirname $src` `dirname $dst` mandir
;;
esac
src="lib/$stem"
dst="\$(datadir)/$stem"
recursive_mkdir `dirname $src` `dirname $dst` datadir
;;
lib/*/*/main.*)
stem=`echo $file | sed 's|^lib/\(.*\)/main.*$|\1|'`
groff_all="$groff_all lib/$stem.ps lib/$stem.dvi lib/$stem.txt"
clean_files="$clean_files \
lib/$stem.ps lib/$stem.dvi lib/$stem.txt"
groff_install="$groff_install \$(datadir)/$stem.ps \
\$(datadir)/$stem.dvi \$(datadir)/$stem.txt"
;;
lib/*)
rest=`echo $file | sed 's|^lib/||'`
dst="\$(datadir)/$rest"
lib_files="$lib_files $dst"
recursive_mkdir `dirname lib/$rest` `dirname $dst` datadir
;;
script/*.in)
prog=`echo $file | sed 's|^script/\(.*\)[.]in$|\1|'`
all="${all} bin/${prog}\$(EXEEXT)"
install_bin="${install_bin} \
\$(bindir)/\$(PROGRAM_PREFIX)${prog}\$(PROGRAM_SUFFIX)\$(EXEEXT)"
;;
*)
;;
esac
done
for prog in $progs
do
echo ""
eval "echo \"${prog}_obj =\" \${${prog}_files}"
if test "$prog" = common; then continue; fi
echo ""
echo "bin/${prog}\$(EXEEXT): \$(${prog}_obj) common/lib.\$(LIBEXT) .bin"
echo " \$(CC) \$(LDFLAGS) -o \$@ \$(${prog}_obj) \
common/lib.\$(LIBEXT) \$(LIBS)"
all="${all} bin/${prog}\$(EXEEXT)"
if test "$prog" = fstrcmp; then continue; fi
if test "$prog" = file_check; then continue; fi
echo ""
echo "\$(bindir)/\$(PROGRAM_PREFIX)${prog}\$(PROGRAM_SUFFIX)\$(EXEEXT):\
bin/${prog}\$(EXEEXT) .bindir"
echo " \$(INSTALL_PROGRAM) bin/${prog}\$(EXEEXT) \$@"
install_bin="${install_bin} \
\$(bindir)/\$(PROGRAM_PREFIX)${prog}\$(PROGRAM_SUFFIX)\$(EXEEXT)"
done
echo ""
echo "#"
echo "# The real default target"
echo "#"
echo "all:" ${all} po groff_all
echo ""
echo "common/lib.\$(LIBEXT): \$(common_obj)"
echo " rm -f \$@"
echo " \$(AR) qc \$@ \$(common_obj)"
echo " \$(RANLIB) \$@"
echo ""
echo ".bin:"
echo " -mkdir bin"
echo " -chmod 0755 bin"
echo " @-test -d bin && touch .bin"
echo " @sleep 1"
echo ""
echo ".bindir:"
echo " -\$(INSTALL) -m 0755 -d \$(bindir)"
echo " @-test -d \$(bindir) && touch .bindir"
echo " @sleep 1"
echo ""
echo "sure:" $test_files
echo " @echo Passed All Tests"
echo ""
echo "po_files_yes =" $po_files
echo ""
echo "po_files_no ="
echo ""
echo "po: \$(po_files_@po_files@)"
echo ""
echo "groff_all_yes =" $groff_all
echo ""
echo "groff_all_no ="
echo ""
echo "groff_all: \$(groff_all_@have_groff@)"
echo ""
echo "clean-obj:"
echo $clean_files | tr ' ' '\12' | gawk '{
if (pos > 0 && pos + length($1) > 71) { printf("\n"); pos = 0; }
if (pos == 0) { printf " rm -f"; pos = 13; }
printf " %s", $1
pos += 1 + length($1);
}
END { if (pos) printf "\n"; }'
echo ""
echo "clean: clean-obj"
echo $all | tr ' ' '\12' | gawk '{
if (pos > 0 && pos + length($1) > 71) { printf("\n"); pos = 0; }
if (pos == 0) { printf " rm -f"; pos = 13; }
printf " %s", $1
pos += 1 + length($1);
}
END { if (pos) printf "\n"; }'
echo ' rm -f $(po_files_yes)'
echo ' rm -f $(groff_all_yes)'
echo ""
echo "distclean: clean"
echo " rm -f Makefile common/config.h etc/libdir.so etc/libdir-h"
echo " rm -f config.status config.cache config.log"
echo ""
echo "install-bin:" ${install_bin}
echo ""
echo "install-man:" $man_files
echo ""
echo "po_install_files_yes =" $po_install_files
echo ""
echo "po_install_files_no ="
echo ""
echo "install-po: \$(po_install_files_@po_files@)"
echo ""
echo "groff_install_yes =" $groff_install
echo ""
echo "groff_install_no ="
echo ""
echo "install-groff: \$(groff_install_@have_groff@)"
echo ""
echo "install-lib:" $lib_files install-po install-groff
echo ""
echo "install: install-bin install-man install-lib"
exit 0
|