167 lines
4.6 KiB
Makefile
167 lines
4.6 KiB
Makefile
# MAKEFILE FOR (STAND_ALONE) CEM PREPROCESSOR
|
|
|
|
EMHOME=../..
|
|
MODULES=$(EMHOME)/modules
|
|
MODULESLIB=$(MODULES)/lib
|
|
BIN=$(EMHOME)/lib
|
|
MANDIR=$(EMHOME)/man
|
|
|
|
# Some paths
|
|
|
|
# Libraries
|
|
SYSLIB = $(MODULESLIB)/libsystem.a
|
|
STRLIB = $(MODULESLIB)/libstring.a
|
|
PRTLIB = $(MODULESLIB)/libprint.a
|
|
ALLOCLIB = $(MODULESLIB)/liballoc.a
|
|
ASSERTLIB = $(MODULESLIB)/libassert.a
|
|
MALLOC = $(MODULESLIB)/malloc.o
|
|
LIBS = $(PRTLIB) $(STRLIB) $(ALLOCLIB) $(MALLOC) $(ASSERTLIB) $(SYSLIB)
|
|
LIB_INCLUDES = -I$(MODULES)/h -I$(MODULES)/pkg
|
|
|
|
# Where to install the preprocessor
|
|
CEMPP = $(BIN)/cpp
|
|
|
|
# What C compiler to use and how
|
|
CC = cc
|
|
COPTIONS =
|
|
LFLAGS = -n
|
|
|
|
# What parser generator to use and how
|
|
GEN = $(EMHOME)/bin/LLgen
|
|
GENOPTIONS =
|
|
|
|
# Special #defines during compilation
|
|
CDEFS = $(LIB_INCLUDES)
|
|
CFLAGS = $(CDEFS) $(COPTIONS) -O# # we cannot pass the COPTIONS to lint!
|
|
|
|
# Grammar files and their objects
|
|
LSRC = tokenfile.g expression.g
|
|
LCSRC = tokenfile.c expression.c Lpars.c
|
|
LOBJ = tokenfile.o expression.o Lpars.o
|
|
|
|
# Objects of hand-written C files
|
|
CSRC = LLlex.c LLmessage.c ch7bin.c ch7mon.c domacro.c \
|
|
error.c idf.c init.c input.c main.c options.c \
|
|
preprocess.c replace.c scan.c skip.c tokenname.c next.c expr.c
|
|
COBJ = LLlex.o LLmessage.o ch7bin.o ch7mon.o domacro.o \
|
|
error.o idf.o init.o input.o main.o options.o \
|
|
preprocess.o replace.o scan.o skip.o tokenname.o next.o expr.o
|
|
|
|
PRFILES = Makefile Parameters \
|
|
make.hfiles make.tokcase make.tokfile LLlex.h bits.h file_info.h \
|
|
idf.h input.h interface.h macro.h \
|
|
class.h chtab.c char.tab expression.g $(CSRC)
|
|
|
|
# Objects of other generated C files
|
|
GOBJ = char.o symbol2str.o
|
|
|
|
# generated source files
|
|
GSRC = char.c symbol2str.c
|
|
|
|
# .h files generated by `make hfiles'; PLEASE KEEP THIS UP-TO-DATE!
|
|
GHSRC = errout.h idfsize.h ifdepth.h lapbuf.h \
|
|
maxincl.h nparams.h numsize.h obufsize.h \
|
|
parbufsize.h pathlength.h strsize.h textsize.h \
|
|
botch_free.h debug.h inputtype.h dobits.h
|
|
|
|
# Other generated files, for 'make clean' only
|
|
GENERATED = tokenfile.g Lpars.h LLfiles LL.output lint.out \
|
|
Xref hfiles cfiles charoffset.h
|
|
|
|
all: cc
|
|
|
|
cc: hfiles LLfiles
|
|
make "EMHOME="$(EMHOME) cpp
|
|
|
|
hfiles: Parameters char.c charoffset.h
|
|
./make.hfiles Parameters
|
|
@touch hfiles
|
|
|
|
charoffset.h char.c: chtab char.tab
|
|
chtab -fchar.tab > char.c
|
|
|
|
LLfiles: $(LSRC)
|
|
$(GEN) $(GENOPTIONS) $(LSRC)
|
|
@touch LLfiles
|
|
|
|
tokenfile.g: tokenname.c make.tokfile
|
|
<tokenname.c ./make.tokfile >tokenfile.g
|
|
|
|
symbol2str.c: tokenname.c make.tokcase
|
|
<tokenname.c ./make.tokcase >symbol2str.c
|
|
|
|
chtab: chtab.o
|
|
$(CC) -o chtab chtab.o
|
|
|
|
# Objects needed for 'cpp'
|
|
OBJ = $(COBJ) $(LOBJ) $(GOBJ)
|
|
SRC = $(CSRC) $(LCSRC) $(GSRC)
|
|
|
|
cpp: $(OBJ) Makefile
|
|
$(CC) $(COPTIONS) $(LFLAGS) $(OBJ) $(LIBS) -o cpp
|
|
size cpp
|
|
|
|
cfiles: hfiles LLfiles $(GSRC)
|
|
@touch cfiles
|
|
|
|
install: all
|
|
rm -f $(CEMPP)
|
|
cp cpp $(CEMPP)
|
|
rm -f $(MANDIR)/cpp.6
|
|
cp cpp.6 $(MANDIR)/cpp.6
|
|
|
|
cmp: all
|
|
-cmp cpp $(CEMPP)
|
|
-cmp cpp.6 $(MANDIR)/cpp.6
|
|
|
|
pr:
|
|
@pr $(PRFILES)
|
|
|
|
opr:
|
|
make pr | opr
|
|
|
|
tags: cfiles
|
|
ctags $(SRC)
|
|
|
|
depend: cfiles
|
|
sed '/^#AUTOAUTO/,$$d' Makefile >Makefile.new
|
|
echo '#AUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTO' >>Makefile.new
|
|
$(EMHOME)/bin/mkdep $(SRC) | \
|
|
sed 's/\.c:/.o:/' >>Makefile.new
|
|
mv Makefile Makefile.old
|
|
mv Makefile.new Makefile
|
|
|
|
xref:
|
|
ctags -x `grep "\.[ch]" Files`|sed "s/).*/)/">Xref
|
|
|
|
lint: cfiles
|
|
lint -bx $(CDEFS) $(SRC) >lint.out
|
|
|
|
clean:
|
|
rm -f $(LCSRC) $(OBJ) $(GENERATED) $(GSRC) $(GHSRC) chtab.o chtab cpp Out
|
|
|
|
#AUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTO
|
|
LLlex.o: LLlex.h Lpars.h bits.h charoffset.h class.h dobits.h file_info.h idf.h idfsize.h input.h inputtype.h numsize.h strsize.h
|
|
LLmessage.o: LLlex.h Lpars.h file_info.h
|
|
ch7bin.o: Lpars.h
|
|
ch7mon.o: Lpars.h
|
|
domacro.o: LLlex.h Lpars.h bits.h botch_free.h charoffset.h class.h debug.h dobits.h file_info.h idf.h idfsize.h ifdepth.h input.h inputtype.h interface.h macro.h nparams.h parbufsize.h textsize.h
|
|
error.o: LLlex.h errout.h file_info.h
|
|
idf.o: idf.h
|
|
init.o: charoffset.h class.h idf.h interface.h macro.h
|
|
input.o: file_info.h input.h inputtype.h
|
|
main.o: file_info.h idfsize.h
|
|
options.o: charoffset.h class.h idf.h idfsize.h macro.h maxincl.h
|
|
preprocess.o: LLlex.h bits.h charoffset.h class.h dobits.h file_info.h idf.h idfsize.h input.h inputtype.h line_prefix.h maxincl.h obufsize.h
|
|
replace.o: LLlex.h charoffset.h class.h debug.h file_info.h idf.h input.h inputtype.h interface.h macro.h pathlength.h textsize.h
|
|
scan.o: charoffset.h class.h idf.h input.h inputtype.h interface.h lapbuf.h macro.h nparams.h
|
|
skip.o: LLlex.h charoffset.h class.h file_info.h input.h inputtype.h
|
|
tokenname.o: LLlex.h Lpars.h file_info.h idf.h
|
|
next.o: debug.h
|
|
expr.o: Lpars.h
|
|
tokenfile.o: Lpars.h
|
|
expression.o: LLlex.h Lpars.h file_info.h
|
|
Lpars.o: Lpars.h
|
|
char.o: charoffset.h class.h
|
|
symbol2str.o: Lpars.h
|