diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /support/ltx2x/makefile |
Initial commit
Diffstat (limited to 'support/ltx2x/makefile')
-rw-r--r-- | support/ltx2x/makefile | 290 |
1 files changed, 290 insertions, 0 deletions
diff --git a/support/ltx2x/makefile b/support/ltx2x/makefile new file mode 100644 index 0000000000..3f606c3c08 --- /dev/null +++ b/support/ltx2x/makefile @@ -0,0 +1,290 @@ +# makefile for program ltx2x --- LaTeX to X autotagger +# November 1999 +# +##################### Change the following for your setup +# The compiler +CC = gcc + +# We use flex (or equivalent, but not lex) to generate the lexer +LEX = flex +# and the options +LEXFLAGS = -v + +# We use bison (or equivalent) to generate the parser +YACC = bison +# and the options +YACCFLAGS = -y -d -v + +# Libraries to be used +LIBS = -ly -ll -lm + +# The root directory for the installation (e.g., /usr/local ) +ROOTDIR = /opt/GNU/gnu + +# Where to place the running code (e.g. /usr/local/bin ) +BINDIR = ${ROOTDIR}/bin + +# Where to place the manpage (e.g., /usr/local/man/man1 ) +MANEXT = 1 +MANDIR = ${ROOTDIR}/man/man${MANEXT} + +# Just in case you want to change the name of the binary +# (and then you should also change the man page and documentation). +# So, do not change this. +PROG = ltx2x + +# Where to place the user documentation (e.g., /usr/local/doc/ltx2x ) +DOCDIR = ${ROOTDIR}/doc/${PROG} + +# Where to place the example command tables (e.g., /usr/local/lib/config/ltx2x ) +CTDIR = ${ROOTDIR}/lib/config/${PROG} + +# The code checking program +LINT = lint + +# Code checking program options +LINTOPTS = -achqux + +# Assume getopt is present on the system +GETOPTC = +GETOPTO = +GETOPTH = +# If you do not have getopt already on your system, uncomment the next three linws +# GETOPTC = getopt.c +# GETOPTO = getopt.o +# GETOPTO = getopt.h + + +# The file copy command (copy but do not delete original) +COPY = cp + +# The file move command (move and delete original) +MOVE = mv + +# The file delete command +DELETE = rm + +# The make directory (hierarchy) command +MAKEDIR = mkdirhier + +# The stream editor command +SED = sed + +# Command to write to the terminal (stdout) +ECHO = echo + +################### You should not have to change anything after this +################### but read on just in case + +# The source modules +L2XSRCS = l2xytab.c l2xlexyy.c l2xlib.c l2xacts.c l2xusrlb.c srchenv.c \ + ${GETOPTC} + +INTSRCS = l2xirtne.c l2xistd.c l2xidecl.c l2xistmt.c l2xiexpr.c l2xiscan.c \ + l2xisymt.c l2xierr.c l2xiidbg.c l2xistup.c l2xixutl.c l2xixstm.c \ + l2xixxpr.c l2xixstd.c l2xidbug.c l2xisdcl.c l2xirexp.c listsetc.c + +# The object modules +L2XOBJS = l2xytab.o l2xlexyy.o l2xlib.o l2xacts.o l2xusrlb.o srchenv.o \ + ${GETOPTO} + +INTOBJS = l2xirtne.o l2xistd.o l2xidecl.o l2xistmt.o l2xiexpr.o l2xiscan.o \ + l2xisymt.o l2xierr.o l2xiidbg.o l2xistup.o l2xixutl.o l2xixstm.o \ + l2xixxpr.o l2xixstd.o l2xidbug.o l2xisdcl.o l2xirexp.o listsetc.o + +OBJS = ${L2XOBJS} ${INTOBJS} + +# Link object code together into PROG +ltx2x : ${OBJS} + ${CC} -o ${PROG} ${OBJS} ${LIBS} + +# Compile C source code into object code +getopt.o : getopt.c getopt.h + ${CC} -c getopt.c +l2xytab.o : l2xytab.c l2xlib.h l2xusrlb.h l2xacts.h strtypes.h l2xcom.h + ${CC} -c l2xytab.c +l2xlexyy.o : l2xlexyy.c l2xytab.h l2xlib.h l2xusrlb.h l2xcom.h + ${CC} -c l2xlexyy.c +l2xlib.o : l2xlib.c l2xytab.h strtypes.h l2xcom.h ${GETOPTH} + ${CC} -c l2xlib.c +l2xusrlb.o : l2xusrlb.c l2xlib.h l2xytab.h strtypes.h l2xcom.h + ${CC} -c l2xusrlb.c +l2xacts.o : l2xacts.c l2xusrlb.h l2xlib.h l2xytab.h strtypes.h l2xcom.h + ${CC} -c l2xacts.c +srchenv.o : srchenv.c srchenv.h + ${CC} -c srchenv.c + +# Generate C code for parsing +l2xytab.c l2xytab.h: l2x.y + @ ${ECHO} "Expect 10 shift/reduce conflicts to be reported" + ${YACC} ${YACCFLAGS} l2x.y + ${MOVE} y.tab.c l2xytab.c + ${MOVE} y.tab.h l2xytab.h + +# Generate C code for lexing +l2xlexyy.c : l2x.l + ${LEX} ${LEXFLAGS} l2x.l + ${MOVE} lex.yy.c l2xlexyy.c + +# stuff for interpreter modules + +# compiler flags for analyze and execute programs +ANLFLAG = -Danalyze +RUNFLAG = -Dtrace + +# interpreter commons + +SOMEH = l2xicmon.h l2xierr.h l2xiscan.h l2xisymt.h licomsym.h l2xiidbg.h +MOSTH= ${SOMEH} l2xiprse.h +ALLH = ${MOSTH} l2xicpr.h l2xiexec.h + +# interpreter setup + +l2xistup.o : l2xistup.c ${ALLH} + ${CC} -c ${ANLFLAG} ${RUNFLAG} l2xistup.c + +# The parser module + +l2xirtne.o : l2xirtne.c ${ALLH} + ${CC} -c ${ANLFLAG} l2xirtne.c + +l2xistd.o : l2xistd.c ${MOSTH} + ${CC} -c l2xistd.c + +l2xidecl.o : l2xidecl.c ${MOSTH} l2xicpr.h + ${CC} -c ${ANLFLAG} l2xidecl.c + +l2xistmt.o : l2xistmt.c ${ALLH} + ${CC} -c ${ANLFLAG} l2xistmt.c + +l2xiexpr.o : l2xiexpr.c ${MOSTH} l2xicpr.h + ${CC} -c ${ANLFLAG} l2xiexpr.c + +# scanner module + +l2xiscan.o : l2xiscan.c ${SOME} l2xicpr.h + ${CC} -c ${ANLFLAG} l2xiscan.c + +# symbol table module + +l2xisymt.o : l2xisymt.c l2xicmon.h l2xierr.h l2xisymt.h licomsym.h l2xiidbg.h + ${CC} -c l2xisymt.c + +# executor module + +l2xixutl.o : l2xixutl.c ${MOSTH} l2xiexec.h listsetc.h + ${CC} -c ${RUNFLAG} l2xixutl.c + +l2xixstm.o : l2xixstm.c ${MOSTH} l2xiexec.h listsetc.h + ${CC} -c ${RUNFLAG} l2xixstm.c + +l2xixxpr.o : l2xixxpr.c ${MOSTH} l2xiexec.h listsetc.h + ${CC} -c ${RUNFLAG} l2xixxpr.c + +l2xixstd.o : l2xixstd.c ${MOSTH} l2xiexec.h listsetc.h + ${CC} -c ${RUNFLAG} l2xixstd.c + +l2xidbug.o : l2xidbug.c ${SOMEH} l2xiexec.h listsetc.h + ${CC} -c ${RUNFLAG} l2xidbug.c + +# error and miscellaneous module + +l2xisdcl.o : l2xisdcl.c ${SOMEH} + ${CC} -c ${ANLFLAG} ${RUNFLAG} l2xisdcl.c + +l2xiidbg.o : l2xiidbg.c ${SOMEH} l2xiexec.h + ${CC} -c l2xiidbg.c + +l2xirexp.o : l2xirexp.c l2xirexp.h + ${CC} -c l2xirexp.c + +listsetc.o : listsetc.c listsetc.h + ${CC} -c listsetc.c + + +# Checking the sources + +# Original ltx2x +checkl2x : + ${LINT} ${LINTOPTS} -o l2x.lint ${L2XSRCS} +# Interpreter +checkinterp : + ${LINT} ${LINTOPTS} -o interp.lint ${INTSRCS} +# The lot! +checkall : + ${LINT} ${LINTOPTS} -o ltx2x.lint ${L2XSRCS} ${INTSRCS} + + +# only call make install if BINDIR has been set +install : ltx2x + ${MAKEDIR} ${BINDIR} + ${COPY} ${PROG} ${BINDIR} + +# Edit the file man to replace DOCUMENTDIR by the actual directory +# where the user manual is to be placed, and CTDIR by the location +# of the example command table files. +# Then copy the manpage to the proper place +manpage : + ${SED} 's!DOCUMENTDIR!${DOCDIR}!; s!CTDIR!${CTDIR}!' man > tman + ${MAKEDIR} ${MANDIR} + ${COPY} tman ${MANDIR}/${PROG}.${MANEXT} + +# Copy the user manuals to the proper place +doc : + ${MAKEDIR} ${DOCDIR} + ${COPY} ltx2x.tex ${DOCDIR}/${PROG}.tex + ${COPY} ltx2x.ps ${DOCDIR}/${PROG}.ps + ${COPY} ltx2x.txt ${DOCDIR}/${PROG}.txt + ${COPY} ltx2x.html ${DOCDIR}/${PROG}.html + +# Copy the example command tables to their final location +ctables : + ${MAKEDIR} ${CTDIR} + ${COPY} ltx2x.ct ${CTDIR}/ltx2x.ct + ${COPY} detex.ct ${CTDIR}/detex.ct + ${COPY} remcom.ct ${CTDIR}/remcom.ct + ${COPY} l2h.ct ${CTDIR}/l2h.ct + ${COPY} bye.ct ${CTDIR}/bye.ct + +# Do almost everything except clean up +all : ltx2x install manpage doc ctables + +# call make clean to remove the compiled program, the object files, +# info from YACC, and the edited version of the manpage +clean : + - ${DELETE} ${PROG} + - ${DELETE} *.o + - ${DELETE} y.output + - ${DELETE} tman + + +#### For the printct program (best to do this after the ltx2x program) + +# compile the printct program +# printct : printct.o getopt.o srchenv.o +# ${CC} -o printct printct.o getopt.o srchenv.o +printct : printct.o srchenv.o ${GETOPTO} + ${CC} -o printct printct.o srchenv.o ${GETOPTO} + +printct.o : printct.c strtypes.h l2xcom.h ${GETOPTH} + ${CC} -c printct.c + +# call make installprintct to move the printct binary to its final location +installprintct : + ${COPY} printct ${BINDIR} + +# call make cleanprintct to remove the compiled program and its object file +cleanprintct : + - ${DELETE} printct + - ${DELETE} printct.o + - ${DELETE} srchenv.o + - ${DELETE} getopt.o + +testlist : testlist.o listsetc.o + ${CC} -o testlist testlist.o listsetc.o -lm + +testlist.o : testlist.c listsetc.h + ${CC} -c testlist.c + + + |