1# Makefile $Revision: 6.21 $ 2# 3# 1) Select the proper EXDIR (path), MANDIR, MANEXT, LIBDIR, SIGVOID, 4# RE_COMP/REGCMP, DFLT_PAGER, and FMOD. Most of the other things aren't 5# normally changed (see the comments with each) 6# 2) Select the proper machine/compiler/OS section of code 7# for MS-DOS look for the pattern 'MS-DOS' 8# 3) make install 9# 4) If you have the command 'file' that uses /etc/magic add the line: 10# 38 string Spreadsheet sc file 11 12# Specify the name of the program. 13# All documentation and installation keys on this value. 14# 15name=sc 16NAME=SC 17 18# This is where the install step puts it. 19#EXDIR=/site/bin 20EXDIR=/usr/local/bin 21 22# This is where the man page goes. 23#MANEXT=1 # reno, Sun OS 4.1.1, etc. 24#MANEXT=l 25#MANDIR=/usr/local/man/man${MANEXT} 26#MANDIR=/usr/local/src/man/man${MANEXT} # reno 27MANDIR=/usr/man/man${MANEXT} 28MANMODE=644 29#MANMODE=444 30 31# This is where the library file (tutorial) goes. 32#LIBDIR=/usr/local/share/$(name) # reno 33LIBDIR=/usr/local/lib/$(name) 34 35# Set SIMPLE for lex.c if you don't want arrow keys or lex.c blows up 36SIMPLE= 37#SIMPLE=-DSIMPLE 38 39# Set BROKENCURSES if your curses has the nl/nonl bug 40# if it does and you don't set BROKENCURSES, the display will 41# be staggered across the screen. Also try IDLOKBAD below. 42BROKENCURSES= 43#BROKENCURSES=-DBROKENCURSES 44 45# Set SHOWCURSOR to TRUE if you want the default action to show a cursor, 46# set it to FALSE otherwise. Set SHOWCURSORTAG the same way to change 47# the manual page. 48SHOWCURSOR=TRUE 49SHOWCURSORTAG=on 50#SHOWCURSOR=FALSE 51#SHOWCURSORTAG=off 52 53# Set DOBACKUPS if you would like a backup copy of a source file on a save 54#DOBACKUPS= 55DOBACKUPS=-DDOBACKUPS 56 57# Set INTERNATIONAL if you need 8 bit characters. You should 58# not set this if you are running 5.3.0. I think it is OK in 5.3.1. 59#INTERNATIONAL=-DINTERNATIONAL 60INTERNATIONAL= 61 62# Set SIGVOID if signal routines are type void. 63# use: SIGVOID=-DSIGVOID for: 64# System 5.3, SunOS 4.X, VMS, BSD4.4 (reno), and ANSI C Compliant systems 65# use: SIGVOID= for: 66# BSD systems (excluding reno, BSD4.4), and the UNIXPC 'cc' 67SIGVOID=-DSIGVOID 68#SIGVOID= 69 70# Set IEEE_MATH if you need setsticky() calls in your signal handlers 71# 72#IEEE_MATH=-DIEEE_MATH 73IEEE_MATH= 74 75# Set RINT=-DRINT if you do not have rint() in math.h 76# Set RINT= on/with (they have rint): 77# SunOS 4.0.3c & 4.1.1 compiler 78# BSD4.4 (reno) 79#RINT= 80RINT=-DRINT 81 82# Specify the type of regular expressions one wants to use 83# RE_COMP for system re_comp()/re_exec() expression handler (BSD, SUN) 84# REGCMP for standard system regcmp()/regex expression handler (SVR3/4) 85# REGCOMP fpr Spencer lib use (see Spencer directory) 86# define REGLIB as well! 87#REGCOMPT=-DRE_COMP 88REGCOMPT=-DREGCMP 89#REGCOMPT=-DREGCOMP 90 91# We use the regcomp and regexec routines of Spencer 92# (Public Domain, used in Pearl and other PD packages). 93# set REGLIB for right library use (subdirectory spencer). 94#REGLIB=regexp.a 95REGLIB= 96 97# This is the name of a pager like "more". 98# "pg" may be appropriate for SYSV. 99DFLT_PAGER=-DDFLT_PAGER=\"less\" 100#DFLT_PAGER=-DDFLT_PAGER=\"more\" # generic && reno 101 102# this is the name to save back ups in 103SAVE=-DSAVENAME=\"$(NAME).SAVE\" 104 105# path to crypt, do not define if you don't have crypt 106# most systems 107CRYPT=-DCRYPT_PATH=\"/bin/crypt\" 108# BSD 109#CRYPT=-DCRYPT_PATH=\"/usr/bin/crypt\" 110# other people?, Sun OS 4.1.1 111#CRYPT=-DCRYPT_PATH=\"/usr/local/bin/crypt\" 112 113# If you get errors about fmod being undefined when you try to 114# compile, then define NO_FMOD (most likely BSD4.3 and Mt Xinu). 115#FMOD=-DNO_FMOD 116FMOD= 117 118# If your system doesn't have notimeout() in curses define NONOTIMEOUT 119NO_NOTIMEOUT= 120#NO_NOTIMEOUT=-DNONOTIMEOUT 121 122# flags for lint 123LINTFLAGS=-abchxv 124 125# Format of quick reference guide generated by $(name)qref 126# Leave undefined for normal text output. 127#QREF_FMT= 128QREF_FMT=-DTROFF 129 130# *** SPECIAL NOTES *** 131# For ULTRIX: define the BSD4.2 section and SIGVOID above 132# tdw@cl.cam.ac.uk tested on Ultrix 3.1C-0 133# HP-UX 7.0: Do NOT use -O 134# (known broken, try sc's boolean operators if you wish) 135# 136# **** SYSV curses bugs... **** 137# Try setting IDLOKBAD to fix (with an empty spreadsheet): 138# a) Redrawing the bottom half of the screen when you 139# move between row 9 <-> 10 140# b) the highlighted row labels being trash when you 141# move between row 9 <-> 10 142# c) On an xterm on Esix Rev. D+ from eating lines 143# -goto (or move) a few lines (or more) past the bottom 144# of the screen, goto (or move) to the top line on the 145# screen, move upward and the current line is deleted, the 146# others move up even when they should not, check by 147# noticing the rows become 2, 3, 40, 41, 42... (etc). 148# Known systems/terminfos w/ curses problems: 149# {Esix Rev. D+, AT&T SysV3.2.1}:at386-m,xterm, HP-UX7.0:(not sure) 150IDLOKISBAD=-DIDLOKBAD 151#IDLOKISBAD= 152 153# If you don't have idlok() in your curses define NOIDLOK 154NO_IDLOK= 155#NO_IDLOK=-DNOIDLOK 156 157# If moving right off the screen causes the screen to not redraw 158# properly, define RIGHT_CBUG to get around a curses problem on some 159# boxes, this forces screen redraws when going right off the screen 160RIGHTBUG= 161#RIGHTBUG=-DRIGHT_CBUG 162 163# IF you have problems w/ your yacc try bison, Berkeley yacc, or 164# some other yacc. Some systems don't allow you to 165# increase the number of terminals (mostly AT&T), SCO's does though. 166#YACC=yacc 167# NOTE: Do not use with bison 1.16! Get a new version.... 168YACC=bison -y 169 170# MS-DOS needs y_tab instead of the normal y.tab 171#YTAB=y_tab 172YTAB=y.tab 173 174# Command to use to make temporary copies of some source files. 175LN=ln 176#LN=ln -s 177#LN=cp 178 179#### SYSTEM DEFINES #### 180 181# Use this for system AIX V3.1 182#CFLAGS= -O -DSYSV2 -DCHTYPE=int -DNLS 183#LDFLAGS= 184#LIB=-lm -lPW -lcurses 185 186# Use this for system V.2 (includes: HP-UX 7.05, UNIXPC) 187#CFLAGS= -O -DSYSV2 188#LDFLAGS= 189#LIB=-lm -lPW -lcurses 190# with gcc on a Sequent also use: 191#CC=att gcc 192#CFLAGS= -DSYSV2 -g -pipe -traditional 193 194# Use this for system V.3 195CFLAGS= -DSYSV3 -O 196LDFLAGS= -s 197#CFLAGS= -DSYSV3 -g 198#LDFLAGS= -g 199LIB=-lm -lcurses -lPW 200# with gcc also use: 201#CC=gcc 202#CFLAGS= -DSYSV3 -O -pipe -traditional 203#CFLAGS= -DSYSV3 -pipe -traditional 204# debugging bison (bison 1.16 is broken) 205#CFLAGS= -DSYSV3 -g -pipe -traditional 206#YACC=bison -y -v -t -l 207 208# Use this for system V.4 209#CFLAGS= -DSYSV3 -O 210#CFLAGS= -DSYSV3 211#LDFLAGS= -s 212#LDFLAGS= 213# FIXME: get rid of alloca.o: ar xv /usr/local/lib/libiberty.a alloca.o 214#LIB=-lm -lcurses -lgen alloca.o 215#LIB=-lm -lcurses -lgen 216# with gcc also use: 217#CC=gcc 218#CFLAGS= -DSYSV3 -O -pipe -Wall 219 220# Microport 221#CFLAGS= -DSYSV2 -O -DUPORT -Ml 222#LDFLAGS=-Ml 223#LIB=-lm -lcurses -lPW 224 225# Use this for BSD 4.2 226#CFLAGS= -O -DBSD42 227#LDFLAGS= 228#LIB=-lm -lcurses -ltermcap 229# with gcc also use: 230#CC=gcc 231 232# Use this for Sequent boxes 233#CC=atscc 234#CFLAGS=-O -DBSD42 235#LDFLAGS= 236#LIB=-lm -lcurses -ltermcap 237#PSCLIB=-lseq 238# with gcc also use: 239#CC=gcc 240#CFLAGS= -O -DBSD42 -pipe 241 242# Use this for BSD 4.3 243#CFLAGS= -O -DBSD43 244#LDFLAGS= 245#LIB=-lm -lcurses -ltermcap 246 247# Use this for 386BSD (not tested, taken from comments) 248# define RE_COMP and RINT above 249#CFLAGS= -O -DBSD43 250#LDFLAGS= 251#LIB=-lm -lcurses -ltermcap 252 253# Use this for SunOS 4.1. You should also have 'SIMPLE='. 254#CC=gcc 255#CFLAGS= -g -O -DBSD43 -Wall -DSUNOS4 256#LDFLAGS= 257#LIB=-lm -lcurses -ltermcap 258 259# Use this for SunOS 4.X if you have the System V package installed. 260# This will link with the System V curses which is preferable to the 261# BSD curses (especially helps scrolling on slow (9600bps or less) 262# serial lines). 263# 264# Be sure to define SIGVOID and RE_COMP above. 265# 266#CC=/usr/5bin/cc 267#CFLAGS= -O -DSYSV3 268#LDFLAGS= 269#LIB=-lm -lcurses 270 271# Use this for system III (XENIX) 272#CFLAGS= -O -DSYSIII 273#LDFLAGS= -i 274#LIB=-lm -lcurses -ltermcap 275 276# Use this for XENIX Version 2.3 277#CFLAGS= -O -DSYSIII -DXENIX2_3 278#LDFLAGS= -i 279#LIB=-lm -lcurses -ltermcap 280 281# Use this for VENIX 282#CFLAGS= -DVENIX -DBSD42 -DV7 283#LDFLAGS= -z -i 284#LIB=-lm -lcurses -ltermcap 285 286# For SCO Unix V rel. 3.2.0 287# -compile using rcc, cc does not cope with gram.c 288# -edit /usr/include/curses.h, rcc does not understand #error 289# -link: make CC=cc, rcc's loader gets unresolved __cclass, __range 290# (rather strange,?) 291#CC=rcc 292#CC=cc 293#CC=gcc -fstrength-reduce 294#SIGVOID=-DSIGVOID 295#CFLAGS= -O -DSYSV3 296#LDFLAGS= 297#LIB=-lm -lcurses -ltinfo -lPW 298#YACC=yacc -Sm10000 299 300# Use this for SCO Unix 3.2.2 and ODT 1.1 301#CC=cc 302#CFLAGS= -O -DSYSV3 303#LDFLAGS= 304#LIB=-lm -lcurses -lPW -lmalloc -lc_s 305#YACC=yacc -Sm10000 306 307# Use this for MS-DOS, Microsoft C 5.1 and NDMAKE 308#CC=cl 309#CFLAGS= -AL -O -Fo$*.o 310#LDFLAGS=/noi /st:0x4000 311#LIB=lcurses 312#YACC=bison -y 313# 314#.SUFFIXES : .o .c 315#.c.o: 316# $(CC) $(CFLAGS) -c $*.c 317 318# All of the source files 319SRC=Makefile cmds.c crypt.c eres.sed format.c gram.y help.c interp.c \ 320 lex.c matrix.c psc.c range.c sc.c sc.h screen.c sres.sed \ 321 version.c vi.c vmtbl.c xmalloc.c 322 323# The objects 324OBJS=cmds.o crypt.o format.o gram.o help.o interp.o lex.o matrix.o \ 325 range.o sc.o screen.o version.o vi.o vmtbl.o xmalloc.o 326 327# The documents in the Archive 328DOCS=CHANGES README sc.doc psc.doc tutorial.sc VMS_NOTES torev build.com 329 330FEATURES= ${BROKENCURSES} ${CRYPT} ${DFLT_PAGER} ${DOBACKUPS} ${FMOD} \ 331 ${IDLOKISBAD} ${IEEE_MATH} ${INTERNATIONAL} ${NO_IDLOK} \ 332 ${NO_NOTIMEOUT} ${REGCOMPT} ${RIGHTBUG} ${RINT} ${SAVE} \ 333 ${SIGVOID} ${SIMPLE} -DSHOWCURSOR=${SHOWCURSOR} 334 335all: $(name) p$(name) $(name)qref 336 337$(name):$(PAR) $(OBJS) 338 $(CC) ${LDFLAGS} ${OBJS} ${LIB} ${REGLIB} -o $(name) 339 340# Alternative link for MS-DOS 341#$(name): $(OBJS) 342# link ${LDFLAGS} ${OBJS},$(name),,${LIB}; 343 344gram.c: gram.y 345 $(YACC) -d gram.y 346 mv $(YTAB).c gram.c 347 348$(YTAB).h: gram.y 349 350p$(name): psc.c pvmtbl.o pxmalloc.o 351 $(CC) $(CFLAGS) ${FEATURES} ${LDFLAGS} -o p$(name) psc.c pvmtbl.o pxmalloc.o ${PSCLIB} 352 353# Alternative link for MS-DOS (NB: MSC 5.1 has no getopt.c) 354#p$(name): psc.o pvmtbl.o pxmalloc.o getopt.o 355# link ${LDFLAGS} psc.o pvmtbl.o pxmalloc.o getopt.o,p$(name); 356 357qhelp.c: help.c 358 -rm -f qhelp.c 359 ${LN} help.c qhelp.c 360 361$(name)qref: qhelp.c version.c 362 $(CC) $(CFLAGS) ${FEATURES} $(LDFLAGS) -DQREF $(QREF_FMT) -DSCNAME=\"$(NAME)\" -o $(name)qref qhelp.c 363 364# Alternative link for MS-DOS 365#$(name)qref: qhelp.c sc.h 366# $(CC) -AL -O -Foqhelp.o -c -DQREF -DSCNAME=\"$(name)\" qhelp.c 367# link ${LDFLAGS} qhelp.o,$(name)qref; 368 369pvmtbl.c: vmtbl.c 370 -rm -f pvmtbl.c 371 ${LN} vmtbl.c pvmtbl.c 372 373pvmtbl.o: sc.h pvmtbl.c 374 $(CC) ${CFLAGS} ${FEATURES} -c -DPSC pvmtbl.c 375 376pxmalloc.c: xmalloc.c 377 -rm -f pxmalloc.c 378 ${LN} xmalloc.c pxmalloc.c 379 380# Objects 381 382cmds.o: cmds.c sc.h 383 $(CC) ${CFLAGS} ${FEATURES} -c cmds.c 384 385crypt.o: crypt.c sc.h 386 $(CC) ${CFLAGS} ${FEATURES} -c crypt.c 387 388format.o: format.c 389 390help.o: help.c sc.h version.c 391 $(CC) ${CFLAGS} ${FEATURES} -c help.c 392 393qhelp.o: qhelp.c sc.h version.c 394 $(CC) ${CFLAGS} ${FEATURES} -c qhelp.c 395 396interp.o: interp.c sc.h 397 $(CC) ${CFLAGS} ${FEATURES} -c interp.c 398 399gram.o: sc.h $(YTAB).h gram.c eres.sed sres.sed 400 $(CC) ${CFLAGS} ${FEATURES} -c gram.c 401 sed < gram.y > experres.h -f eres.sed 402 sed < gram.y > statres.h -f sres.sed 403 404lex.o: sc.h $(YTAB).h gram.o lex.c 405 $(CC) ${CFLAGS} ${FEATURES} -c lex.c 406 407pxmalloc.o: sc.h pxmalloc.c 408 $(CC) ${CFLAGS} ${FEATURES} -c -DPSC pxmalloc.c 409 410range.o: range.c sc.h 411 412sc.o: sc.h sc.c 413 $(CC) ${CFLAGS} ${FEATURES} -c sc.c 414 415screen.o: sc.h screen.c 416 $(CC) ${CFLAGS} ${FEATURES} -c screen.c 417 418vi.o: vi.c sc.h 419 420# other stuff 421 422clean: 423 rm -f *.o *res.h y.tab.h debug core gram.c $(name).1 \ 424 p$(name).1 y.output pxmalloc.c pvmtbl.c qhelp.c y_tab.h 425 426clobber: 427 rm -f *.o *res.h $(YTAB).h $(name) p$(name) debug core gram.c $(name).1 \ 428 $(name).man p$(name).man p$(name).1 y.output $(name)qref \ 429 pxmalloc.c pvmtbl.c qhelp.c 430 431shar: ${SRC} ${DOCS} 432 shar -c -m 64000 -f shar ${DOCS} ${SRC} 433 434sshar: ${SRC} 435 shar -c -m 1000000 -f shar ${SRC} 436 437lint: sc.h sc.c lex.c gram.c interp.c cmds.c crypt.c range.c help.c \ 438 vi.c version.c xmalloc.c format.c vmtbl.c 439 lint ${LINTFLAGS} ${CFLAGS} ${FEATURES} sc.c lex.c gram.c interp.c \ 440 cmds.c crypt.c range.c help.c vi.c version.c xmalloc.c format.c \ 441 vmtbl.c -lcurses -lm 442 make lintqref 443 make lintpsc 444 445lintqref: help.c 446 lint ${LINTFLAGS} ${CFLAGS} ${FEATURES} -DQREF $(QREF_FMT) -DSCNAME=\"$(NAME)\" help.c 447 448lintpsc: psc.c vmtbl.c 449 lint ${LINTFLAGS} ${CFLAGS} ${FEATURES} -DPSC psc.c vmtbl.c ${PSCLIB} 450 451inspect: sc.h sc.c lex.c gram.c interp.c cmds.c crypt.c 452 /bruces/ianj/bin/i386/inspect -abv -t 8 sc.c lex.c gram.c interp.c \ 453 cmds.c crypt.c range.c xmalloc.c help.c vi.c 454 455print: sc.h gram.y sc.c lex.c interp.c cmds.c crypt.c 456 prc sc.h gram.y sc.c lex.c interp.c cmds.c crypt.c | lpr 457 458$(name).1: sc.doc torev 459 name=$(name) NAME=$(NAME) LIBDIR=$(LIBDIR) SHOWCURSOR=${SHOWCURSORTAG} sh torev sc.doc > $(name).1 460# sed -e s/pname/$(name)/g -e s/PNAME/$(NAME)/g \ 461# -e s%#LIBDIR#%$(LIBDIR)%g sc.doc > $(name).1 462# REVISION=`sed -e '/Revision/!D' -e 's/.*$Revision: 6.21 $( 463# sed -e s/pname/$(name)/g -e s/PNAME/$(NAME)/g \ 464# -e s%#LIBDIR#%$(LIBDIR)%g \ 465# -e 's/#REVISION#/$(REVISION)/' sc.doc > $(name).1 466 467$(name).man: $(name).1 468 nroff -man $(name).1 > $(name).man 469 470laser: $(name).1 471 itpf -x -Pim2 -man $(name).1 472 473p$(name).1: psc.doc torev 474 name=$(name) NAME=$(NAME) LIBDIR=$(LIBDIR) SHOWCURSOR=${SHOWCURSORTAG} sh torev psc.doc > p$(name).1 475 476p$(name).man: p$(name).1 477 nroff -man p$(name).1 > p$(name).man 478 479install: $(EXDIR)/$(name) $(EXDIR)/$(name)qref $(EXDIR)/p$(name) \ 480 $(LIBDIR)/tutorial \ 481 $(MANDIR)/$(name).$(MANEXT) $(MANDIR)/p$(name).$(MANEXT) 482 483$(EXDIR)/$(name): $(name) 484 cp $(name) $(EXDIR) 485 strip $(EXDIR)/$(name) 486 487$(EXDIR)/$(name)qref: $(name)qref 488 cp $(name)qref $(EXDIR) 489 strip $(EXDIR)/$(name)qref 490 491$(EXDIR)/p$(name): p$(name) 492 cp p$(name) $(EXDIR) 493 strip $(EXDIR)/p$(name) 494 495$(LIBDIR)/tutorial: tutorial.sc $(LIBDIR) 496 cp tutorial.sc $(LIBDIR)/tutorial.$(name) 497 chmod $(MANMODE) $(LIBDIR)/tutorial.$(name) 498 499$(LIBDIR): 500 mkdir $(LIBDIR) 501 502$(MANDIR)/$(name).$(MANEXT): $(name).1 503 cp $(name).1 $(MANDIR)/$(name).$(MANEXT) 504 chmod $(MANMODE) $(MANDIR)/$(name).$(MANEXT) 505 506$(MANDIR)/p$(name).$(MANEXT): p$(name).1 507 cp p$(name).1 $(MANDIR)/p$(name).$(MANEXT) 508 chmod $(MANMODE) $(MANDIR)/p$(name).$(MANEXT) 509 510diffs: ${SRC} 511 for i in ${DOCS} ${SRC} ;\ 512 do \ 513 rcsdiff -c -r6.18 $$i ;\ 514 done 515 516# THA 10/14/90 Added code to make a patchfile 517patchfile: ${SRC} ${DOCS} 518 rm -f patchfile 519 for i in ${SRC} ${DOCS} ;\ 520 do \ 521 #diff -c $$i ../621/$$i >> patchfile \ 522 #echo $$i \ 523 diff -c $$i ../621/$$i ; \ 524 done 525 526files: 527 @find $(DOCS) $(SRC) -print 528