: # Installation script for less. # This script prompts the operator for various information # and constructs a makefile. echo "This script will build a makefile for less." echo "If you already have a file called \"makefile\" it will be overwritten." echo "Press RETURN to continue." read ans echo "I will ask you some questions about your system." echo "If you do not know the answer to any question," echo "just press RETURN and I will choose a default for you." echo "Press RETURN now." read ans echo "Most Unix systems are derived from either System V" echo "or Berkeley BSD 4.1, 4.2, 4.3, etc." echo "" echo "Is your system closest to:" echo " 1. System V" echo " 2. BSD 2.11 or later" echo " 3. BSD 4.1" echo " 4. BSD 4.2 or later" echo " 5. Xenix" echo "Enter a number, or just RETURN if you don't know: \c" read ans xenix=0 case "X$ans" in X1) sys=sys5; sysname="System V" ;; X2) sys=bsd; bsd41=0; bsd2=1; sysname="BSD 2.11" ;; X3) sys=bsd; bsd41=1; bsd2=0; sysname="BSD 4.1" ;; X4) sys=bsd; bsd41=0; bsd2=0; sysname="BSD 4.2" ;; X5) sys=sys5; xenix=1; sysname="Xenix" ;; *) sys=unknown ;; esac echo "" cat >makefile <<"EOF" # Makefile for "less" # # Invoked as: # make all # or make install # Plain "make" is equivalent to "make all". # # If you add or delete functions, remake funcs.h by doing: # make newfuncs # This depends on the coding convention of function headers looking like: # " \t public \n ( ... ) " # # Also provided: # make lint # Runs "lint" on all the sources. # make clean # Removes "less" and the .o files. # make clobber # Pretty much the same as make "clean". ########################################################################## # System-specific parameters ########################################################################## EOF cat >>makefile <>makefile <>makefile <>makefile <>makefile <>makefile <>makefile <>makefile <>makefile <>makefile <>makefile <>makefile <>makefile <>makefile <>makefile <<"EOF" # OPTIM is passed to the compiler and the loader. # It is normally "-O" but may be, for example, "-g". OPTIM = -O -i EOF else cat >>makefile <<"EOF" # OPTIM is passed to the compiler and the loader. # It is normally "-O" but may be, for example, "-g". OPTIM = -O EOF fi cat >>makefile <<"EOF" ########################################################################## # Files ########################################################################## SRC1 = main.c option.c prim.c ch.c position.c input.c output.c SRC2 = screen.c prompt.c line.c signal.c help.c ttyin.c command.c version.c SRC = $(SRC1) $(SRC2) OBJ = main.o option.o prim.o ch.o position.o input.o output.o screen.o \ prompt.o line.o signal.o help.o ttyin.o command.o version.o ########################################################################## # Rules ########################################################################## DEFS = "-DTERMIO=$(TERMIO)" \ "-DSIGSETMASK=$(SIGSETMASK)" \ "-Doff_t=$(off_t)" "-DVOID=$(VOID)" \ "-DREGCMP=$(REGCMP)" "-DRECOMP=$(RECOMP)" \ "-DSHELL_ESCAPE=$(SHELL_ESCAPE)" \ "-DEDITOR=$(EDITOR)" "-DEDIT_PGM=\"$(EDIT_PGM)\"" \ "-DHELPFILE=\"$(HELPFILE)\"" \ "-DLOGFILE=$(LOGFILE)" \ "-DONLY_RETURN=$(ONLY_RETURN)" \ "-DGLOB=$(GLOB)" \ "-DXENIX=$(XENIX)" CFLAGS = $(OPTIM) $(DEFS) all: less less: $(OBJ) cc $(OPTIM) -o less $(OBJ) $(LIBS) install: install_man install_less install_help install_less: less for f in $(INSTALL_LESS); do rm -f $$f; cp less $$f; done touch install_less install_help: less.help for f in $(INSTALL_HELP); do rm -f $$f; cp less.help $$f; done touch install_help EOF if [ "$sys" = "bsd" -a "$bsd2" = "1" ] then cat >>makefile <<"EOF" install_man: $(MANUAL) rm -f $(INSTALL_MAN) /usr/man/manroff $(MANUAL) > $(INSTALL_MAN) chmod 444 $(INSTALL_MAN) chown bin.bin $(INSTALL_MAN) touch install_man EOF else cat >>makefile <<"EOF" install_man: $(MANUAL) for f in $(INSTALL_MAN); do rm -f $$f; cp $(MANUAL) $$f; done touch install_man EOF fi cat >>makefile <<"EOF" $(OBJ): less.h funcs.h # help.o depends on makefile for the definition of HELPFILE. help.o: makefile lint: lint -hp $(DEFS) $(SRC) newfuncs: mv funcs.h funcs.h.OLD awk -f mkfuncs.awk $(SRC) >funcs.h EOF if [ "$sys" = "bsd" -a "$bsd2" = "1" ] then cat >>makefile <<"EOF" clean: rm -f $(OBJ) less install_help install_less install_man core EOF else cat >>makefile <<"EOF" clean: rm -f $(OBJ) less EOF fi cat >>makefile <<"EOF" clobber: rm -f *.o less install_less install_man shar: shar -v README install less.help makefile.* *.h *.awk > less.shar.a shar -v less.nro $(SRC1) > less.shar.b shar -v $(SRC2) > less.shar.c EOF echo "" echo "The makefile has been built." echo "You should check it to make sure everything is as you want it to be." echo "When you are satisfied with the makefile, just type \"make\"" echo "and \"less\" will be built."