New installation mechanism

This commit is contained in:
ceriel 1991-08-26 12:04:28 +00:00
parent 216b8e5d98
commit 8fcbfada69
6 changed files with 391 additions and 2 deletions

View file

@ -1,7 +1,8 @@
LLlex.c
LLlex.h
LLmessage.c
Makefile
proto.make
proto.main
char.tab
class.h
declar.g

52
lang/m2/m2mm/proto.main Normal file
View file

@ -0,0 +1,52 @@
# $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)
MODLIB = $(LIBDIR)/libinput.$(LIBSUF) \
$(LIBDIR)/liballoc.$(LIBSUF) \
$(MALLOC) \
$(LIBDIR)/libprint.$(LIBSUF) \
$(LIBDIR)/libstring.$(LIBSUF) \
$(LIBDIR)/libsystem.$(LIBSUF)
LIBS = $(MODLIB)
LINTLIBS = $(LINTLIBDIR)/$(LINTPREF)input.$(LINTSUF) \
$(LINTLIBDIR)/$(LINTPREF)alloc.$(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)/config -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

116
lang/m2/m2mm/proto.make Normal file
View file

@ -0,0 +1,116 @@
# $Header$
# make Modula-2 makefile generator
#PARAMS do not remove this line!
UTIL_BIN = \
$(UTIL_HOME)/bin
SRC_DIR = \
$(SRC_HOME)/lang/m2/m2mm
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
GEN_G = tokenfile.g
GFILES= $(GEN_G) $(SRC_G)
SRC_C = $(SRC_DIR)/LLlex.c $(SRC_DIR)/LLmessage.c $(SRC_DIR)/error.c \
$(SRC_DIR)/main.c $(SRC_DIR)/lib.c $(SRC_DIR)/tokenname.c \
$(SRC_DIR)/idf.c $(SRC_DIR)/input.c $(SRC_DIR)/misc.c \
$(SRC_DIR)/options.c $(SRC_DIR)/Version.c
GEN_C = tokenfile.c program.c declar.c expression.c statement.c \
symbol2str.c char.c Lpars.c
CFILES= $(SRC_C) $(GEN_C)
SRC_H = $(SRC_DIR)/LLlex.h $(SRC_DIR)/class.h \
$(SRC_DIR)/f_info.h \
$(SRC_DIR)/idf.h $(SRC_DIR)/input.h $(SRC_DIR)/main.h \
$(SRC_DIR)/tokenname.h
GEN_H = Lpars.h
HFILES= $(GEN_H) $(SRC_H)
all: make.main
make -f make.main main
install: all
@-mkdir $(TARGET_HOME)
@-mkdir $(TARGET_HOME)/bin
cp main $(TARGET_HOME)/bin/m2mm
@-mkdir $(TARGET_HOME)/man
cp $(SRC_DIR)/m2mm.1 $(TARGET_HOME)/man/m2mm.1
cmp: all
-cmp main $(TARGET_HOME)/lib.bin/em_m2
-cmp $(SRC_DIR)/m2mm.1 $(TARGET_HOME)/man/m2mm.1
opr:
make pr | opr
pr:
@pr $(SRC_DIR)/proto.make $(SRC_DIR)/proto.main \
$(SRC_DIR)/char.tab $(SRC_G) $(SRC_H) $(SRC_C)
lint: make.main
make -f make.main lint
Cfiles: LLfiles $(GEN_C) $(GEN_H)
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) LLfiles Cfiles LL.output
rm -f resolved *.dep lists make.main make_macros
LLfiles: $(GFILES)
$(LLGEN) $(LLGENOPTIONS) $(GFILES)
@touch LLfiles
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
char.c: $(SRC_DIR)/char.tab
$(TABGEN) -f$(SRC_DIR)/char.tab >char.c

View file

@ -1,7 +1,8 @@
LLlex.c
LLlex.h
LLmessage.c
Makefile
proto.make
proto.main
Parameters
Resolve
Version.c

64
lang/pc/comp/proto.main Normal file
View file

@ -0,0 +1,64 @@
# $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!
# PRODUCE is either e (readable EM) or k (compact EM)
PRODUCE = k
MDIR = $(TARGET_HOME)/modules
LIBDIR = $(MDIR)/lib
LINTLIBDIR = $(UTIL_HOME)/modules/lib
MALLOC = $(LIBDIR)/malloc.$(SUF)
EMLIB = $(LIBDIR)/libem_mes.$(LIBSUF) \
$(LIBDIR)/libem$(PRODUCE).$(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)emk.$(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) -DSTATIC=static
LINTFLAGS = $(INCLUDES) $(LINTOPTIONS) -DNORCSID -DSTATIC=static
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

155
lang/pc/comp/proto.make Normal file
View file

@ -0,0 +1,155 @@
# $Header$
# make Pascal compiler
#PARAMS do not remove this line!
UTIL_BIN = \
$(UTIL_HOME)/bin
SRC_DIR = \
$(SRC_HOME)/lang/pc/comp
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
GEN_G = tokenfile.g
GFILES= $(GEN_G) $(SRC_G)
SRC_C = $(SRC_DIR)/LLlex.c $(SRC_DIR)/LLmessage.c $(SRC_DIR)/body.c \
$(SRC_DIR)/error.c $(SRC_DIR)/label.c $(SRC_DIR)/readwrite.c \
$(SRC_DIR)/main.c $(SRC_DIR)/tokenname.c $(SRC_DIR)/idf.c \
$(SRC_DIR)/input.c $(SRC_DIR)/type.c $(SRC_DIR)/def.c \
$(SRC_DIR)/misc.c $(SRC_DIR)/enter.c $(SRC_DIR)/progs.c \
$(SRC_DIR)/typequiv.c $(SRC_DIR)/node.c $(SRC_DIR)/cstoper.c \
$(SRC_DIR)/chk_expr.c $(SRC_DIR)/options.c $(SRC_DIR)/scope.c \
$(SRC_DIR)/desig.c $(SRC_DIR)/code.c $(SRC_DIR)/lookup.c \
$(SRC_DIR)/stab.c
GEN_C = tokenfile.c program.c declar.c expression.c statement.c \
symbol2str.c char.c Lpars.c casestat.c tmpvar.c next.c
CFILES= $(SRC_C) $(GEN_C)
SRC_H = $(SRC_DIR)/LLlex.h $(SRC_DIR)/chk_expr.h $(SRC_DIR)/class.h \
$(SRC_DIR)/const.h $(SRC_DIR)/debug.h $(SRC_DIR)/f_info.h \
$(SRC_DIR)/idf.h $(SRC_DIR)/input.h $(SRC_DIR)/main.h \
$(SRC_DIR)/misc.h $(SRC_DIR)/required.h $(SRC_DIR)/tokenname.h
GEN_H = errout.h idfsize.h numsize.h strsize.h target_sizes.h \
inputtype.h density.h nocross.h def.h debugcst.h \
type.h Lpars.h node.h dbsymtab.h scope.h desig.h
HFILES= $(GEN_H) $(SRC_H)
NEXTFILES = \
$(SRC_DIR)/def.H $(SRC_DIR)/type.H $(SRC_DIR)/node.H \
$(SRC_DIR)/scope.H $(SRC_DIR)/desig.H \
$(SRC_DIR)/tmpvar.C $(SRC_DIR)/casestat.C
all: make.main
make -f make.main main
install: all
@-mkdir $(TARGET_HOME)
@-mkdir $(TARGET_HOME)/lib.bin
cp main $(TARGET_HOME)/lib.bin/em_pc
cmp: all
-cmp main $(TARGET_HOME)/lib.bin/em_pc
opr:
make pr | opr
pr:
@pr $(SRC_DIR)/proto.make $(SRC_DIR)/proto.main 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: Parameters $(SRC_DIR)/make.hfiles
$(SRC_DIR)/make.hfiles 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
def.h: $(SRC_DIR)/make.allocd $(SRC_DIR)/def.H
$(SRC_DIR)/make.allocd < $(SRC_DIR)/def.H > def.h
type.h: $(SRC_DIR)/make.allocd $(SRC_DIR)/type.H
$(SRC_DIR)/make.allocd < $(SRC_DIR)/type.H > type.h
scope.h: $(SRC_DIR)/make.allocd $(SRC_DIR)/scope.H
$(SRC_DIR)/make.allocd < $(SRC_DIR)/scope.H > scope.h
node.h: $(SRC_DIR)/make.allocd $(SRC_DIR)/node.H
$(SRC_DIR)/make.allocd < $(SRC_DIR)/node.H > node.h
desig.h: $(SRC_DIR)/make.allocd $(SRC_DIR)/desig.H
$(SRC_DIR)/make.allocd < $(SRC_DIR)/desig.H > desig.h
tmpvar.c: $(SRC_DIR)/make.allocd $(SRC_DIR)/tmpvar.C
$(SRC_DIR)/make.allocd < $(SRC_DIR)/tmpvar.C > tmpvar.c
casestat.c: $(SRC_DIR)/make.allocd $(SRC_DIR)/casestat.C
$(SRC_DIR)/make.allocd < $(SRC_DIR)/casestat.C > casestat.c
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