This commit is contained in:
ceriel 1991-09-30 16:51:49 +00:00
parent 25cf41d9b7
commit ffa0f837a1
11 changed files with 986 additions and 0 deletions

6
lang/cem/lint/.distr Normal file
View file

@ -0,0 +1,6 @@
README
llib
lpass1
lpass1.ansi
lpass2
proto.make

24
lang/cem/lint/README Normal file
View file

@ -0,0 +1,24 @@
# (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
# See the copyright notice in the ACK home directory, in the file "Copyright".
#
# $Header$
This directory contains part of the sources of the program lint, which is
based on the cem compiler of ACK, and some more programs which will be
helpful in maintaining lint. The other part of the sources resides in the
C front-end directories cemcom and cemcom.ansi.
Author: Frans Kunst / Dick Grune
llib: Directory containing lint libraries
lpass1: Directory containing installation files for the first pass
lpass1.ansi: Directory containing installation files for the first pass
of the ANSI C version.
lpass2: Directory containing the second pass, driver script and
manual page.
tests: A lot of test files and programs to run these tests

View file

@ -0,0 +1,3 @@
Parameters
proto.main
proto.make

View file

@ -0,0 +1,143 @@
!File: lint.h
#define LINT 1 /* if defined, 'lint' is produced */
#define ANSI 1 /* tell l_* files it's ANSI */
!File: pathlength.h
#define PATHLENGTH 1024 /* max. length of path to file */
!File: errout.h
#define ERROUT STDERR /* file pointer for writing messages */
#define ERR_SHADOW 0 /* a syntax error overshadows error messages
until ERR_SHADOW symbols have been
accepted without syntax error */
!File: idfsize.h
#define IDFSIZE 64 /* maximum significant length of an identifier */
!File: numsize.h
#define NUMSIZE 256 /* maximum length of a numeric constant */
!File: nparams.h
#define NPARAMS 32 /* maximum number of parameters */
#define STDC_NPARAMS 31 /* ANSI limit on number of parameters */
!File: ifdepth.h
#define IFDEPTH 256 /* maximum number of nested if-constructions */
!File: density.h
#define DENSITY 2 /* see switch.[ch] for an explanation */
!File: macbuf.h
#define LAPBUF 128 /* initial size of macro replacement buffer */
#define ARGBUF 128 /* initial size of macro parameter buffer(s) */
!File: strsize.h
#define ISTRSIZE 32 /* minimum number of bytes allocated for
storing a string */
#define RSTRSIZE 16 /* step size in enlarging the memory for
the storage of a string */
!File: trgt_sizes.h
#define MAXSIZE 8 /* the maximum of the SZ_* constants */
/* target machine sizes */
#define SZ_CHAR 1
#define SZ_SHORT 2
#define SZ_WORD 4
#define SZ_INT 4
#define SZ_LONG 4
#define SZ_FLOAT 4
#define SZ_DOUBLE 8
#define SZ_POINTER 4
#define SZ_LNGDBL 8 /* for now */
/* target machine alignment requirements */
#define AL_CHAR 1
#define AL_SHORT SZ_SHORT
#define AL_WORD SZ_WORD
#define AL_INT SZ_WORD
#define AL_LONG SZ_WORD
#define AL_FLOAT SZ_WORD
#define AL_DOUBLE SZ_WORD
#define AL_LNGDBL SZ_WORD
#define AL_POINTER SZ_WORD
#define AL_STRUCT 1
#define AL_UNION 1
!File: botch_free.h
#undef BOTCH_FREE 1 /* when defined, botch freed memory, as a check */
!File: dataflow.h
#undef DATAFLOW 1 /* produce some compile-time xref */
!File: debug.h
#undef DEBUG 1 /* perform various self-tests */
!File: use_tmp.h
#undef PREPEND_SCOPES 1 /* collect exa, exp, ina and inp commands
and if USE_TMP is defined let them
precede the rest of the generated
compact code */
#undef USE_TMP 1 /* use C_insertpart, C_endpart mechanism
to generate EM-code in the order needed
for the code-generators. If not defined,
the old-style peephole optimizer is
needed. */
!File: parbufsize.h
#define PARBUFSIZE 1024
!File: textsize.h
#define ITEXTSIZE 32 /* 1st piece of memory for repl. text */
!File: inputtype.h
#define INP_READ_IN_ONE 1 /* read input file in one */
!File: nopp.h
#undef NOPP 1 /* if NOT defined, use built-int preprocessor */
!File: nobitfield.h
#undef NOBITFIELD 1 /* if NOT defined, implement bitfields */
!File: spec_arith.h
/* describes internal compiler arithmetics */
#undef SPECIAL_ARITHMETICS /* something different from native long */
#undef UNSIGNED_ARITH unsigned arith
!File: static.h
#define GSTATIC /* for large global "static" arrays */
!File: nocross.h
#undef NOCROSS 1 /* if NOT defined, cross compiler */
!File: regcount.h
#undef REGCOUNT 1 /* count occurrences for register messages */
!File: dbsymtab.h
#undef DBSYMTAB 1 /* ability to produce symbol table for debugger */

View file

@ -0,0 +1,59 @@
# $Header$
# C compilation part. Not to be called directly.
# Instead, it is to be called by the Makefile.
# SRC_DIR, UTIL_HOME, TARGET_HOME, CC, COPTIONS, LINT, LINTOPTIONS, LDOPTIONS,
# CC_AND_MKDEP, SUF, LIBSUF should be set here.
#PARAMS do not remove this line!
MDIR = $(TARGET_HOME)/modules
LIBDIR = $(MDIR)/lib
LINTLIBDIR = $(UTIL_HOME)/modules/lib
MALLOC = $(LIBDIR)/malloc.$(SUF)
EMLIB = $(LIBDIR)/libem_mes.$(LIBSUF)
MODLIB = $(LIBDIR)/libinput.$(LIBSUF) \
$(LIBDIR)/libassert.$(LIBSUF) \
$(LIBDIR)/liballoc.$(LIBSUF) \
$(MALLOC) \
$(LIBDIR)/libflt.$(LIBSUF) \
$(LIBDIR)/libprint.$(LIBSUF) \
$(LIBDIR)/libstring.$(LIBSUF) \
$(LIBDIR)/libsystem.$(LIBSUF)
LIBS = $(EMLIB) $(MODLIB)
LINTLIBS = $(LINTLIBDIR)/$(LINTPREF)em_mes.$(LINTSUF) \
$(LINTLIBDIR)/$(LINTPREF)input.$(LINTSUF) \
$(LINTLIBDIR)/$(LINTPREF)assert.$(LINTSUF) \
$(LINTLIBDIR)/$(LINTPREF)alloc.$(LINTSUF) \
$(LINTLIBDIR)/$(LINTPREF)flt.$(LINTSUF) \
$(LINTLIBDIR)/$(LINTPREF)print.$(LINTSUF) \
$(LINTLIBDIR)/$(LINTPREF)string.$(LINTSUF) \
$(LINTLIBDIR)/$(LINTPREF)system.$(LINTSUF)
PROFILE =
INCLUDES = -I. -I$(SRC_DIR) -I$(TARGET_HOME)/modules/h -I$(TARGET_HOME)/h -I$(TARGET_HOME)/modules/pkg
CFLAGS = $(PROFILE) $(INCLUDES) $(COPTIONS)
LINTFLAGS = $(INCLUDES) $(LINTOPTIONS)
LDFLAGS = $(PROFILE) $(LDOPTIONS)
# C_SRC and OBJ should be set here.
#LISTS do not remove this line!
all: main
clean:
rm -f *.$(SUF) main
lint:
$(LINT) $(LINTFLAGS) $(C_SRC) $(LINTLIBS)
main: $(OBJ)
$(CC) $(LDFLAGS) $(OBJ) $(LIBS) -o main
# do not remove the next line; it is used for generating dependencies
#DEPENDENCIES

View file

@ -0,0 +1,269 @@
# $Header$
# make ANSI C compiler
#PARAMS do not remove this line!
UTIL_BIN = \
$(UTIL_HOME)/bin
LINT_DIR = \
$(SRC_HOME)/lang/cem/lint/lpass1.ansi
SRC_DIR = \
$(SRC_HOME)/lang/cem/cemcom.ansi
TABGEN= $(UTIL_BIN)/tabgen
LLGEN = $(UTIL_BIN)/LLgen
LLGENOPTIONS = \
-v
SRC_G = $(SRC_DIR)/program.g $(SRC_DIR)/declar.g \
$(SRC_DIR)/expression.g $(SRC_DIR)/statement.g $(SRC_DIR)/ival.g
GEN_G = tokenfile.g
GFILES= $(GEN_G) $(SRC_G)
SRC_C = \
$(SRC_DIR)/Version.c \
$(SRC_DIR)/LLlex.c \
$(SRC_DIR)/LLmessage.c \
$(SRC_DIR)/arith.c \
$(SRC_DIR)/blocks.c \
$(SRC_DIR)/ch3.c \
$(SRC_DIR)/ch3bin.c \
$(SRC_DIR)/ch3mon.c \
$(SRC_DIR)/code.c \
$(SRC_DIR)/conversion.c \
$(SRC_DIR)/cstoper.c \
$(SRC_DIR)/dataflow.c \
$(SRC_DIR)/declarator.c \
$(SRC_DIR)/decspecs.c \
$(SRC_DIR)/domacro.c \
$(SRC_DIR)/dumpidf.c \
$(SRC_DIR)/error.c \
$(SRC_DIR)/eval.c \
$(SRC_DIR)/expr.c \
$(SRC_DIR)/field.c \
$(SRC_DIR)/fltcstoper.c \
$(SRC_DIR)/idf.c \
$(SRC_DIR)/init.c \
$(SRC_DIR)/input.c \
$(SRC_DIR)/l_comment.c \
$(SRC_DIR)/l_ev_ord.c \
$(SRC_DIR)/l_lint.c \
$(SRC_DIR)/l_misc.c \
$(SRC_DIR)/l_outdef.c \
$(SRC_DIR)/l_states.c \
$(SRC_DIR)/label.c \
$(SRC_DIR)/main.c \
$(SRC_DIR)/options.c \
$(SRC_DIR)/pragma.c \
$(SRC_DIR)/proto.c \
$(SRC_DIR)/replace.c \
$(SRC_DIR)/skip.c \
$(SRC_DIR)/stab.c \
$(SRC_DIR)/stack.c \
$(SRC_DIR)/struct.c \
$(SRC_DIR)/switch.c \
$(SRC_DIR)/tokenname.c \
$(SRC_DIR)/type.c \
$(SRC_DIR)/util.c
GEN_C = tokenfile.c program.c declar.c expression.c statement.c ival.c \
symbol2str.c char.c Lpars.c next.c
CFILES= $(SRC_C) $(GEN_C)
SRC_H = \
$(SRC_DIR)/LLlex.h \
$(SRC_DIR)/align.h \
$(SRC_DIR)/arith.h \
$(SRC_DIR)/assert.h \
$(SRC_DIR)/atw.h \
$(SRC_DIR)/class.h \
$(SRC_DIR)/decspecs.h \
$(SRC_DIR)/file_info.h \
$(SRC_DIR)/input.h \
$(SRC_DIR)/interface.h \
$(SRC_DIR)/l_class.h \
$(SRC_DIR)/l_comment.h \
$(SRC_DIR)/l_em.h \
$(SRC_DIR)/l_lint.h \
$(SRC_DIR)/label.h \
$(SRC_DIR)/level.h \
$(SRC_DIR)/mes.h \
$(SRC_DIR)/sizes.h \
$(SRC_DIR)/specials.h \
$(SRC_DIR)/tokenname.h
GEN_H = botch_free.h dataflow.h debug.h density.h errout.h \
idfsize.h ifdepth.h inputtype.h macbuf.h lint.h \
nobitfield.h nopp.h nocross.h \
nparams.h numsize.h parbufsize.h pathlength.h Lpars.h \
strsize.h trgt_sizes.h textsize.h use_tmp.h spec_arith.h static.h \
regcount.h dbsymtab.h \
code.h declar.h def.h expr.h field.h estack.h util.h proto.h replace.h \
idf.h macro.h stmt.h struct.h switch.h type.h l_brace.h l_state.h \
l_outdef.h stack.h
HFILES= $(GEN_H) $(SRC_H)
NEXTFILES = \
$(SRC_DIR)/code.str \
$(SRC_DIR)/declar.str \
$(SRC_DIR)/def.str \
$(SRC_DIR)/expr.str \
$(SRC_DIR)/field.str \
$(SRC_DIR)/estack.str \
$(SRC_DIR)/util.str \
$(SRC_DIR)/proto.str \
$(SRC_DIR)/replace.str \
$(SRC_DIR)/idf.str \
$(SRC_DIR)/macro.str \
$(SRC_DIR)/stack.str \
$(SRC_DIR)/stmt.str \
$(SRC_DIR)/struct.str \
$(SRC_DIR)/switch.str \
$(SRC_DIR)/type.str \
$(SRC_DIR)/l_brace.str \
$(SRC_DIR)/l_state.str \
$(SRC_DIR)/l_outdef.str
all: make.main
make -f make.main main
install: all
@-mkdir $(TARGET_HOME)
@-mkdir $(TARGET_HOME)/lib.bin
@-mkdir $(TARGET_HOME)/lib.bin/lint
cp main $(TARGET_HOME)/lib.bin/lint/lpass1.ansi
cmp: all
-cmp main $(TARGET_HOME)/lib.bin/lint/lpass1.ansi
opr:
make pr | opr
pr:
@pr $(LINT_DIR)/proto.make $(LINT_DIR)/proto.main $(LINT_DIR)/Parameters \
$(SRC_DIR)/char.tab $(SRC_G) $(SRC_H) $(NEXTFILES) $(SRC_C)
lint: make.main
make -f make.main lint
Cfiles: hfiles LLfiles $(GEN_C) $(GEN_H) Makefile
echo $(CFILES) | tr ' ' '\012' > Cfiles
echo $(HFILES) | tr ' ' '\012' >> Cfiles
resolved: Cfiles
CC="$(CC)" UTIL_HOME="$(UTIL_HOME)" do_resolve `cat Cfiles` > Cfiles.new
-if cmp -s Cfiles Cfiles.new ; then rm -f Cfiles.new ; else mv Cfiles.new Cfiles ; fi
touch resolved
# there is no file called "dependencies"; we want dependencies checked
# every time. This means that make.main is made every time. Oh well ...
# it does not take much time.
dependencies: resolved
do_deps `grep '.c$$' Cfiles`
make.main: dependencies make_macros lists $(SRC_DIR)/proto.main
sed -e '/^#DEPENDENCIES/,$$d' -e '/^#PARAMS/r make_macros' -e '/^#LISTS/r lists' $(SRC_DIR)/proto.main > make.main
echo '#DEPENDENCIES' >> make.main
cat *.dep >> make.main
make_macros: Makefile
echo 'SRC_DIR=$(SRC_DIR)' > make_macros
echo 'UTIL_HOME=$(UTIL_HOME)' >> make_macros
echo 'TARGET_HOME=$(TARGET_HOME)' >> make_macros
echo 'CC=$(CC)' >> make_macros
echo 'COPTIONS=$(COPTIONS)' >> make_macros
echo 'LDOPTIONS=$(LDOPTIONS)' >> make_macros
echo 'LINT=$(LINT)' >> make_macros
echo 'LINTOPTIONS=$(LINTOPTIONS)' >> make_macros
echo 'SUF=$(SUF)' >> make_macros
echo 'LIBSUF=$(LIBSUF)' >> make_macros
echo 'CC_AND_MKDEP=$(CC_AND_MKDEP)' >> make_macros
lists: Cfiles
echo "C_SRC = \\" > lists
echo $(CFILES) >> lists
echo "OBJ = \\" >> lists
echo $(CFILES) | sed -e 's#[^ ]*/##g' -e 's/\.c/.$$(SUF)/g' >> lists
clean:
-make -f make.main clean
rm -f $(GEN_C) $(GEN_G) $(GEN_H) hfiles LLfiles Cfiles LL.output
rm -f resolved *.dep lists make.main make_macros
LLfiles: $(GFILES)
$(LLGEN) $(LLGENOPTIONS) $(GFILES)
@touch LLfiles
hfiles: $(LINT_DIR)/Parameters $(SRC_DIR)/make.hfiles
$(SRC_DIR)/make.hfiles $(LINT_DIR)/Parameters
touch hfiles
tokenfile.g: $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokfile
$(SRC_DIR)/make.tokfile <$(SRC_DIR)/tokenname.c >tokenfile.g
symbol2str.c: $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokcase
$(SRC_DIR)/make.tokcase <$(SRC_DIR)/tokenname.c >symbol2str.c
code.h: $(SRC_DIR)/code.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/code.str > code.h
declar.h: $(SRC_DIR)/declar.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/declar.str > declar.h
def.h: $(SRC_DIR)/def.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/def.str > def.h
expr.h: $(SRC_DIR)/expr.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/expr.str > expr.h
field.h: $(SRC_DIR)/field.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/field.str > field.h
estack.h: $(SRC_DIR)/estack.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/estack.str > estack.h
util.h: $(SRC_DIR)/util.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/util.str > util.h
proto.h: $(SRC_DIR)/proto.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/proto.str > proto.h
replace.h: $(SRC_DIR)/replace.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/replace.str > replace.h
idf.h: $(SRC_DIR)/idf.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/idf.str > idf.h
macro.h: $(SRC_DIR)/macro.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/macro.str > macro.h
stack.h: $(SRC_DIR)/stack.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/stack.str > stack.h
stmt.h: $(SRC_DIR)/stmt.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/stmt.str > stmt.h
struct.h: $(SRC_DIR)/struct.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/struct.str > struct.h
switch.h: $(SRC_DIR)/switch.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/switch.str > switch.h
type.h: $(SRC_DIR)/type.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/type.str > type.h
l_brace.h: $(SRC_DIR)/l_brace.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/l_brace.str > l_brace.h
l_state.h: $(SRC_DIR)/l_state.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/l_state.str > l_state.h
l_outdef.h: $(SRC_DIR)/l_outdef.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/l_outdef.str > l_outdef.h
next.c: $(NEXTFILES) $(SRC_DIR)/make.next
$(SRC_DIR)/make.next $(NEXTFILES) > next.c
char.c: $(SRC_DIR)/char.tab
$(TABGEN) -f$(SRC_DIR)/char.tab >char.c

View file

@ -0,0 +1,3 @@
Parameters
proto.main
proto.make

View file

@ -0,0 +1,146 @@
!File: lint.h
#define LINT 1 /* if defined, 'lint' is produced */
!File: pathlength.h
#define PATHLENGTH 1024 /* max. length of path to file */
!File: errout.h
#define ERROUT STDERR /* file pointer for writing messages */
#define ERR_SHADOW 0 /* a syntax error overshadows error messages
until ERR_SHADOW symbols have been
accepted without syntax error */
!File: idfsize.h
#define IDFSIZE 64 /* maximum significant length of an identifier */
!File: numsize.h
#define NUMSIZE 256 /* maximum length of a numeric constant */
!File: nparams.h
#define NPARAMS 32 /* maximum number of parameters of macros */
!File: ifdepth.h
#define IFDEPTH 256 /* maximum number of nested if-constructions */
!File: density.h
#define DENSITY 2 /* see switch.[ch] for an explanation */
!File: lapbuf.h
#define LAPBUF 4096 /* size of macro actual parameter buffer */
!File: strsize.h
#define ISTRSIZE 32 /* minimum number of bytes allocated for
storing a string */
#define RSTRSIZE 8 /* step size in enlarging the memory for
the storage of a string */
!File: target_sizes.h
#define MAXSIZE 8 /* the maximum of the SZ_* constants */
/* target machine sizes */
#define SZ_CHAR (arith)1
#define SZ_SHORT (arith)2
#define SZ_WORD (arith)4
#define SZ_INT (arith)4
#define SZ_LONG (arith)4
#ifndef NOFLOAT
#define SZ_FLOAT (arith)4
#define SZ_DOUBLE (arith)8
#endif NOFLOAT
#define SZ_POINTER (arith)4
/* target machine alignment requirements */
#define AL_CHAR 1
#define AL_SHORT SZ_SHORT
#define AL_WORD SZ_WORD
#define AL_INT SZ_WORD
#define AL_LONG SZ_WORD
#ifndef NOFLOAT
#define AL_FLOAT SZ_WORD
#define AL_DOUBLE SZ_WORD
#endif NOFLOAT
#define AL_POINTER SZ_WORD
#define AL_STRUCT 1
#define AL_UNION 1
!File: botch_free.h
#undef BOTCH_FREE 1 /* when defined, botch freed memory, as a check */
!File: dataflow.h
#undef DATAFLOW 1 /* produce some compile-time xref */
!File: debug.h
#undef DEBUG 1 /* perform various self-tests */
!File: use_tmp.h
#undef PREPEND_SCOPES 1 /* collect exa, exp, ina and inp commands
and if USE_TMP is defined let them
precede the rest of the generated
compact code */
#undef USE_TMP 1 /* use C_insertpart, C_endpart mechanism
to generate EM-code in the order needed
for the code-generators. If not defined,
the old-style peephole optimizer is
needed. */
!File: parbufsize.h
#define PARBUFSIZE 1024
!File: textsize.h
#define ITEXTSIZE 8 /* 1st piece of memory for repl. text */
#define RTEXTSIZE 8 /* stepsize for enlarging repl.text */
!File: inputtype.h
#define INP_READ_IN_ONE 1 /* read input file in one */
!File: nopp.h
#undef NOPP 1 /* if NOT defined, use built-int preprocessor */
!File: nobitfield.h
#undef NOBITFIELD 1 /* if NOT defined, implement bitfields */
!File: spec_arith.h
/* describes internal compiler arithmetics */
#undef SPECIAL_ARITHMETICS /* something different from native long */
!File: static.h
#define GSTATIC /* for large global "static" arrays */
!File: nofloat.h
#undef NOFLOAT 1 /* if NOT defined, floats are implemented */
!File: noRoption.h
#undef NOROPTION 1 /* if NOT defined, R option is implemented */
!File: nocross.h
#undef NOCROSS 1 /* if NOT defined, cross compiler */
!File: regcount.h
#undef REGCOUNT 1 /* count occurrences for register messages */

View file

@ -0,0 +1,59 @@
# $Header$
# C compilation part. Not to be called directly.
# Instead, it is to be called by the Makefile.
# SRC_DIR, UTIL_HOME, TARGET_HOME, CC, COPTIONS, LINT, LINTOPTIONS, LDOPTIONS,
# CC_AND_MKDEP, SUF, LIBSUF should be set here.
#PARAMS do not remove this line!
MDIR = $(TARGET_HOME)/modules
LIBDIR = $(MDIR)/lib
LINTLIBDIR = $(UTIL_HOME)/modules/lib
MALLOC = $(LIBDIR)/malloc.$(SUF)
EMLIB = $(LIBDIR)/libem_mes.$(LIBSUF)
MODLIB = $(LIBDIR)/libinput.$(LIBSUF) \
$(LIBDIR)/libassert.$(LIBSUF) \
$(LIBDIR)/liballoc.$(LIBSUF) \
$(MALLOC) \
$(LIBDIR)/libflt.$(LIBSUF) \
$(LIBDIR)/libprint.$(LIBSUF) \
$(LIBDIR)/libstring.$(LIBSUF) \
$(LIBDIR)/libsystem.$(LIBSUF)
LIBS = $(EMLIB) $(MODLIB)
LINTLIBS = $(LINTLIBDIR)/$(LINTPREF)em_mes.$(LINTSUF) \
$(LINTLIBDIR)/$(LINTPREF)input.$(LINTSUF) \
$(LINTLIBDIR)/$(LINTPREF)assert.$(LINTSUF) \
$(LINTLIBDIR)/$(LINTPREF)alloc.$(LINTSUF) \
$(LINTLIBDIR)/$(LINTPREF)flt.$(LINTSUF) \
$(LINTLIBDIR)/$(LINTPREF)print.$(LINTSUF) \
$(LINTLIBDIR)/$(LINTPREF)string.$(LINTSUF) \
$(LINTLIBDIR)/$(LINTPREF)system.$(LINTSUF)
PROFILE =
INCLUDES = -I. -I$(SRC_DIR) -I$(TARGET_HOME)/modules/h -I$(TARGET_HOME)/h -I$(TARGET_HOME)/modules/pkg
CFLAGS = $(PROFILE) $(INCLUDES) $(COPTIONS)
LINTFLAGS = $(INCLUDES) $(LINTOPTIONS)
LDFLAGS = $(PROFILE) $(LDOPTIONS)
# C_SRC and OBJ should be set here.
#LISTS do not remove this line!
all: main
clean:
rm -f *.$(SUF) main
lint:
$(LINT) $(LINTFLAGS) $(C_SRC) $(LINTLIBS)
main: $(OBJ)
$(CC) $(LDFLAGS) $(OBJ) $(LIBS) -o main
# do not remove the next line; it is used for generating dependencies
#DEPENDENCIES

View file

@ -0,0 +1,263 @@
# $Header$
# make C compiler
#PARAMS do not remove this line!
UTIL_BIN = \
$(UTIL_HOME)/bin
LINT_DIR = \
$(SRC_HOME)/lang/cem/lint/lpass1
SRC_DIR = \
$(SRC_HOME)/lang/cem/cemcom
TABGEN= $(UTIL_BIN)/tabgen
LLGEN = $(UTIL_BIN)/LLgen
LLGENOPTIONS = \
-v
SRC_G = $(SRC_DIR)/program.g $(SRC_DIR)/declar.g \
$(SRC_DIR)/expression.g $(SRC_DIR)/statement.g $(SRC_DIR)/ival.g
GEN_G = tokenfile.g
GFILES= $(GEN_G) $(SRC_G)
SRC_C = \
$(SRC_DIR)/Version.c \
$(SRC_DIR)/LLlex.c \
$(SRC_DIR)/LLmessage.c \
$(SRC_DIR)/arith.c \
$(SRC_DIR)/asm.c \
$(SRC_DIR)/blocks.c \
$(SRC_DIR)/ch7.c \
$(SRC_DIR)/ch7bin.c \
$(SRC_DIR)/ch7mon.c \
$(SRC_DIR)/code.c \
$(SRC_DIR)/conversion.c \
$(SRC_DIR)/cstoper.c \
$(SRC_DIR)/dataflow.c \
$(SRC_DIR)/declarator.c \
$(SRC_DIR)/decspecs.c \
$(SRC_DIR)/domacro.c \
$(SRC_DIR)/dumpidf.c \
$(SRC_DIR)/error.c \
$(SRC_DIR)/eval.c \
$(SRC_DIR)/expr.c \
$(SRC_DIR)/field.c \
$(SRC_DIR)/idf.c \
$(SRC_DIR)/init.c \
$(SRC_DIR)/input.c \
$(SRC_DIR)/l_comment.c \
$(SRC_DIR)/l_ev_ord.c \
$(SRC_DIR)/l_lint.c \
$(SRC_DIR)/l_misc.c \
$(SRC_DIR)/l_outdef.c \
$(SRC_DIR)/l_states.c \
$(SRC_DIR)/label.c \
$(SRC_DIR)/main.c \
$(SRC_DIR)/options.c \
$(SRC_DIR)/replace.c \
$(SRC_DIR)/scan.c \
$(SRC_DIR)/skip.c \
$(SRC_DIR)/stack.c \
$(SRC_DIR)/struct.c \
$(SRC_DIR)/switch.c \
$(SRC_DIR)/tokenname.c \
$(SRC_DIR)/type.c \
$(SRC_DIR)/util.c
GEN_C = tokenfile.c program.c declar.c expression.c statement.c ival.c \
symbol2str.c char.c Lpars.c next.c
CFILES= $(SRC_C) $(GEN_C)
SRC_H = \
$(SRC_DIR)/LLlex.h \
$(SRC_DIR)/align.h \
$(SRC_DIR)/arith.h \
$(SRC_DIR)/assert.h \
$(SRC_DIR)/atw.h \
$(SRC_DIR)/class.h \
$(SRC_DIR)/decspecs.h \
$(SRC_DIR)/file_info.h \
$(SRC_DIR)/input.h \
$(SRC_DIR)/interface.h \
$(SRC_DIR)/l_class.h \
$(SRC_DIR)/l_comment.h \
$(SRC_DIR)/l_em.h \
$(SRC_DIR)/l_lint.h \
$(SRC_DIR)/label.h \
$(SRC_DIR)/level.h \
$(SRC_DIR)/mes.h \
$(SRC_DIR)/sizes.h \
$(SRC_DIR)/specials.h \
$(SRC_DIR)/tokenname.h
GEN_H = botch_free.h dataflow.h debug.h density.h errout.h \
idfsize.h ifdepth.h inputtype.h lint.h \
nobitfield.h nopp.h nocross.h \
nparams.h numsize.h parbufsize.h pathlength.h Lpars.h \
strsize.h target_sizes.h textsize.h use_tmp.h spec_arith.h static.h \
regcount.h \
code.h declar.h decspecs.h def.h expr.h field.h estack.h util.h \
idf.h macro.h stmt.h struct.h switch.h type.h l_brace.h l_state.h \
l_outdef.h stack.h
HFILES= $(GEN_H) $(SRC_H)
NEXTFILES = \
$(SRC_DIR)/code.str \
$(SRC_DIR)/declar.str \
$(SRC_DIR)/decspecs.str \
$(SRC_DIR)/def.str \
$(SRC_DIR)/expr.str \
$(SRC_DIR)/field.str \
$(SRC_DIR)/estack.str \
$(SRC_DIR)/util.str \
$(SRC_DIR)/idf.str \
$(SRC_DIR)/macro.str \
$(SRC_DIR)/stack.str \
$(SRC_DIR)/stmt.str \
$(SRC_DIR)/struct.str \
$(SRC_DIR)/switch.str \
$(SRC_DIR)/type.str \
$(SRC_DIR)/l_brace.str \
$(SRC_DIR)/l_state.str \
$(SRC_DIR)/l_outdef.str
all: make.main
make -f make.main main
install: all
@-mkdir $(TARGET_HOME)
@-mkdir $(TARGET_HOME)/lib.bin
@-mkdir $(TARGET_HOME)/lib.bin/lint
cp main $(TARGET_HOME)/lib.bin/lint/lpass1
cmp: all
-cmp main $(TARGET_HOME)/lib.bin/lint/lpass1
opr:
make pr | opr
pr:
@pr $(LINT_DIR)/proto.make $(LINT_DIR)/proto.main $(LINT_DIR)/Parameters \
$(SRC_DIR)/char.tab $(SRC_G) $(SRC_H) $(NEXTFILES) $(SRC_C)
lint: make.main
make -f make.main lint
Cfiles: hfiles LLfiles $(GEN_C) $(GEN_H) Makefile
echo $(CFILES) | tr ' ' '\012' > Cfiles
echo $(HFILES) | tr ' ' '\012' >> Cfiles
resolved: Cfiles
CC="$(CC)" UTIL_HOME="$(UTIL_HOME)" do_resolve `cat Cfiles` > Cfiles.new
-if cmp -s Cfiles Cfiles.new ; then rm -f Cfiles.new ; else mv Cfiles.new Cfiles ; fi
touch resolved
# there is no file called "dependencies"; we want dependencies checked
# every time. This means that make.main is made every time. Oh well ...
# it does not take much time.
dependencies: resolved
do_deps `grep '.c$$' Cfiles`
make.main: dependencies make_macros lists $(SRC_DIR)/proto.main
sed -e '/^#DEPENDENCIES/,$$d' -e '/^#PARAMS/r make_macros' -e '/^#LISTS/r lists' $(SRC_DIR)/proto.main > make.main
echo '#DEPENDENCIES' >> make.main
cat *.dep >> make.main
make_macros: Makefile
echo 'SRC_DIR=$(SRC_DIR)' > make_macros
echo 'UTIL_HOME=$(UTIL_HOME)' >> make_macros
echo 'TARGET_HOME=$(TARGET_HOME)' >> make_macros
echo 'CC=$(CC)' >> make_macros
echo 'COPTIONS=$(COPTIONS)' >> make_macros
echo 'LDOPTIONS=$(LDOPTIONS)' >> make_macros
echo 'LINT=$(LINT)' >> make_macros
echo 'LINTOPTIONS=$(LINTOPTIONS)' >> make_macros
echo 'SUF=$(SUF)' >> make_macros
echo 'LIBSUF=$(LIBSUF)' >> make_macros
echo 'CC_AND_MKDEP=$(CC_AND_MKDEP)' >> make_macros
lists: Cfiles
echo "C_SRC = \\" > lists
echo $(CFILES) >> lists
echo "OBJ = \\" >> lists
echo $(CFILES) | sed -e 's#[^ ]*/##g' -e 's/\.c/.$$(SUF)/g' >> lists
clean:
-make -f make.main clean
rm -f $(GEN_C) $(GEN_G) $(GEN_H) hfiles LLfiles Cfiles LL.output
rm -f resolved *.dep lists make.main make_macros
LLfiles: $(GFILES)
$(LLGEN) $(LLGENOPTIONS) $(GFILES)
@touch LLfiles
hfiles: $(LINT_DIR)/Parameters $(SRC_DIR)/make.hfiles
$(SRC_DIR)/make.hfiles $(LINT_DIR)/Parameters
touch hfiles
tokenfile.g: $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokfile
$(SRC_DIR)/make.tokfile <$(SRC_DIR)/tokenname.c >tokenfile.g
symbol2str.c: $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokcase
$(SRC_DIR)/make.tokcase <$(SRC_DIR)/tokenname.c >symbol2str.c
code.h: $(SRC_DIR)/code.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/code.str > code.h
declar.h: $(SRC_DIR)/declar.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/declar.str > declar.h
def.h: $(SRC_DIR)/def.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/def.str > def.h
expr.h: $(SRC_DIR)/expr.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/expr.str > expr.h
field.h: $(SRC_DIR)/field.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/field.str > field.h
estack.h: $(SRC_DIR)/estack.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/estack.str > estack.h
util.h: $(SRC_DIR)/util.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/util.str > util.h
decspecs.h: $(SRC_DIR)/decspecs.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/decspecs.str > decspecs.h
idf.h: $(SRC_DIR)/idf.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/idf.str > idf.h
macro.h: $(SRC_DIR)/macro.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/macro.str > macro.h
stack.h: $(SRC_DIR)/stack.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/stack.str > stack.h
stmt.h: $(SRC_DIR)/stmt.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/stmt.str > stmt.h
struct.h: $(SRC_DIR)/struct.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/struct.str > struct.h
switch.h: $(SRC_DIR)/switch.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/switch.str > switch.h
type.h: $(SRC_DIR)/type.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/type.str > type.h
l_brace.h: $(SRC_DIR)/l_brace.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/l_brace.str > l_brace.h
l_state.h: $(SRC_DIR)/l_state.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/l_state.str > l_state.h
l_outdef.h: $(SRC_DIR)/l_outdef.str $(SRC_DIR)/make.allocd
$(SRC_DIR)/make.allocd < $(SRC_DIR)/l_outdef.str > l_outdef.h
next.c: $(NEXTFILES) $(SRC_DIR)/make.next
$(SRC_DIR)/make.next $(NEXTFILES) > next.c
char.c: $(SRC_DIR)/char.tab
$(TABGEN) -f$(SRC_DIR)/char.tab >char.c

11
lang/cem/lint/proto.make Normal file
View file

@ -0,0 +1,11 @@
# $Header$
#PARAMS do not remove this line!
DIRS = lpass1 lpass1.ansi lpass2 llib
all:
for i in $(DIRS) ; do cd $i ; make ; cd .. ; done
install:
for i in $(DIRS) ; do cd $i ; make install ; cd .. ; done