New installation mechanism
authorceriel <none@none>
Tue, 15 Oct 1991 16:02:38 +0000 (16:02 +0000)
committerceriel <none@none>
Tue, 15 Oct 1991 16:02:38 +0000 (16:02 +0000)
17 files changed:
first/.distr
first/create_dir [new file with mode: 0755]
first/em_path.h.src
first/first
first/get_answer [new file with mode: 0755]
first/get_makepars [new file with mode: 0755]
first/get_sys [new file with mode: 0755]
first/get_sysvax [new file with mode: 0755]
first/install_tail [new file with mode: 0644]
first/limit_enquire [new file with mode: 0644]
first/limit_impl [new file with mode: 0755]
first/lint_params [new file with mode: 0644]
first/mk_config [new file with mode: 0755]
first/mk_makefile [new file with mode: 0755]
first/mk_target [new file with mode: 0755]
first/target_comp [new file with mode: 0644]
first/util_comp [new file with mode: 0644]

index bf014cd..85922be 100644 (file)
@@ -1,9 +1,18 @@
-hash
-ckpath
+create_dir
+em_path.h.src
 first
-did_first
-myecho.c
-fixlexlib
-cc.xenix.src
+get_answer
+get_makepars
+get_sys
+get_sysvax
+install_tail
+limit_enquire
+limit_impl
+lint_params
 local.h.src
-em_path.h.src
+mk_config
+mk_makefile
+mk_target
+myecho.c
+target_comp
+util_comp
diff --git a/first/create_dir b/first/create_dir
new file mode 100755 (executable)
index 0000000..e805fd6
--- /dev/null
@@ -0,0 +1,11 @@
+if ( cd $1 ) 2>/dev/null
+then
+       :
+elif mkdir $1 2>/dev/null
+then
+       :
+else
+       echo $0: could not create directory $1 1>&2
+       exit 1
+fi
+exit 0
index 4542b0e..b5be697 100644 (file)
@@ -4,7 +4,7 @@
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
 /* Intended as a common directory for ALL temporary files */
-#define TMP_DIR                "/usr/tmp"
+#define TMP_DIR                "/tmp"
 
 /* Access to the ACK tree and parts thereof */
 #define EM_DIR         "/usr/em"       /* The root directory for EM stuff */
index 8a549cc..88d2088 100755 (executable)
@@ -1,20 +1,10 @@
-: check that the script is started from the "first" directory
-p=`pwd`
-case `basename $p` in
-first)
+case $0 in
+*/first)
+       FDIR=`expr $0 : '\(.*\)/first'`
        ;;
-*)
-       echo "this script must be started from the 'first' directory"
-       exit 3
+first) FDIR=.
        ;;
 esac
-: check $PATH first
-if sh ckpath
-then
-       echo "PATH is ok"
-else
-       exit 1
-fi
 echo check write-ability of /tmp and /usr/tmp ...
 if ( >/usr/tmp/aaax.$$ )
 then
@@ -31,178 +21,92 @@ else
        exit 2
 fi
 echo "/tmp and /usr/tmp ok"
-echo setting ACK HOME Directory in ../h/em_path.h ...
-rm -f em_path.h
-HM=`cd ..; pwd`
-sed -e "/^#define[     ]*EM_DIR/s@\".*\"@\"$HM\"@" <em_path.h.src >em_path.h
-if cmp ../h/em_path.h em_path.h >/dev/null 2>&1
-then
-       : Don't touch ../h/em_path.h, it's already correct
-       echo "../h/em_path.h already correct"
+
+if [ -f echo ]
+then :
 else
-       rm -f ../h/em_path.h
-       if mv em_path.h ../h >/dev/null 2>&1
-       then    echo "../h/em_path.h replaced"
-       else
-               echo "Sorry, can't replace ../h/em_path.h"
-               exit 7
-       fi
-fi
 echo compile own echo program, so that we know how it works ...
-if cc -o echo myecho.c > /dev/null 2>&1
+if cc -o echo $FDIR/myecho.c > /dev/null 2>&1
 then
        echo compilation succeeded
 else
        echo "Sorry, cc does not seem to work"
        exit 8
 fi
-cp echo ../bin/echo
-: find cc option for lex library
-if fixlexlib
-then
-       :
-else
-       exit 9
 fi
-: remove non-system as and ld from descr files
-if (ack_sys) >/dev/null 2>&1
-then
-       : echo Your system is: `ack_sys`.
-else
-       echo -n "Give me the type of your system, the current choice is:
-pdp_v7         PDP11 with sep I/D and version 7 (or BSD 2.8, 2.9)
-vax_bsd4_1a    VAX11 with BSD4.1a
-vax_bsd4_2     VAX11 with BSD4.2
-vax_sysV_2     VAX11 with System V.2
-pc_ix          IBM PC with PC/IX
-xenix3         IBM AT running Microsoft Xenix V3.2
-i386           Intel 80386 system running Xenix System V
-m68_unisoft    Motorola 68000 with Unisoft UNIX
-sun3           Sun 3 M68020 workstation 
-sun2           Sun 2 M68000 workstation
-m68_sysV_0     Motorola 68000 with Uniplus System V.0 Unix
-m68020         Motorola M68020 VME131 running Unix System V/68 R2V2.1
-SMALL          Neither of the above, small address space
-ANY            Neither of the above
 
-system type: "
-       if read SYSNAME
-       then
-               echo echo "$SYSNAME" >../bin/ack_sys
-               chmod +x ../bin/ack_sys
-               case `ack_sys` in
-               pdp_v7|vax_bsd4_1a|vax_bsd4_2|vax_sysV_2|pc_ix|m68_unisoft|sun3|sun2|m68_sysV_0|xenix3|i386|m68020) ;;
-               *)      echo None of the software especially intended for the named systems will work ;;
-               esac
-       else
-               echo Sorry, got EOF when reading system name.
-               exit 10
-       fi
-fi
-while :
-do
-echo -n "Your system is `ack_sys`, are you satisfied with that? (y/n) "
-if read YESNO
+if [ -f macros ]
 then
-       case $YESNO in
-       j*|y*)  break
-               ;;
-       n*)     echo Ok, I will give you another chance....
-               rm -f ../bin/ack_sys
-               exec sh $0
-               ;;
-       *)      echo "I do not understand your answer ($YESNO). Try again."
-               ;;
-       esac
-else
-       echo Sorry, got EOF when reading your answer.
-       exit 12
+       . macros
 fi
-done
+
+: "Now get system name and directories"
+. $FDIR/get_sys
+
 : "Take action according to the system used"
-: 'Prevent the use of the system assembler on for certain systems'
-: 'prevent the use of ranlib on pdp 11s'
-cp ../lib/vax4/descr.src ../lib/vax4/descr
-cp ../lib/descr/fe.src ../lib/descr/fe
-echo "take some actions according to system used ..."
-case `ack_sys` in
-pdp_*)         echo "disabling use of ranlib; cannot trust its result"
-               echo 'echo "no ranlib on this system"; exit 93' > ../bin/ranlib
-               chmod +x ../bin/ranlib
-               RMD=""
-               ;;
-*)             RMD=""
-               ;;
+BM=1
+OLDACM=$ACM
+OLDSYS=$SYS
+case $SYSNAME in
+vax_bsd4_1a)    ACM=vax4 ; SYS=BSD4_1 ; BYTE_ORDER=0123 ;;
+vax_bsd4_2)    ACM=vax4 ; SYS=BSD4_2 ; BYTE_ORDER=0123 ;;
+vax_sysV_2)    ACM=vax4 ; SYS=SYS_5 ; BYTE_ORDER=0123 ;;
+i386)          ACM=i386 ; SYS=SYS_5 ; BYTE_ORDER=0123 ;;
+sun3)          ACM=sun3 ; SYS=BSD4_2; BYTE_ORDER=3210 ;;
+sun2)          ACM=sun2 ; SYS=BSD4_2; BYTE_ORDER=3210 ;;
+m68_unisoft|m68k2)     ACM=m68k2 ; SYS=V7; BYTE_ORDER=3210 ;;
+m68_sysV_0|mantra)     ACM=mantra ; SYS=SYS_5; BYTE_ORDER=3210 ;;
+m68020)                ACM=m68020 ; SYS=SYS_5; BYTE_ORDER=3210 ;;
+sparc)         ACM=sparc ; SYS=BSD4_2; BYTE_ORDER=3210 ;;
+i86)           ACM=i86 ; SYS=SYS_5; BYTE_ORDER=0123 ;;
+xenix3)                ACM=xenix3 ; SYS=SYS_5; BYTE_ORDER=0123 ;;
+minix)         ACM=minix ; SYS=V7; BYTE_ORDER=0123 ;;
+pmds)          ACM=pmds ; SYS=V7; BYTE_ORDER=3210 ;;
+pmds4)         ACM=pmds4 ; SYS=V7; BYTE_ORDER=3210 ;;
+minixST)       ACM=minixST ; SYS=V7; BYTE_ORDER=3210 ;;
+m68k4)         ACM=m68k4 ; SYS=V7; BYTE_ORDER=3210 ;;
+*)             ACM=XXX ; SYS=XXX ; BYTE_ORDER=XXX ;;
 esac
-for i in $RMD
+
+: do not change the order in MACH_LIST. check limit_enquire first.
+MACH_LIST="i86 xenix3 minix i386 6500 6800 6805 6809 i80 em22 em24 em44 m68k2 pmds minixST m68k4 pmds4 sun2 mantra m68020 sun3 sparc ns pdp s2650 vax4 z80 z8000 arm"
+
+while :
 do
-(      cd ../lib/$i
-       echo "disabling use of local assembler and loader for $i"
-       if grep '^name as$' descr >/dev/null 2>&1
-       then
-               ed - descr <<'ABC'
-/^name as$/;/^end$/d
-/^name ld$/;/^end$/d
-w
-q
-ABC
+       for i in $MACH_LIST
+       do
+               if [ $i = $ACM ]
+               then break
+               fi
+       done
+       if [ $i = $ACM ]
+       then break
        fi
-)
+       echo "This installation script has no knowledge about $SYSNAME.
+You will have to specify the default machine that you want ACK to
+compile for. Choices:"
+       l=
+       x=
+       for i in $MACH_LIST
+       do
+               l="$l $i"
+               x=x$x
+               case $x in
+               xxxxxxxxxx)     echo $l
+                               x=
+                               l=
+                               ;;
+               esac
+       done
+       ACM=$OLDACM
+       echo $l
+       ./echo -n "Your choice: [$OLDACM] "
+       . $FDIR/get_answer
+       case $ANS in
+       '')     ANS="$ACM";;
+       esac
+       ACM="$ANS"
 done
-case `ack_sys` in
-vax_bsd_4_1a)
-       ( cd ../mach/vax4
-         mkdir libsys > /dev/null 2>&1
-         rm -f libsys/*
-         cp libbsd4_1a/* libsys
-       )
-       ;;
-vax_sysV_2)
-       ( cd ../lib/vax4
-         ed - descr <<'ABC'
-/CPP_F/s/$/ -D__USG/
-w
-q
-ABC
-       )
-       ( cd ../mach/vax4 
-         mkdir libsys > /dev/null 2>&1
-         rm -f libsys/*
-         cp libsysV_2/* libsys
-       )
-       ;;
-*)     ( cd ../lib/vax4
-         ed - descr <<'ABC'
-/CPP_F/s/$/ -D__BSD4_2/
-w
-q
-ABC
-       )
-       ( cd ../mach/vax4
-         mkdir libsys > /dev/null 2>&1
-         rm -f libsys/*
-         cp libbsd4_2/* libsys
-       )
-       ;;
-esac
-echo 'Setting the default machine in ../h/local.h ...'
-BM=1
-case `ack_sys` in
-pdp_v7)                ACM=pdp ; BM=0 ; SYS=V7 ;;
-vax_bsd4_1a)    ACM=vax4 ; SYS=BSD4_1 ;;
-vax_bsd4_2)    ACM=vax4 ; SYS=BSD4_2 ;;
-vax_sysV_2)    ACM=vax4 ; SYS=SYS_5 ;;
-pc_ix)         ACM=i86 ; BM=0 ; SYS=SYS_5 ;;
-xenix3)                ACM=xenix3 ; BM=0; SYS=SYS_5 ;;
-i386)          ACM=i386 ; SYS=SYS_5 ;;
-sun3)          ACM=sun3 ; SYS=BSD4_2 ;;
-sun2)          ACM=sun2 ; SYS=BSD4_2 ;;
-m68_unisoft)   ACM=m68k2 ; SYS=V7 ;;
-m68_sysV_0)    ACM=mantra ; SYS=SYS_5 ;;
-m68020)                ACM=m68020 ; SYS=SYS_5 ;;
-SMALL)         ACM=i86 ; BM = 0 ; SYS=XXX ;;
-*)             ACM=m68k2 ; SYS=XXX ;;
-esac
 while :
 do
 case $SYS in
@@ -210,230 +114,33 @@ V7|BSD4_1|BSD4_2|SYS_5)
        break
        ;;
 *)
-       echo -n "What kind of Unix are you running?
+       SYS=$OLDSYS
+       echo 'What kind of Unix is the target system running?
 Choices:
        V7      for Unix V7, BSD 2.*
        BSD4_1  for Berkeley 4.1
        BSD4_2  for Berkeley 4.2, 4.3, SunOS
-       SYS_5   for Xenix, System III, System V
-Your choice (V7|BSD4_1|BSD4_2|SYS_5): "
-       if read SYS
-       then
-               :
-       else
-               echo "Sorry, got EOF when reading your answer"
-               exit 12
-       fi
+       SYS_5   for Xenix, System III, System V'
+       ./echo -n "Your choice (V7|BSD4_1|BSD4_2|SYS_5): [$OLDSYS] "
+       . $FDIR/get_answer
+       case $ANS in
+       '')     ANS="$SYS";;
+       esac
+       SYS="$ANS"
        ;;
 esac
 done
 rm -f local.h
-sed -e /ACKM/s/'".*"'/'"'$ACM'"'/ -e /BIGMACH/s/'[01]'/$BM/ -e /SYSTEM/s/'^#[  ]*define[       ]*[a-zA-Z_][a-zA-Z0-9_]*'/"#    define $SYS"/ < local.h.src >local.h
-if cmp -s ../h/local.h local.h
-then
-       echo "../h/local.h already correct"
-else
-       cp local.h ../h
-       echo "../h/local.h updated"
-       rm -f local.h
-fi
-echo "Your default machine to compile for is $ACM"
-case `ack_sys` in
-i386)
-       ( cd ../lib/descr
-         ed - fe << ABC
-1,$s/-D{NAME}/-D{NAME} -DNO_PROTOTYPE/
-w
-q
-ABC
-       )
-       ;;
-xenix3)
-       echo "Xenix cannot handle our Makefiles; install our own make ..."
-       if ( cd ../util/make; make install )
-       then
-               echo "Done"
-       else
-               echo "Sorry, this seems to have failed."
-               echo "You have to install it by hand later, or use the Xenix"
-               echo "make anyway"
-       fi
-       echo "The Xenix C compiler cannot compile some of our programs."
-       echo "It complains about lack of heap space when many #defines are"
-       echo 'used. This is prevented by installing a "cc" shell script in'
-       echo 'the EM bin directory, which runs a .c file through a preprocessor'
-       echo 'before running it through the C compiler proper. Unfortunately,'
-       echo 'line number and filename information is lost. The compiler does'
-       echo 'not recognize its own line directives.'
-       echo 'You can remove this "cc" script from the EM bin directory'
-       echo 'when installation is done.'
-       cp cc.xenix.src cc.xenix
-       ed - cc.xenix <<ABC
-/EMHOME/s/=.*/=$HM/
-w
-q
-ABC
-       cp cc.xenix ../bin/cc
-       chmod +x ../bin/cc
-       echo "code-generators and peephole optimizer need more stack than the default."
-       echo "adapting LDFLAGS in Makefiles"
-       for i in ../mach/*/*cg
-       do
-               cp $i/Makefile $i/makefile
-               ed - $i/makefile <<ABC
-/LDFLAGS/s/$/ -F 3000/
-w
-q
-ABC
-       done
-       cp ../util/opt/Makefile ../util/opt/makefile
-       ed - ../util/opt/makefile <<ABC
-/LDFLAGS/s/$/-F 2000/
-w
-q
-ABC
-       echo "target optimizers do not work on Xenix; disabling their use"
-       for i in ../lib/*/descr
-       do
-               if grep "name asopt" $i > /dev/null 2>&1
-               then
-                       if test -f $i.top
-                       then
-                               :
-                       else
-                               mv $i $i.top
-                       fi
-                       cp $i.top $i
-                       ed - $i <<ABC
-/name asopt/;/^end/d
-w
-q
-ABC
-               fi
-       done
-       echo "the -l option in cc command puts library in wrong place."
-       echo "this is a problem with the lex library for the occam compiler."
-       echo "changing Makefile for Occam compiler"
-       cp ../lang/occam/comp/Makefile ../lang/occam/comp/makefile
-       ed - ../lang/occam/comp/makefile <<ABC
-/LEXLIB/s;-l.*;/lib/Slibl.a;
-w
-q
-ABC
-       ;;
-esac
-case X$BM in
-X0)
-       echo "set some installation parameters for small machines"
-       ( cd ../lang/cem/cemcom
-         cp SmallPars Parameters
-         cp Makefile makefile
-         ed - makefile <<ABC
-/MALLOC/s/=/=#/
-w
-q
-ABC
-         cd ../../../util/cpp
-         cp Makefile makefile
-         ed - makefile <<ABC
-/MALLOC/s/=/=#/
-w
-q
-ABC
-         cd ../../lib/descr
-         ed - fe << ABC
-/em_cemcom/i
-       prep always
-.
-/CPP_F/;.+2d
-/CPP_F/;.+2d
-w
-q
-ABC
-       )
-       for i in ../mach/vax4/cg ../mach/m68k2/cg ../mach/m68020/ncg
-       do
-       ( cd $i
-         cp tables1.c tables.c
-         cp tables1.h tables.h
-       )
-       done
-       ( cd ../modules/src/malloc
-         if test -f param.h.orig
-         then
-               :
-         else
-               mv param.h param.h.orig
-         fi
-         cp param.h.orig param.h
-         ed - param.h <<ABC
-/STORE/s/define/undef/
-w
-q
-ABC
-       )
-       ( cd ../lang/m2/comp
-         cp SmallPars Parameters
-         cp Makefile makefile
-         ed - makefile <<ABC
-/MALLOC/s/=/=#/
-w
-q
-ABC
-       )
-       ( cd ../mach
-         : machines with word or pointer size not 2
-         for i in em24 em44 m68020 m68k2 m68k4 mantra ns sun2 sun3 vax4 i386
-         do
-         if test -f $i/Action.orig
-         then
-               :
-         else
-               mv $i/Action $i/Action.orig
-         fi
-         cp $i/Action.orig $i/Action
-         ed - $i/Action <<ABC
-/odula-2/;/^end/s/^/!/
-w
-q
-ABC
-         done
-       )
-       ( cd ..
-         if test -f Action.orig
-         then
-               :
-         else
-               mv Action Action.orig
-         fi
-         cp Action.orig Action
-         ed - Action <<ABC
-/Peephole optimizer libraries/;/^end/s/^/!/
-/Bootstrap for code expanders/;/^end/s/^/!/
-/EM interpreter in C/;/^end/s/^/!/
-w
-q
-ABC
-       )
-       ;;
-*)     ( echo "set some installation parameters for big machines"
-         cd ../lang/cem/cemcom
-         cp BigPars Parameters
-         cd ../../m2/comp
-         cp BigPars Parameters
-       )
+sed -e /ACKM/s/'".*"'/'"'$ACM'"'/ -e /BIGMACH/s/'[01]'/$BM/ -e /SYSTEM/s/'^#[  ]*define[       ]*[a-zA-Z_][a-zA-Z0-9_]*'/"#    define $SYS"/ < $FDIR/local.h.src >local.h
+case $BYTE_ORDER in
+XXX)   ;;
+*)     echo '/* Optional definition of BYTE_ORDER: */' >> local.h
+       echo "#define BYTE_ORDER 0x$BYTE_ORDER" >> local.h
        ;;
 esac
 
-: find varargs include file
-: if not present use our own
+echo "Your default machine to compile for is $ACM"
 
-if test -f /usr/include/varargs.h
-then
-       :
-else
-       cp ../include/_tail_cc/varargs.h ../modules/h
-fi
 DISABLE_LANG=
 echo "Installation of the complete ACK takes a long time. Limiting the
 number of languages, runtime libraries, back-ends, and assemblers to be
@@ -442,227 +149,47 @@ answer no to the next question. Otherwise, answer yes, and you will be
 prompted for details"
 while :
 do
-       echo -n "Do you want to limit the installation in any way? (y/n) "
-       if read YESNO
-       then
-               :
-       else
-               echo "Sorry, got EOF when reading your answer"
-               exit 12
-       fi
-       case X$YESNO in
-       Xj*|Xy*)
-               break
-               ;;
-       Xn*)    exit 0
-               ;;
-       *)      echo "I do not understand your answer ($YESNO). Try again."
-               ;;
-       esac
-done
-for i in Modula-2 Pascal Occam Basic
-do
-    while :
-    do
-       echo -n "Do you want to install $i? (y/n) "
-       if read YESNO
-       then
-               :
-       else
-               echo "Sorry, got EOF when reading your answer"
-               exit 12
-       fi
-       case X$YESNO in
-       Xj*|Xy*|X)
-               break
-               ;;
-       Xn*)    DISABLE_LANG=$DISABLE_LANG" $i"
-               break
-               ;;
-       *)      echo "I do not understand your answer ($YESNO). Try again."
-               ;;
+       ./echo -n "Do you want to limit the installation in any way? (y/n) [$LIMIT] "
+       . $FDIR/get_answer
+       case $ANS in
+       '')     ANS="$LIMIT";;
        esac
-    done
-done
-DISABLE_SUP=
-set i86 xenix3 minix i386 6500 6800 6805 6809 i80 em22 em24 em44 m68k2 pmds minixST m68k4 pmds4 sun2 mantra m68020 sun3 ns pdp s2650 vax4 z80 z8000
-while test $# != 0
-do
-    while :
-    do
-       case $1 in
-       i86)    echo "not installing i86 will disable installation of xenix3 and minix."
-               ;;
-       m68k2)  echo "not installing m68k2 will disable installation of pmds, minixST,
-m68k4, pmds4, sun2, and mantra."
-               ;;
-       m68k4)  echo "not installing m68k4 will disable installation of pmds4, sun2, and mantra."
-               ;;
-       m68020) echo "not installing m68020 will disable installation of sun3."
-               ;;
-       esac
-       echo -n "Do you want to install the $1 support? (y/n) "
-       if read YESNO
-       then
-               :
-       else
-               echo "Sorry, got EOF when reading your answer"
-               exit 12
-       fi
-       case X$YESNO in
-       Xj*|Xy*|X)
+       case X$ANS in
+       Xj*|Xy*)
+               LIMIT=y
+               . $FDIR/limit_enquire
                break
                ;;
-       Xn*)    DISABLE_SUP=$DISABLE_SUP" $1"
-               case $1 in
-               i86)
-                       shift
-                       DISABLE_SUP=$DISABLE_SUP" $1"
-                       shift
-                       DISABLE_SUP=$DISABLE_SUP" $1"
-                       ;;
-               m68k2)
-                       shift
-                       DISABLE_SUP=$DISABLE_SUP" $1"
-                       shift
-                       DISABLE_SUP=$DISABLE_SUP" $1"
-                       shift
-                       DISABLE_SUP=$DISABLE_SUP" $1"
-                       shift
-                       DISABLE_SUP=$DISABLE_SUP" $1"
-                       shift
-                       DISABLE_SUP=$DISABLE_SUP" $1"
-                       shift
-                       DISABLE_SUP=$DISABLE_SUP" $1"
-                       ;;
-               m68k4)
-                       shift
-                       DISABLE_SUP=$DISABLE_SUP" $1"
-                       shift
-                       DISABLE_SUP=$DISABLE_SUP" $1"
-                       shift
-                       DISABLE_SUP=$DISABLE_SUP" $1"
-                       ;;
-               m68020)
-                       shift
-                       DISABLE_SUP=$DISABLE_SUP" $1"
-                       ;;
-               esac
+       Xn*)    . $FDIR/get_sysvax
+               LIMIT=n
+               DO_MACHINE_INDEP=y
                break
                ;;
-       *)      echo "I do not understand your answer ($YESNO). Try again."
+       *)      echo "I do not understand your answer ($ANS). Try again."
                ;;
        esac
-    done
-    shift
 done
-for i in $DISABLE_LANG
-do
-       echo "disabling installation of $i"
-       if test -f ../Action.orig
-       then
-               :
-       else
-               mv ../Action ../Action.orig
-               cp ../Action.orig ../Action
-       fi
-       ed - ../Action <<EOF
-/^name "$i/;/^end/s/^/!/
-w
-q
-EOF
-       case $i in
-       Modula-2)
-               ed - ../Action <<EOF
-/^name "$i definition/;/^end/s/^/!/
-/^name "$i makefile/;/^end/s/^/!/
-w
-q
-EOF
-               ;;
-       esac
-       case $i in
-       Modula-2)
-               lib=libm2
-               ;;
-       Pascal)
-               lib=libpc
-               ;;
-       Basic)
-               lib=libbc
-               ;;
-       Occam)
-               lib=liboc
-               ;;
-       esac
-       ( cd ../mach
-         for j in */$lib
-         do
-           ( cd $j/..
-             if test -f Action.orig
-             then
-               :
-             else
-               mv Action Action.orig
-               cp Action.orig Action
-             fi
-             ed - Action <<EOF
-/^name.*$i/;/^end/s/^/!/
-w
-q
-EOF
-           )
-         done
-       )
-done
-DISABLE_INT=0
-for i in $DISABLE_SUP
-do
-       echo "disabling installation of $i"
-       if test -f ../Action.orig
-       then
-               :
-       else
-               mv ../Action ../Action.orig
-               cp ../Action.orig ../Action
-       fi
-       ed - ../Action <<EOF
-/^dir .*$i\$/;?^name?;/^end/s/^/!/
-w
-q
-EOF
-       case $i in
-       m68k2|m68k4)
-               DISABLE_INT=1
-               ;;
-       mantra)
-               if test $SYSNAME = m68_sysV_0
-               then
-                       DISABLE_INT=1
-               fi
-               ;;
-       sun2)
-               case $SYSNAME in
-               sun2|sun3)
-                       DISABLE_INT=1
-                       ;;
-               esac
-               ;;
-       pmds4)
-               case $SYSNAME in
-               pmds*)
-                       DISABLE_INT=1
-                       ;;
-               esac
-               ;;
-       esac
-done
-if test $DISABLE_INT = 1
-then
-       ed - ../Action <<EOF
-/68000 interpreters/;/^end/s/^/!/
-w
-q
-EOF
-fi
+
+. $FDIR/get_makepars
+
+echo TARGET_HOME=\"$TARGET_HOME\" > macros
+echo UTIL_HOME=\"$UTIL_HOME\" >> macros
+echo SRC_HOME=\"$SRC_HOME\" >> macros
+echo SYSNAME=\"$SYSNAME\" >> macros
+echo ACM=\"$ACM\" >> macros
+echo CURRENT=\"$CURRENT\" >> macros
+echo SYS=\"$SYS\" >> macros
+echo LIMIT=\"$LIMIT\" >> macros
+echo CONFIG=\"$CONFIG\" >> macros
+echo DISABLE_LANG=\"$DISABLE_LANG\" >> macros
+echo DISABLE_SUP=\"$DISABLE_SUP\" >> macros
+echo DO_MACHINE_INDEP=\"$DO_MACHINE_INDEP\" >> macros
+echo MACH_LIST=\"$MACH_LIST\" >> macros
+echo SYSVAX=\"$SYSVAX\" >> macros
+echo WS=\"$WS\" >> macros
+echo PS=\"$PS\" >> macros
+
+cat macros $FDIR/install_tail > INSTALL
+chmod +x INSTALL
+
 exit 0
diff --git a/first/get_answer b/first/get_answer
new file mode 100755 (executable)
index 0000000..b610e24
--- /dev/null
@@ -0,0 +1,5 @@
+if read ANS
+then   echo
+else   echo "Sorry, got EOF when reading your answer"
+       exit 1
+fi
diff --git a/first/get_makepars b/first/get_makepars
new file mode 100755 (executable)
index 0000000..980560f
--- /dev/null
@@ -0,0 +1,93 @@
+know_target=0
+case $SYSNAME in
+vax*|i386|sun*|sparc|m68_sysV_0|m68020|mantra|pmds4|m68k4)
+       WS=4 ; PS=4
+       know_target=1
+       ;;
+m68_unisoft|m68k2|minixST|pmds)
+       WS=2 ; PS=4
+       know_target=1
+       ;;
+i86|minix|xenix3)
+       WS=2 ; PS=2
+       know_target=1
+       ;;
+*)     if [ $TARGET_HOME = $UTIL_HOME ]
+       then
+               : We can find out ourselves what the word-size and
+               : the pointer-size of the target machine is.
+               cat > ws.c <<'EOF'
+#include <stdio.h>
+main()
+{
+       printf("WS=%d ; PS=%d\n", sizeof(int), sizeof(char *));
+       exit(0);
+}
+EOF
+               cc ws.c 2>/dev/null
+               a.out > t$$
+               . t$$
+               rm -f t$$ a.out ws.[co]
+       else
+               : we will have to ask installer.
+               ./echo -n "Please give the word-size of the target-machine (sizeof(int)) in bytes: [$WS] "
+               . $FDIR/get_answer
+               case $ANS in
+               '')     ANS="$WS";;
+               esac
+               WS="$ANS"
+               ./echo -n "Please give the pointer-size of the target-machine (sizeof(char *)) in bytes: [$PS] "
+               . $FDIR/get_answer
+               case $ANS in
+               '')     ANS="$PS";;
+               esac
+               PS="$ANS"
+       fi
+       ;;
+esac
+
+echo "# Paths:
+SRC_HOME = $SRC_HOME
+TARGET_HOME = $TARGET_HOME
+UTIL_HOME = $UTIL_HOME
+
+# Machine independent part created?
+DO_MACHINE_INDEP = $DO_MACHINE_INDEP
+" > make_macros
+
+if [ $TARGET_HOME = $UTIL_HOME ]
+then   
+       sed "s/^COPTIONS.*\$/COPTIONS=-O -D_EM_WSIZE=$WS -D_EM_PSIZE=$PS/" < $FDIR/target_comp >> make_macros
+       if [ -f /bin/arch ]
+       then
+               case `/bin/arch` in
+               sun3|sun4)
+                       ed - make_macros <<'EOF'
+/cc-and-mkdep.sun/s/^..//
+w
+q
+EOF
+                       ;;
+               esac
+       fi
+       cat $FDIR/util_comp >> make_macros
+else
+       case $knowtarget in
+       1)      sed -e "s/^COPTIONS.*\$/COPTIONS=-O -D_EM_WSIZE=$WS -D_EM_PSIZE=$PS/" -e "/cc-and-mkdep.ack/s/^..//" -e "s/^CC=cc/CC=acc -m$ACM" -e "s/^# AR=aal/AR=aal/" -e "s/^# RANLIB=:/RANLIB=:/" < $FDIR/target_comp >> make_macros
+               ;;
+       *)      sed "s/^COPTIONS.*\$/COPTIONS=-O -D_EM_WSIZE=$WS -D_EM_PSIZE=$PS/" < $FDIR/target_comp >> make_macros
+               ;;
+       esac
+       sed "s/^#U/U/" < $FDIR/util_comp >> make_macros
+fi
+
+cat $FDIR/lint_params >> make_macros
+
+echo "A file called 'make_macros' has been created. This file defines some
+'make' variables that parameterize all Makefiles in ACK. You may want
+to check it before attempting to actually install ACK."
+case $knowtarget in
+0)     echo "In fact, this installation script does not know much about
+your target machine, so expect some things to be wrong"
+       ;;
+esac
diff --git a/first/get_sys b/first/get_sys
new file mode 100755 (executable)
index 0000000..f8b002a
--- /dev/null
@@ -0,0 +1,154 @@
+$FDIR/rm -f em_path.h
+echo "You will now be asked for the root directory of the ACK sources.
+This directory will not be changed by the installation process.
+"
+while :
+do
+       ./echo -n "Please give the root of the ACK source tree,
+an absolute path: [$SRC_HOME] "
+       . $FDIR/get_answer
+       case $ANS in
+       '')     ANS="$SRC_HOME" ;;
+       esac
+       SRC_HOME="$ANS"
+       case $SRC_HOME in
+       /*)     break;
+               ;;
+       *)      echo "$SRC_HOME is not an absolute path; try again"
+               ;;
+       esac
+done
+echo "You will now be asked for a configuration directory. This is
+the directory in which the compilations will take place. The tree that
+resides in it will have the same structure as the ACK source tree, but
+the directories will usually only contain Makefiles and .o files.
+"
+while :
+do
+       ./echo -n "Please give the root of the configuration tree,
+an absolute path: [$CONFIG] "
+       . $FDIR/get_answer
+       case $ANS in
+       '')     ANS="$CONFIG";;
+       esac
+       CONFIG="$ANS"
+       case $CONFIG in
+       /*)     break;
+               ;;
+       *)      echo "$CONFIG is not an absolute path; try again"
+               ;;
+       esac
+done
+echo "You will now be asked for the root directory of the ACK binaries. After
+installation, this directory will have subdirectories bin, lib, lib.bin,
+man, h, config, include, modules, doc.
+Four of these directories will contain stuff that depends on the machine
+for which the ACK binaries are made: bin, modules, config, and lib.bin. The
+other sub-directories (lib, man, h, include and doc) will contain
+machine-independent stuff.
+This information may be useful if you want to use ACK on different platforms
+and you have a shared file system. See the installation manual.
+"
+while :
+do
+       ./echo -n "Please give the root of the ACK binaries,
+an absolute path: [$TARGET_HOME] "
+       . $FDIR/get_answer
+       case $ANS in
+       '')     ANS="$TARGET_HOME";;
+       esac
+       TARGET_HOME="$ANS"
+       case $TARGET_HOME in
+       /*)     break;
+               ;;
+       *)      echo "$TARGET_HOME is not an absolute path; try again"
+               ;;
+       esac
+done
+sed -e "/^#define[     ]*EM_DIR/s@\".*\"@\"$TARGET_HOME\"@" <$FDIR/em_path.h.src >em_path.h
+
+echo "You will now be asked for the type of the system that you want
+ACK binaries produced for. This is not neccessarily the system you
+run this program on. In this case, if you have not done so already,
+you will have to install ACK on the current machine first.
+"
+echo "Give me the type of the system, the current choice is:
+vax_bsd4_1a    VAX11 with BSD4.1a
+vax_bsd4_2     VAX11 with BSD4.2
+vax_sysV_2     VAX11 with System V.2
+i386           Intel 80386 system running Xenix System V
+sun3           Sun 3 M68020 workstation 
+sun2           Sun 2 M68000 workstation
+m68_sysV_0     Motorola 68000 with Uniplus System V.0 Unix
+m68020         Motorola M68020 VME131 running Unix System V/68 R2V2.1
+sparc          SUN SPARC workstation
+ANY            Neither of the above
+"
+./echo -n "system type: [$SYSNAME] "
+. $FDIR/get_answer
+case $ANS in
+'')    ANS="$SYSNAME";;
+esac
+SYSNAME="$ANS"
+
+while :
+do
+./echo -n "Is this the system you are running on? (y/n) [$CURRENT] "
+. $FDIR/get_answer
+case $ANS in
+'')    ANS="$CURRENT";;
+esac
+case $ANS in
+j*|y*) UTIL_HOME=$TARGET_HOME
+       CURRENT=y
+       break
+       ;;
+n*)    CURRENT=n
+       echo "You will now be asked for the root directory of ACK on the current machine.
+This tree will not be changed by the installation process.
+"
+       while :
+       do
+               ./echo -n "Please give the root of a runnable ACK tree,
+an absolute path: [$UTIL_HOME] "
+               . $FDIR/get_answer
+               case $ANS in
+               '')     ANS="$UTIL_HOME" ;;
+               esac
+               UTIL_HOME="$ANS"
+               case $UTIL_HOME in
+               /*)     break;
+                       ;;
+               *)      echo "$UTIL_HOME is not an absolute path; try again"
+                       ;;
+               esac
+       done
+       break
+       ;;
+*)     echo "I do not understand your answer ($ANS). Try again."
+       ;;
+esac
+done
+
+while :
+do
+echo "The system to install ACK for is $SYSNAME,
+the root of the ACK source tree is $SRC_HOME,
+the root of the configuration tree is $CONFIG,
+the root of the ACK binary tree to be created is $TARGET_HOME,
+and the root of a runnable ACK binary tree is $UTIL_HOME.
+If the machine to compile ACK for is the current machine, the last two names
+may be identical."
+./echo -n "Are you satisfied with all this? (y/n) "
+. $FDIR/get_answer
+case X$ANS in
+Xj*|Xy*|X)     break
+       ;;
+Xn*)   echo Ok, I will give you another chance....
+       . get_sys
+       break
+       ;;
+*)     echo "I do not understand your answer ($ANS). Try again."
+       ;;
+esac
+done
diff --git a/first/get_sysvax b/first/get_sysvax
new file mode 100755 (executable)
index 0000000..d56df36
--- /dev/null
@@ -0,0 +1,21 @@
+while :
+do
+       ./echo -n "Which system-call library do you want to install for the VAX?
+You can choose between
+       libbsd4_1a      for Berkeley Unix 4.1
+       libbsd4_2       for Berkeley Unix 4.2 or newer, or Ultrix
+       libsysV_2       for Unix System V
+Your choice: [$SYSVAX] "
+       . $FDIR/get_answer
+       case $ANS in
+       '')     ANS="$SYSVAX";;
+       esac
+       SYSVAX="$ANS"
+       case $SYSVAX in
+       libbsd4_1a|libbsd4_2|libsysV_2)
+               break
+               ;;
+       *)      echo "I do not understand your answer ($SYSVAX). Try again"
+               ;;
+       esac
+done
diff --git a/first/install_tail b/first/install_tail
new file mode 100644 (file)
index 0000000..4eba3bd
--- /dev/null
@@ -0,0 +1,73 @@
+set -e
+
+PATH=::$SRC_HOME/first:$UTIL_HOME/bin:/bin:/usr/bin:/usr/ucb
+export PATH
+
+mk_config $CONFIG $SRC_HOME `pwd`/make_macros
+
+mk_target
+
+limit_impl
+
+case $SYSNAME in
+i386)
+       ed - $TARGET_HOME/lib/descr/fe << ABC
+1,$s/-D{NAME}/-D{NAME} -DNO_PROTOTYPE/
+w
+q
+ABC
+       ;;
+esac
+
+: find varargs include file
+: if not present use our own
+
+if test -f /usr/include/varargs.h
+then
+       :
+else
+       cp $SRC_HOME/include/_tail_cc/varargs.h $TARGET_HOME/modules/h
+fi
+
+case X$SYSVAX in
+Xvax_sysV_2)
+       ed - $TARGET_HOME/lib/vax4/descr << 'ABC'
+/CPP_F/s/$/ -D__USG/
+w
+q
+ABC
+       ed - $CONFIG/mach/vax4/Action << 'ABC'
+/libbds4_2/s/libbsd4_2/libsysV_2/
+w
+q
+ABC
+       ( cd $CONFIG/mach/vax4
+         for i in libcc libcc.ansi
+         do
+               ed - $i/Makefile << 'ABC'
+/BFS/s/BFS/UFS/
+w
+q
+ABC
+         done
+       )
+       ;;
+Xvax_bsd4_2)
+       ed - $TARGET_HOME/lib/vax4/descr << 'ABC'
+/CPP_F/s/$/ -D__BSD4_2/
+w
+q
+ABC
+       ;;
+Xvax_bsd4_1a)
+       ed - $CONFIG/mach/vax4/Action << 'ABC'
+/libbds4_2/s/libbsd4_2/libbsd4_1a/
+w
+q
+ABC
+       ;;
+esac
+
+: and finally installing ...
+cd $CONFIG
+exec $SRC_HOME/TakeAction
diff --git a/first/limit_enquire b/first/limit_enquire
new file mode 100644 (file)
index 0000000..fca0fae
--- /dev/null
@@ -0,0 +1,123 @@
+while :
+do
+       echo "The libraries will end up in the machine-independent part of the
+ACK binary tree. You may already have them from a previous ACK installation
+on a different machine, in particular if you have an NFS file system.
+Therefore, it may not be neccessary to install them again. As this part
+of the ACK installation takes the most time, you are given the opportunity
+to disable installation of the machine-independent part"
+       ./echo -n "Do you want to install the machine-independent part? (y/n) [$DO_MACHINE_INDEP] "
+       . $FDIR/get_answer
+       case $ANS in
+       '')     ANS="$DO_MACHINE_INDEP" ;;
+       esac
+       case $ANS in
+       j*|y*)  DO_MACHINE_INDEP=y
+               break
+               ;;
+       n*)     DO_MACHINE_INDEP=n
+               break
+               ;;
+       *)      ./echo "I do not understand your answer ($ANS). Try again."
+               ;;
+       esac
+done
+for i in Modula-2 Pascal Occam Basic ANSI-C C Fortran
+do
+    while :
+    do
+       ./echo -n "Do you want to install $i? (y/n) "
+       . $FDIR/get_answer
+       case X$ANS in
+       Xj*|Xy*|X)
+               break
+               ;;
+       Xn*)    DISABLE_LANG=$DISABLE_LANG" $i"
+               break
+               ;;
+       *)      ./echo "I do not understand your answer ($ANS). Try again."
+               ;;
+       esac
+    done
+done
+DISABLE_SUP=
+set $MACH_LIST
+while test $# != 0
+do
+    while :
+    do
+       case $1 in
+       i86)    ./echo "not installing i86 will disable installation of xenix3 and minix."
+               ;;
+       m68k2)  ./echo "not installing m68k2 will disable installation of pmds, minixST,
+m68k4, pmds4, sun2, and mantra."
+               ;;
+       m68k4)  ./echo "not installing m68k4 will disable installation of pmds4, sun2, and mantra."
+               ;;
+       m68020) ./echo "not installing m68020 will disable installation of sun3."
+               ;;
+       esac
+       ./echo -n "Do you want to install the $1 support? (y/n) "
+       . $FDIR/get_answer
+       case X$ANS in
+       Xj*|Xy*|X)
+               case $1 in
+               vax4)   case $SYSNAME in
+                       vax_bsd4_1a)    SYSVAX=libbsd4_1a
+                                       ;;
+                       vax_bsd4_2)     SYSVAX=libbsd4_2
+                                       ;;
+                       vax_sysV_2)     SYSVAX=libsysV_2
+                                       ;;
+                       *)              if [ $DO_MACHINE_INDEP = y ]
+                                       then
+                                               . get_sysvax
+                                       fi
+                                       ;;
+                       esac
+               esac
+               break
+               ;;
+       Xn*)    DISABLE_SUP=$DISABLE_SUP" $1"
+               case $1 in
+               i86)
+                       shift
+                       DISABLE_SUP=$DISABLE_SUP" $1"
+                       shift
+                       DISABLE_SUP=$DISABLE_SUP" $1"
+                       ;;
+               m68k2)
+                       shift
+                       DISABLE_SUP=$DISABLE_SUP" $1"
+                       shift
+                       DISABLE_SUP=$DISABLE_SUP" $1"
+                       shift
+                       DISABLE_SUP=$DISABLE_SUP" $1"
+                       shift
+                       DISABLE_SUP=$DISABLE_SUP" $1"
+                       shift
+                       DISABLE_SUP=$DISABLE_SUP" $1"
+                       shift
+                       DISABLE_SUP=$DISABLE_SUP" $1"
+                       ;;
+               m68k4)
+                       shift
+                       DISABLE_SUP=$DISABLE_SUP" $1"
+                       shift
+                       DISABLE_SUP=$DISABLE_SUP" $1"
+                       shift
+                       DISABLE_SUP=$DISABLE_SUP" $1"
+                       ;;
+               m68020)
+                       shift
+                       DISABLE_SUP=$DISABLE_SUP" $1"
+                       ;;
+               esac
+               break
+               ;;
+       *)      ./echo "I do not understand your answer ($ANS). Try again."
+               ;;
+       esac
+    done
+    shift
+done
diff --git a/first/limit_impl b/first/limit_impl
new file mode 100755 (executable)
index 0000000..e31b85f
--- /dev/null
@@ -0,0 +1,164 @@
+. macros
+for i in $DISABLE_LANG
+do
+       ed - $CONFIG/Action <<EOF
+/^name "$i/;/^end/s/^/!/
+w
+q
+EOF
+       case $i in
+       Modula-2)
+               ed - $CONFIG/Action <<EOF
+/^name "$i definition/;/^end/s/^/!/
+/^name "$i makefile/;/^end/s/^/!/
+w
+q
+EOF
+               ;;
+       ANSI-C) : install compiler anyway
+               ed - $CONFIG/Action <<EOF
+/^!name "$i frontend/;/^!end/s/^!//
+w
+q
+EOF
+               ;;
+       C)      : install compiler anyway
+               ed - $CONFIG/Action <<EOF
+/^!name "$i frontend/;/^!end/s/^!//
+w
+q
+EOF
+               ;;
+       esac
+done
+for i in Modula-2 Pascal Basic Occam ANSI-C C Fortran
+do
+       if [ $DO_MACHINE_INDEP = n ]
+       then
+               continue
+       fi
+       for j in $DISABLE_LANG
+       do
+               case $i in
+               $j)     i=X
+                       break
+                       ;;
+               esac
+       done
+       case $i in
+       X)      continue
+               ;;
+       Modula-2)
+               lib=libm2
+               ;;
+       Pascal)
+               lib=libpc
+               ;;
+       Basic)
+               lib=libbc
+               ;;
+       Occam)
+               lib=liboc
+               ;;
+       ANSI-C)
+               lib=libcc.ansi
+               ;;
+       C)
+               lib=libcc
+               ;;
+       Fortran)
+               lib=libf77
+               ;;
+       esac
+       ( cd $CONFIG/mach
+         for j in $MACH_LIST
+         do
+               case $j in
+               6800|6805|6809|s2650)   continue
+                                       ;;
+               esac
+               : do not install fortran for 2-byte integer machines
+               case $i in
+               Fortran)        case $j in
+                               em2*|i8*|m68k2|minix*|pdp|pmds|xenix3|z80*)
+                                       continue
+                                       ;;
+                               esac
+                               ;;
+               esac
+               ( cd $j
+                 cat >> Action <<EOF
+name "$j $i libraries"
+dir $lib
+end
+EOF
+               )
+         done
+       )
+done
+DISABLE_INT=0
+for i in $DISABLE_SUP
+do
+       ed - $CONFIG/Action <<EOF
+/^dir .*$i\$/;?^name?;/^end/s/^/!/
+w
+q
+EOF
+       case $i in
+       m68k2|m68k4)
+               DISABLE_INT=1
+               ;;
+       mantra)
+               if test $SYSNAME = m68_sysV_0
+               then
+                       DISABLE_INT=1
+               fi
+               ;;
+       sun2)
+               case $SYSNAME in
+               sun2|sun3)
+                       DISABLE_INT=1
+                       ;;
+               esac
+               ;;
+       pmds4)
+               case $SYSNAME in
+               pmds*)
+                       DISABLE_INT=1
+                       ;;
+               esac
+               ;;
+       esac
+done
+case $SYSNAME in
+m68*|sun2|sun3|pmds*)
+       ;;
+*)     DISABLE_INT=1
+       ;;
+esac
+if test $DISABLE_INT = 1
+then
+       ed - $CONFIG/Action <<EOF
+/68000 interpreters/;/^end/s/^/!/
+w
+q
+EOF
+fi
+
+if [ DO_MACHINE_INDEP = n ]
+then
+       for i in $CONFIG/mach/*/Action
+       do
+               for j in libem libend libfp libdb libsys libmon libbsd4_2 libbsd4_1a libsysV_2
+               do
+                       if grep -s $j $i
+                       then
+                               ed - $i <<EOF
+/$j/;?^name?,/^end/s/^/!/
+w
+q
+EOF
+                       fi
+               done
+       done
+fi
diff --git a/first/lint_params b/first/lint_params
new file mode 100644 (file)
index 0000000..82266fb
--- /dev/null
@@ -0,0 +1,18 @@
+
+# There are two choices for lint here: ACK lint and Unix lint.
+# The current setup is for ACK lint. If you want to use the Unix lint,
+# put '#' signs on the next 4 lines that have ACK in them.
+
+LINT=/usr/bin/lint             # Unix lint
+LINT=$(UTIL_HOME)/bin/lint     # ACK lint
+
+LINTOPTIONS=                   # options always passed to lint
+
+LINTPREF=llib-l                        # prefix of unix lint libraries
+LINTPREF=                      # ACK lint libraries do not have a prefix
+
+LINTSUF=ln                     # suffix of Unix lint libraries
+LINTSUF=llb                    # suffix of ACK lint libraries
+       
+MK_LINT_LIB=lint-lib.unix      # for Unix lint
+MK_LINT_LIB=lint-lib.ack       # for ACK lint
diff --git a/first/mk_config b/first/mk_config
new file mode 100755 (executable)
index 0000000..67e0a02
--- /dev/null
@@ -0,0 +1,147 @@
+: This script creates a configuration tree.
+: Should be called with 3 parameters: the configuration root, the source
+: root, and a file containing the makefile definitions.
+
+set -e
+
+USAGE="Usage: $0 <config_root> <source_root> <macro_file>"
+
+case $# in
+3)     ;;
+*)     echo $USAGE 1>&2
+       exit 1
+       ;;
+esac
+
+CONFIG=$1
+SRC_HOME=$2
+MACROS=$3
+
+if [ -d $SRC_HOME ]
+then :
+else echo "$0: $SRC_HOME is not a directory" 1>&2
+     exit 2
+fi
+
+if [ -f $MACROS ]
+then :
+else echo "$0: $MACROS not found" 1>&2
+     exit 3
+fi
+
+case ${CONFIG}XX${MACROS}XX${SRC_HOME} in
+/*XX/*XX/*)    ;;
+*)     echo "$0: all arguments should be absolute path names" 1>&2
+       exit 4
+       ;;
+esac
+
+create_dir $CONFIG
+
+cd $SRC_HOME
+find . -type d -print > $CONFIG/dir_list
+
+cd $CONFIG
+for i in `cat dir_list`
+do
+       create_dir $i
+       if [ -f $SRC_HOME/$i/proto.make ]
+       then mk_makefile $MACROS $SRC_HOME/$i/proto.make > $i/Makefile
+       fi
+       if [ -f $SRC_HOME/$i/Action ]
+       then
+               cp $SRC_HOME/$i/Action $i/Action
+       fi
+done
+
+cd $SRC_HOME/util/ceg/util
+for i in make_*
+do
+       mk_makefile $MACROS $i > $CONFIG/util/ceg/util/$i
+done
+
+cd $CONFIG
+
+for i in lang/cem/cemcom.ansi lang/cem/cemcom lang/m2/comp
+do
+       cp $SRC_HOME/$i/BigPars $CONFIG/$i/Parameters
+done
+for i in lang/pc/comp lang/cem/cpp.ansi
+do
+       cp $SRC_HOME/$i/Parameters $CONFIG/$i/Parameters
+done
+
+cd $CONFIG/mach
+for i in *
+do
+    if [ -d $i ]
+    then
+       if [ -d $i/as ]
+       then
+               cd $i/as
+               mk_makefile $MACROS $SRC_HOME/mach/proto/as/proto.make | sed -e "/#MACH_DEFINE/,/^MACH/s/=.*/= $i/" > Makefile
+               cd ../..
+       fi
+       if [ -d $i/top ]
+       then
+               cd $i/top
+               mk_makefile $MACROS $SRC_HOME/mach/proto/top/proto.make | sed -e "/#MACH_DEFINE/,/^MACH/s/=.*/= $i/" > Makefile
+               cd ../..
+       fi
+       if [ -d $i/cg ]
+       then
+               cd $i/cg
+               mk_makefile $MACROS $SRC_HOME/mach/proto/cg/proto.make | sed -e "/#MACH_DEFINE/,/^MACH/s/=.*/= $i/" > Makefile
+               cd ../..
+       fi
+       if [ -d $i/ncg ]
+       then
+               cd $i/ncg
+               mk_makefile $MACROS $SRC_HOME/mach/proto/ncg/proto.make | sed -e "/#MACH_DEFINE/,/^MACH/s/=.*/= $i/" > Makefile
+               if [ -f $SRC_HOME/mach/$i/ncg/table_dir ]
+               then
+                       ed - Makefile <<EOF
+/^#TABLE_DEFINE/+1r $SRC_HOME/mach/$i/ncg/table_dir
+w
+q
+EOF
+               fi
+               cd ../..
+       fi
+       for j in libem libend libmon libfp libsys libdb
+       do
+           if [ -d $i/$j ]
+           then
+               cd $i/$j
+               mk_makefile $MACROS $SRC_HOME/mach/proto/libg/proto.$j | sed -e "/#MACH_PARAMS/r $SRC_HOME/mach/$i/mach_params" > Makefile
+               cd ../..
+           fi
+       done
+       for j in libbsd4_1a libbsd4_2 libsysV_2
+       do
+           if [ -d $i/$j ]
+           then
+               cd $i/$j
+               mk_makefile $MACROS $SRC_HOME/mach/proto/libg/proto.libsys | sed -e "/#MACH_PARAMS/r $SRC_HOME/mach/$i/mach_params" -e "s/libsys/$j/g" > Makefile
+               cd ../..
+           fi
+       done
+       for j in libcc libcc.ansi libm2 libpc libbc liboc libf77
+       do
+           create_dir $i/$j
+           cd $i/$j
+           mk_makefile $MACROS $SRC_HOME/mach/proto/libg/proto.$j | sed -e "/#MACH_PARAMS/r $SRC_HOME/mach/$i/mach_params" > Makefile
+           cd ../..
+       done
+       if [ $i = vax4 ]
+       then :
+       elif [ -d $i/libsys ]
+       then :
+       else 
+               create_dir $i/libsys
+               cd $i/libsys
+               mk_makefile $MACROS $SRC_HOME/mach/proto/libg/proto.sysmon | sed -e "/#MACH_PARAMS/r $SRC_HOME/mach/$i/mach_params" > Makefile
+               cd ../..
+       fi
+    fi
+done
diff --git a/first/mk_makefile b/first/mk_makefile
new file mode 100755 (executable)
index 0000000..052eee1
--- /dev/null
@@ -0,0 +1,15 @@
+: '$Header$'
+
+: This shell script inserts the file "make_macros" after a line
+: starting with #PARAMS in "make_proto", and produces the result on
+: standard output.
+
+case $# in
+2)     ;;
+*)     echo "Usage: $0 <make_macros> <make_proto>" 1>&2
+       exit 1
+       ;;
+esac
+
+sed -e "/^#PARAMS/r $1" $2
+exit 0
diff --git a/first/mk_target b/first/mk_target
new file mode 100755 (executable)
index 0000000..38d9f6d
--- /dev/null
@@ -0,0 +1,43 @@
+set -e
+
+. macros
+
+: machine-dependant stuff
+
+create_dir $TARGET_HOME
+create_dir $TARGET_HOME/config
+create_dir $TARGET_HOME/lib.bin
+create_dir $TARGET_HOME/modules
+create_dir $TARGET_HOME/modules/h
+create_dir $TARGET_HOME/modules/man
+create_dir $TARGET_HOME/modules/pkg
+create_dir $TARGET_HOME/modules/lib
+create_dir $TARGET_HOME/bin
+( cd $SRC_HOME/modules/h ; tar chf - . ) | ( cd $TARGET_HOME/modules/h ; tar xf - )
+cp local.h em_path.h $TARGET_HOME/config
+( cd $SRC_HOME/bin ; tar chf - . ) | ( cd $TARGET_HOME/bin ; tar xf - )
+echo "echo $SYSNAME" > $TARGET_HOME/bin/ack_sys
+chmod +x $TARGET_HOME/bin/ack_sys
+
+: machine-independant stuff
+
+if [ $DO_MACHINE_INDEP = n ]
+then
+       exit 0
+fi
+
+create_dir $TARGET_HOME/lib
+create_dir $TARGET_HOME/etc
+create_dir $TARGET_HOME/h
+create_dir $TARGET_HOME/include
+create_dir $TARGET_HOME/doc
+create_dir $TARGET_HOME/man
+
+cp $SRC_HOME/etc/ip_spec.t $TARGET_HOME/etc/ip_spec.t
+( cd $SRC_HOME/lib ; tar chf - . ) | ( cd $TARGET_HOME/lib ; tar xf - )
+( cd $SRC_HOME/include ; tar chf - . ) | ( cd $TARGET_HOME/include ; tar xf - )
+( cd $SRC_HOME/h ; tar chf - . ) | ( cd $TARGET_HOME/h ; tar xf - )
+( cd $SRC_HOME/man ; tar chf - . ) | ( cd $TARGET_HOME/man ; tar xf - )
+( cd $SRC_HOME/doc ; tar chf - . ) | ( cd $TARGET_HOME/doc ; tar xf - )
+
+exit 0
diff --git a/first/target_comp b/first/target_comp
new file mode 100644 (file)
index 0000000..547587a
--- /dev/null
@@ -0,0 +1,23 @@
+# compiler set for target machine
+
+CC=cc                          # compiler to be used for compiling ACK
+
+COPTIONS=-O -D_EM_WSIZE=4 -D_EM_PSIZE=4
+                               # always passed to $(CC) -c.
+
+CC_AND_MKDEP=cc-and-mkdep.all  # when $(CC) is neither ACK or SUN,
+# CC_AND_MKDEP=cc-and-mkdep.ack        # when $(CC) is an ACK-derived C compiler,
+# CC_AND_MKDEP=cc-and-mkdep.sun        # when $(CC) is a SUN C compiler
+
+LDOPTIONS=                     # always passed to $(CC) when linking
+
+SUF=o                          # suffix of files produced with $(CC) -c
+
+AR=ar                          # archiver for Unix format objects
+# AR=aal                       # archiver for ACK .o format objects
+# AR=arch                      # archiver for ACK .s format objects
+
+RANLIB=ranlib                  # when ranlib required
+# RANLIB=:                     # when ranlib not required
+
+LIBSUF=a                       # suffix of object libraries
diff --git a/first/util_comp b/first/util_comp
new file mode 100644 (file)
index 0000000..db13b2f
--- /dev/null
@@ -0,0 +1,23 @@
+
+# compiler set for producing runnable binaries (possibly using $(UTIL_HOME)).
+# This must describe the compiler with which $(UTIL_HOME) has been compiled.
+# If $(TARGET_HOME) is identical to $(UTIL_HOME), which usually will be
+# the case, this part does not have to be changed. Otherwise (when you are
+# cross-compiling ACK), you will have to change this part. Probable
+# replacements are given in comments. Maybe the installation script
+# has already changed them, but they should be checked to be sure.
+
+UCC=$(CC)
+#UCC=cc                                # compiler to be used
+
+UCOPTION=$(COPTIONS)
+#UCOPTIONS=-O                  # always passed to $(UCC) -c.
+
+ULDOPTIONS=$(LDOPTIONS)
+#ULDOPTIONS=                   # always passed to $(UCC) when linking
+
+USUF=$(SUF)
+#USUF=o                                # suffix of files produced with $(UCC) -c
+
+ULIBSUF=$(LIBSUF)
+#ULIBSUF=a                     # suffix of object libraries for $(UCC)