home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2991 / linstall < prev    next >
Encoding:
Text File  |  1991-03-06  |  16.5 KB  |  816 lines

  1. #! /bin/sh
  2. # Installation script for less.
  3. # This script prompts the operator for various information
  4. # and constructs a makefile.
  5.  
  6. echo "This script will build a makefile for less."
  7. echo "If you already have a file called \"makefile\" it will be overwritten,"
  8. echo "as will the file \"defines.h\"."
  9. echo "Press RETURN to continue."
  10. read ans
  11.  
  12. echo "I will ask you some questions about your system."
  13. echo "If you do not know the answer to any question,"
  14. echo "just press RETURN and I will choose a default for you."
  15. echo "Press RETURN now."
  16. read ans
  17.  
  18. ECHO=./vecho
  19. if [ ! -f $ECHO ]
  20. then
  21.     echo "One moment..."
  22.     cc -o $ECHO vecho.c
  23.     echo ""
  24. fi
  25.  
  26. $ECHO "Most Unix systems are derived from either System V"
  27. $ECHO "or Berkeley BSD 4.1, 4.2, 4.3, etc."
  28. $ECHO ""
  29. $ECHO "Is your system closest to:"
  30. $ECHO "  1. System V"
  31. $ECHO "  2. BSD 4.1"
  32. $ECHO "  3. BSD 4.2 or later"
  33. $ECHO "  4. Xenix"
  34. $ECHO "Enter a number, or just RETURN if you don't know: \c"
  35. read ans
  36. xenix=0
  37. case "X$ans" in
  38. X1) sys=sys5; sysname="System V" ;;
  39. X2) sys=bsd; bsd41=1; sysname="BSD 4.1" ;;
  40. X3) sys=bsd; bsd41=0; sysname="BSD 4.2" ;;
  41. X4) sys=sys5; xenix=1; sysname="Xenix" ;;
  42. *) sys=unknown ;;
  43. esac
  44. $ECHO ""
  45.  
  46. DATE=`date`
  47. cat >makefile <<EOF
  48. # Makefile for "less"
  49. # Generated $DATE by $0.
  50. EOF
  51.  
  52. cat >>makefile <<"EOF"
  53. #
  54. # Invoked as:
  55. #    make all
  56. #   or    make install
  57. # Plain "make" is equivalent to "make all".
  58. #
  59. # If you add or delete functions, remake funcs.h by doing:
  60. #    make newfuncs
  61. # This depends on the coding convention of function headers looking like:
  62. #    " \t public <function-type> \n <function-name> ( ... ) "
  63. #
  64. # Also provided:
  65. #    make lint    # Runs "lint" on all the sources.
  66. #    make clean    # Removes "less" and the .o files.
  67. #    make clobber    # Pretty much the same as make "clean".
  68.  
  69. SHELL = /bin/sh
  70.  
  71. EOF
  72.  
  73. cat >defines.h <<EOF
  74. /* Definition file for less */
  75. /* Generated $DATE by $0. */
  76.  
  77. EOF
  78.  
  79. cat >>defines.h <<EOF
  80. /*
  81.  * Define XENIX if running under XENIX 3.0.
  82.  */
  83. #define    XENIX        $xenix
  84.  
  85. EOF
  86. $ECHO ""
  87.  
  88.  
  89.  
  90. if [ "X$sys" = "Xunknown" ]
  91. then
  92.     alldefault=0
  93. else
  94.     def=yes
  95.     alldefault=1
  96.     $ECHO "Do you want to use ALL the defaults for $sysname?"
  97.     $ECHO "  Enter \"yes\" if you have a STANDARD $sysname."
  98.     $ECHO "  Enter \"no\" if you want to change any of the defaults. [$def] \c"
  99.     read ans
  100.     case "X$ans" in
  101.     X[yY]*) alldefault=1 ;;
  102.     X[nN]*) alldefault=0 ;;
  103.     esac
  104.     $ECHO ""
  105. fi
  106.  
  107. if [ $alldefault = 0 ]
  108. then
  109.     alloptional=0
  110. else
  111.     def=yes
  112.     alloptional=1
  113.     $ECHO "Do you want to use all the optional features of less?"
  114.     $ECHO "  Less has several features which you may or may not"
  115.     $ECHO "  wish to include, such as shell escapes."
  116.     $ECHO "  Enter \"yes\" if you want to include ALL the optional features."
  117.     $ECHO "  Enter \"no\" if you want to select individual features. [$def] \c"
  118.     read ans
  119.     case "X$ans" in
  120.     X[yY]*) alloptional=1 ;;
  121.     X[nN]*) alloptional=0 ;;
  122.     esac
  123.     $ECHO ""
  124. fi
  125.  
  126.  
  127.  
  128. def=yes
  129. x=1
  130. if [ $alldefault = 0 ]
  131. then
  132.     $ECHO "Does your C compiler support the \"void\" type? [$def] \c"
  133.     read ans
  134.     case "X$ans" in
  135.     X[yY]*) x=1 ;;
  136.     X[nN]*) x=0 ;;
  137.     esac
  138.     $ECHO ""
  139. fi
  140. cat >>defines.h <<EOF
  141. /*
  142.  * VOID is 1 if your C compiler supports the "void" type,
  143.  * 0 if it does not.
  144.  */
  145. #define    VOID        $x
  146. #if VOID
  147. #define    VOID_POINTER    void *
  148. #else
  149. #define    VOID_POINTER    char *
  150. #endif
  151.  
  152. EOF
  153.  
  154.  
  155.  
  156. def=long
  157. if [ $alldefault = 0 ]
  158. then
  159.     $ECHO "What type is the \"offset\" argument to lseek? [$def] \c"
  160.     read ans
  161.     if [ "X$ans" != "X" ]
  162.     then
  163.         def=$ans
  164.     fi
  165.     $ECHO ""
  166. fi
  167. cat >>defines.h <<EOF
  168. /*
  169.  * offset_t is the type which lseek() returns.
  170.  * It is also the type of lseek()'s second argument.
  171.  */
  172. #define    offset_t    $def
  173.  
  174. EOF
  175.  
  176.  
  177.  
  178.  
  179. def=yes; x=1
  180. if [ $alldefault = 0 ]
  181. then
  182.     $ECHO "Most Unix systems provide the stat() function."
  183.     $ECHO "Does your system have stat()? [$def] \c"
  184.     read ans
  185.     case "X$ans" in
  186.     X[yY]*) x=1 ;;
  187.     X[nN]*) x=0 ;;
  188.     esac
  189.     $ECHO ""
  190. fi
  191. cat >>defines.h <<EOF
  192. /*
  193.  * STAT is 1 if your system has the stat() call.
  194.  */
  195. #define    STAT        $x
  196.  
  197. EOF
  198.  
  199.  
  200.  
  201.  
  202. def=yes; x=1
  203. if [ $alldefault = 0 ]
  204. then
  205.     $ECHO "Most Unix systems provide the perror() function."
  206.     $ECHO "Does your system have perror()? [$def] \c"
  207.     read ans
  208.     case "X$ans" in
  209.     X[yY]*) x=1 ;;
  210.     X[nN]*) x=0 ;;
  211.     esac
  212.     $ECHO ""
  213. fi
  214. cat >>defines.h <<EOF
  215. /*
  216.  * PERROR is 1 if your system has the perror() call.
  217.  * (Actually, if it has sys_errlist, sys_nerr and errno.)
  218.  */
  219. #define    PERROR        $x
  220.  
  221. EOF
  222.  
  223.  
  224.  
  225.  
  226. def=yes; x=1
  227. if [ $alldefault = 0 ]
  228. then
  229.     $ECHO "Most Unix systems provide the time() function."
  230.     $ECHO "Does your system have time()? [$def] \c"
  231.     read ans
  232.     case "X$ans" in
  233.     X[yY]*) x=1 ;;
  234.     X[nN]*) x=0 ;;
  235.     esac
  236.     $ECHO ""
  237. fi
  238. cat >>defines.h <<EOF
  239. /*
  240.  * GET_TIME is 1 if your system has the time() call.
  241.  */
  242. #define    GET_TIME    $x
  243.  
  244. EOF
  245.  
  246. if [ $x = 0 ]
  247. then
  248.     $ECHO "What is the APPROXIMATE performance of your"
  249.     $ECHO "machine, as a percentage of a Vax 11/750?"
  250.     $ECHO "(Enter 100 if your machine is as fast as a Vax,"
  251.     $ECHO " 50 if it is half as fast, 200 if it is twice as fast, etc.)"
  252.     $ECHO "The accuracy of this information is not critical."
  253.     while :
  254.     do
  255.         $ECHO "Percent of Vax 11/750 [100]: \c"
  256.         read ans
  257.         if [ "X$ans" = "X" ]
  258.         then
  259.             ans=100
  260.         fi
  261.         longloop=`expr "$ans" "*" 3`
  262.         if [ $? = 0 ]
  263.         then
  264.             break
  265.         fi
  266.         $ECHO "Enter a number please!"
  267.     done
  268.     $ECHO ""
  269.  
  270.     cat >>defines.h <<EOF
  271. /*
  272.  * LONGLOOP is the number of lines we should process in the line number
  273.  * scan before displaying a warning that it will take a while.
  274.  */
  275. #define    LONGLOOP    ($longloop)
  276. EOF
  277. fi
  278.  
  279.  
  280.  
  281.  
  282. if [ "$sys" = "bsd" ]
  283. then
  284.     def=no; x=0
  285. else
  286.     def=yes; x=1
  287. fi
  288. if [ $alldefault = 0 ]
  289. then
  290.     $ECHO "Most System V systems have termio.h, while most"
  291.     $ECHO "Berkeley-derived systems have sgtty.h."
  292.     $ECHO "Does your system have termio.h? [$def] \c"
  293.     read ans
  294.     case "X$ans" in
  295.     X[yY]*) x=1 ;;
  296.     X[nN]*) x=0 ;;
  297.     esac
  298.     $ECHO ""
  299. fi
  300. cat >>defines.h <<EOF
  301. /*
  302.  * TERMIO is 1 if your system has /usr/include/termio.h.
  303.  * This is normally the case for System 5.
  304.  * If TERMIO is 0 your system must have /usr/include/sgtty.h.
  305.  * This is normally the case for BSD.
  306.  */
  307. #define    TERMIO        $x
  308.  
  309. EOF
  310.  
  311.  
  312.  
  313.  
  314. if [ "$sys" = "bsd" -a "$bsd41" = "0" ]
  315. then
  316.     def=yes; x=1
  317. else
  318.     def=no; x=0
  319. fi
  320. if [ $alldefault = 0 ]
  321. then
  322.     $ECHO "Most BSD 4.2 and 4.3 systems have both _setjmp() and setjmp()."
  323.     $ECHO "Most System V and BSD 4.1 systems have only setjmp()."
  324.     $ECHO "Does your system have both _setjmp() and setjmp()? [$def] \c"
  325.     read ans
  326.     case "X$ans" in
  327.     X[yY]*) x=1 ;;
  328.     X[nN]*) x=0 ;;
  329.     esac
  330.     $ECHO ""
  331. fi
  332. cat >>defines.h <<EOF
  333. /*
  334.  * HAS__SETJMP is 1 if your system has the _setjmp() call.
  335.  * This is normally the case only for BSD 4.2 and up,
  336.  * not for BSD 4.1 or System 5.
  337.  */
  338. #define    HAS__SETJMP    $x
  339.  
  340. EOF
  341.  
  342.  
  343.  
  344.  
  345. if [ "$sys" = "bsd" -a "$bsd41" = "0" ]
  346. then
  347.     def=yes; x=1
  348. else
  349.     def=no; x=0
  350. fi
  351. if [ $alldefault = 0 ]
  352. then
  353.     $ECHO "Most BSD 4.2 and 4.3 systems have the sigsetmask() call."
  354.     $ECHO "Most System V and BSD 4.1 systems do not."
  355.     $ECHO "Does your system have sigsetmask()? [$def] \c"
  356.     read ans
  357.     case "X$ans" in
  358.     X[yY]*) x=1 ;;
  359.     X[nN]*) x=0 ;;
  360.     esac
  361.     $ECHO ""
  362. fi
  363. cat >>defines.h <<EOF
  364. /*
  365.  * SIGSETMASK is 1 if your system has the sigsetmask() call.
  366.  * This is normally the case only for BSD 4.2,
  367.  * not for BSD 4.1 or System 5.
  368.  */
  369. #define    SIGSETMASK    $x
  370.  
  371. EOF
  372.  
  373.  
  374.  
  375. if [ "$sys" = "bsd" ]
  376. then
  377.     def=2; REGCMP=0;RECOMP=1
  378. else
  379.     def=1; REGCMP=1;RECOMP=0
  380. fi
  381. if [ $alldefault = 0 ]
  382. then
  383.     $ECHO "Most System V systems have the regcmp() function."
  384.     $ECHO "Most Berkeley-derived systems have the re_comp() function."
  385.     $ECHO "Does your system have:"
  386.     $ECHO "  1. regcmp"
  387.     $ECHO "  2. re_comp"
  388.     $ECHO "  3. neither   [$def] \c"
  389.     read ans
  390.     case "X$ans" in
  391.     X1) REGCMP=1;RECOMP=0 ;;
  392.     X2) REGCMP=0;RECOMP=1 ;;
  393.     X3) REGCMP=0;RECOMP=0 ;;
  394.     esac
  395.     $ECHO ""
  396. fi
  397. cat >>defines.h <<EOF
  398. /*
  399.  * REGCMP is 1 if your system has the regcmp() function.
  400.  * This is normally the case for System 5.
  401.  * RECOMP is 1 if your system has the re_comp() function.
  402.  * This is normally the case for BSD.
  403.  * If neither is 1, pattern matching is supported, but without metacharacters.
  404.  */
  405. #define    REGCMP        $REGCMP
  406. #define    RECOMP        $RECOMP
  407.  
  408. EOF
  409.  
  410.  
  411.  
  412.  
  413. def=yes
  414. x=1
  415. if [ $alloptional = 0 ]
  416. then
  417.     $ECHO "Do you wish to allow shell escapes? [$def] \c"
  418.     read ans
  419.     case "X$ans" in
  420.     X[yY]*) x=1 ;;
  421.     X[nN]*) x=0 ;;
  422.     esac
  423.     $ECHO ""
  424. fi
  425. cat >>defines.h <<EOF
  426. /*
  427.  * SHELL_ESCAPE is 1 if you wish to allow shell escapes.
  428.  * (This is possible only if your system supplies the system() function.)
  429.  */
  430. #define    SHELL_ESCAPE    $x
  431.  
  432. EOF
  433.  
  434.  
  435.  
  436. def=yes
  437. x=1
  438. edname="vi"
  439. if [ $alloptional = 0 ]
  440. then
  441.     $ECHO "Do you wish to allow editor escapes? [$def] \c"
  442.     read ans
  443.     case "X$ans" in
  444.     X[nN]*) x=0; edname="" ;;
  445.     X[yY]*) x=1
  446.         $ECHO "What is the pathname of the default editor? [$edname] \c"
  447.         read ans 
  448.         if [ "x$ans" != "x" ]
  449.         then
  450.             edname=$ans
  451.         fi
  452.         ;;
  453.     esac
  454.     $ECHO ""
  455. fi
  456. cat >>defines.h <<EOF
  457. /*
  458.  * EDITOR is 1 if you wish to allow editor invocation (the "v" command).
  459.  * (This is possible only if your system supplies the system() function.)
  460.  * EDIT_PGM is the name of the (default) editor to be invoked.
  461.  */
  462. #define    EDITOR        $x
  463. #define    EDIT_PGM    "$edname"
  464.  
  465. EOF
  466.  
  467.  
  468.  
  469.  
  470. def=yes
  471. x=1
  472. if [ $alloptional = 0 ]
  473. then
  474.     $ECHO "Do you wish to support \"tag\" files? [$def] \c"
  475.     read ans
  476.     case "X$ans" in
  477.     X[yY]*) x=1 ;;
  478.     X[nN]*) x=0 ;;
  479.     esac
  480.     $ECHO ""
  481. fi
  482. cat >>defines.h <<EOF
  483. /*
  484.  * TAGS is 1 if you wish to support tag files.
  485.  */
  486. #define    TAGS        $x
  487.  
  488. EOF
  489.  
  490.  
  491.  
  492. def=yes
  493. x=1
  494. if [ $alloptional = 0 ]
  495. then
  496.     $ECHO "Do you wish to allow user-defined key definitions? [$def] \c"
  497.     read ans
  498.     case "X$ans" in
  499.     X[yY]*) x=1 ;;
  500.     X[nN]*) x=0 ;;
  501.     esac
  502.     $ECHO ""
  503. fi
  504. USERFILE=$x
  505. cat >>defines.h <<EOF
  506. /*
  507.  * USERFILE is 1 if you wish to allow a .less file to specify 
  508.  * user-defined key bindings.
  509.  */
  510. #define    USERFILE    $x
  511.  
  512. EOF
  513.  
  514.  
  515.  
  516. def=yes
  517. x=1
  518. if [ $alldefault = 0 ]
  519. then
  520.     $ECHO "If your system provides the popen() function and"
  521.     $ECHO "the \"echo\" shell command, you may allow shell metacharacters" 
  522.     $ECHO "to be expanded in filenames."
  523.     $ECHO "Do you wish to allow shell metacharacters in filenames? [$def] \c"
  524.     read ans
  525.     case "X$ans" in
  526.     X[yY]*) x=1 ;;
  527.     X[nN]*) x=0 ;;
  528.     esac
  529.     $ECHO ""
  530. fi
  531. cat >>defines.h <<EOF
  532. /*
  533.  * GLOB is 1 if you wish to have shell metacharacters expanded in filenames.
  534.  * This will generally work if your system provides the "popen" function
  535.  * and the "echo" shell command.
  536.  */
  537. #define    GLOB        $x
  538.  
  539. /*
  540.  * PIPEC is 1 if you wish to have the "|" command
  541.  * which allows the user to pipe data into a shell command.
  542.  */
  543. #define    PIPEC        $x
  544.  
  545. EOF
  546.  
  547.  
  548.  
  549. def=yes
  550. x=1
  551. if [ $alloptional = 0 ]
  552. then
  553.     $ECHO "Do you wish to allow log files (-l option)? [$def] \c"
  554.     read ans
  555.     case "X$ans" in
  556.     X[yY]*) x=1 ;;
  557.     X[nN]*) x=0 ;;
  558.     esac
  559.     $ECHO ""
  560. fi
  561. cat >>defines.h <<EOF
  562. /*
  563.  * LOGFILE is 1 if you wish to allow the -l option (to create log files).
  564.  */
  565. #define    LOGFILE        $x
  566.  
  567. EOF
  568.  
  569. cat >>defines.h <<EOF
  570. /*
  571.  * ONLY_RETURN is 1 if you want RETURN to be the only input which
  572.  * will continue past an error message.
  573.  * Otherwise, any key will continue past an error message.
  574.  */
  575. #define    ONLY_RETURN    0
  576.  
  577. EOF
  578.  
  579. cat >>makefile <<EOF
  580.  
  581. ##########################################################################
  582. # Compilation environment.
  583. ##########################################################################
  584.  
  585. EOF
  586.  
  587.  
  588.  
  589. if [ "$xenix" = "1" ]
  590. then
  591.     LIBS="-ltermlib"
  592. elif [ "$sys" = "bsd" ]
  593. then
  594.     LIBS="-ltermcap"
  595. else
  596.     LIBS="-lcurses -ltermcap -lPW"
  597. fi
  598. if [ $alldefault = 0 ]
  599. then
  600.     $ECHO "To build \"less\", you must link with libraries supplied by your system."
  601.     $ECHO "(If this needs to be changed later, edit the makefile"
  602.     $ECHO "and change the definition of LIBS.)"
  603.     $ECHO "What libraries should be used [$LIBS] \c"
  604.     read ans
  605.     if [ "X$ans" != "X" ]
  606.     then
  607.         LIBS="$ans"
  608.     fi
  609.     $ECHO ""
  610. fi
  611. cat >>makefile <<EOF
  612. # LIBS is the list of libraries needed.
  613. LIBS = $LIBS
  614.  
  615. EOF
  616.  
  617.  
  618.  
  619. INSTALL_LESS="/usr/local/bin/less"
  620. INSTALL_KEY="/usr/local/bin/lesskey"
  621. INSTALL_HELP="/usr/local/bin/less.hlp"
  622. INSTALL_LESSMAN="/usr/man/man1/less.1"
  623. INSTALL_KEYMAN="/usr/man/man1/lesskey.1"
  624. LESS_MANUAL="less.nro"
  625. KEY_MANUAL="lesskey.nro"
  626. if [ $alldefault = 0 ]
  627. then
  628.     $ECHO "What is the name of the \"public\" (installed) version of less?"
  629.     $ECHO " [$INSTALL_LESS] \c"
  630.     read ans
  631.     if [ "X$ans" != "X" ]
  632.     then
  633.         INSTALL_LESS="$ans"
  634.     fi
  635.     $ECHO "What is the name of the \"public\" (installed) version of lesskey?"
  636.     $ECHO " [$INSTALL_KEY] \c"
  637.     read ans
  638.     if [ "X$ans" != "X" ]
  639.     then
  640.         INSTALL_KEY="$ans"
  641.     fi
  642.     $ECHO "What is the name of the \"public\" (installed) version of the help file?"
  643.     $ECHO " [$INSTALL_HELP] \c"
  644.     read ans
  645.     if [ "X$ans" != "X" ]
  646.     then
  647.         INSTALL_HELP="$ans"
  648.     fi
  649.     $ECHO "What is the name of the \"public\" (installed) version of the less manual page?"
  650.     $ECHO " [$INSTALL_LESSMAN] \c"
  651.     read ans
  652.     if [ "X$ans" != "X" ]
  653.     then
  654.         INSTALL_LESSMAN="$ans"
  655.     fi
  656.     $ECHO "What is the name of the \"public\" (installed) version of the lesskey manual page?"
  657.     $ECHO " [$INSTALL_KEYMAN] \c"
  658.     read ans
  659.     if [ "X$ans" != "X" ]
  660.     then
  661.         INSTALL_KEYMAN="$ans"
  662.     fi
  663.     $ECHO ""
  664. fi
  665.  
  666. cat >>defines.h <<EOF
  667. /*
  668.  * HELPFILE is the full pathname of the help file.
  669.  */
  670. #define    HELPFILE    "$INSTALL_HELP"
  671.  
  672. EOF
  673.  
  674. cat >>makefile <<EOF
  675. # INSTALL_LESS is a list of the public versions of less.
  676. # INSTALL_KEY is a list of the public versions of lesskey.
  677. # INSTALL_HELP is a list of the public version of the help file.
  678. # INSTALL_LESSMAN is a list of the public versions of the less manual page.
  679. # INSTALL_KEYMAN is a list of the public versions of the lesskey manual page.
  680. INSTALL_LESS =        \$(ROOT)$INSTALL_LESS
  681. INSTALL_KEY =        \$(ROOT)$INSTALL_KEY
  682. INSTALL_HELP =        \$(ROOT)$INSTALL_HELP
  683. INSTALL_LESSMAN =    \$(ROOT)$INSTALL_LESSMAN
  684. INSTALL_KEYMAN =    \$(ROOT)$INSTALL_KEYMAN
  685. LESS_MANUAL =        $LESS_MANUAL
  686. KEY_MANUAL =        $KEY_MANUAL
  687. HELPFILE =        $INSTALL_HELP
  688.  
  689.  
  690. EOF
  691.  
  692.  
  693.  
  694. cat >>makefile <<"EOF"
  695. # OPTIM is passed to the compiler and the loader.
  696. # It is normally "-O" but may be, for example, "-g".
  697. OPTIM = -O
  698.  
  699. CFLAGS = $(OPTIM)
  700.  
  701.  
  702.  
  703. ##########################################################################
  704. # Files
  705. ##########################################################################
  706.  
  707. SRC1 =    ch.c cmdbuf.c command.c decode.c help.c input.c 
  708. SRC2 =    line.c linenum.c main.c edit.c option.c optfunc.c \
  709.     opttbl.c os.c 
  710. SRC3 =    charset.c filename.c lsystem.c output.c position.c ifile.c \
  711.     brac.c forwback.c jump.c search.c 
  712. SRC4 =    mark.c prompt.c screen.c signal.c tags.c ttyin.c version.c
  713.  
  714. SRC =    $(SRC1) $(SRC2) $(SRC3) $(SRC4)
  715.  
  716. OBJ =    brac.o ch.o charset.o cmdbuf.o command.o decode.o edit.o filename.o \
  717.     forwback.o help.o input.o jump.o line.o linenum.o \
  718.     lsystem.o main.o option.o optfunc.o opttbl.o os.o \
  719.     output.o position.o mark.o ifile.o prompt.o screen.o \
  720.     search.o signal.o tags.o ttyin.o version.o
  721.  
  722.  
  723. ##########################################################################
  724. # Rules for building stuff
  725. ##########################################################################
  726.  
  727. EOF
  728.  
  729. if [ "$USERFILE" = "1" ]
  730. then
  731.     cat >>makefile <<"EOF"
  732. all: less lesskey
  733. install: install_less install_help install_key install_lman install_kman
  734. EOF
  735. else
  736.     cat >>makefile <<"EOF"
  737. all: less
  738. install: install_less install_help install_lman
  739. EOF
  740. fi
  741.  
  742. cat >>makefile <<"EOF"
  743.  
  744. less: $(OBJ)
  745.     $(CC) $(LDFLAGS) $(OPTIM) -o less $(OBJ) $(LIBS) $(LDLIBS)
  746.  
  747. lesskey: lesskey.o
  748.     $(CC) $(LDFLAGS) $(OPTIM) -o lesskey lesskey.o $(LDLIBS)
  749.  
  750. install_less: less
  751.     for f in $(INSTALL_LESS); do  rm -f $$f; cp less $$f;  done
  752.     touch install_less
  753.  
  754. install_key: lesskey
  755.     for f in $(INSTALL_KEY); do  rm -f $$f; cp lesskey $$f;  done
  756.     touch install_key
  757.  
  758. install_help: less.hlp
  759.     for f in $(INSTALL_HELP); do  rm -f $$f; cp less.hlp $$f;  done
  760.     touch install_help
  761.  
  762. install_lman: $(LESS_MANUAL) 
  763.     for f in $(INSTALL_LESSMAN); do  rm -f $$f; cp $(LESS_MANUAL) $$f;  done
  764.     touch install_lman
  765.  
  766. install_kman: $(KEY_MANUAL)
  767.     for f in $(INSTALL_KEYMAN); do  rm -f $$f; cp $(KEY_MANUAL) $$f;  done
  768.     touch install_kman
  769.  
  770. ##########################################################################
  771. # Maintenance
  772. ##########################################################################
  773.  
  774. lint:
  775.     lint -hp $(SRC)
  776.  
  777. newfuncs funcs.h:
  778.     if [ -f funcs.h ]; then mv funcs.h funcs.h.OLD; fi
  779.     awk -f mkfuncs.awk $(SRC) >funcs.h
  780.  
  781. clean:
  782.     rm -f $(OBJ) lesskey.o less lesskey vecho
  783.  
  784. clobber:
  785.     rm -f *.o less lesskey vecho install_less install_key \
  786.         install_help install_lman install_kman
  787.  
  788. shar:
  789.     shar -v README CHANGES linstall \
  790.         less.nro lesskey.nro \
  791.         vecho.c mkfuncs.awk > less1.shr
  792.     shar -v less.man lesskey.man \
  793.         less.h position.h cmd.h option.h > less2.shr 
  794.     shar -v lesskey.c $(SRC1) > less3.shr
  795.     shar -v $(SRC2) > less4.shr
  796.     shar -v $(SRC3) less.hlp > less5.shr
  797.     shar -v $(SRC4) funcs.h > less6.shr
  798.  
  799.  
  800. ##########################################################################
  801. # Dependencies
  802. ##########################################################################
  803.  
  804. $(OBJ): less.h funcs.h defines.h position.h
  805. command.o decode.o: cmd.h
  806. option.o opttbl.o optfunc.o: option.h
  807.  
  808. lesskey.o: less.h funcs.h defines.h cmd.h
  809.  
  810. EOF
  811. $ECHO ""
  812.  
  813. $ECHO "The makefile and defines.h have been built."
  814. $ECHO "You should check them to make sure everything is as you want it to be."
  815. $ECHO "When you are satisfied, just type \"make\", and \"less\" will be built."
  816.