Procházet zdrojové kódy

New installation mechanism

ceriel před 33 roky
rodič
revize
3d30e413ee

+ 2 - 1
lang/basic/src/.distr

@@ -1,4 +1,5 @@
-Makefile
+proto.make
+proto.main
 basic.g
 basic.lex
 bem.c

+ 58 - 0
lang/basic/src/proto.main

@@ -0,0 +1,58 @@
+# $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)/liballoc.$(LIBSUF) \
+		$(MALLOC) \
+		$(LIBDIR)/libprint.$(LIBSUF) \
+		$(LIBDIR)/libstring.$(LIBSUF) \
+		$(LIBDIR)/libsystem.$(LIBSUF)
+
+LIBS =		$(EMLIB) $(MODLIB)
+
+LINTLIBS =	$(LINTLIBDIR)/$(LINTPREF)em_mes.$(LINTSUF) \
+		$(LINTLIBDIR)/$(LINTPREF)emk.$(LINTSUF) \
+		$(LINTLIBDIR)/$(LINTPREF)alloc.$(LINTSUF) \
+		$(LINTLIBDIR)/$(LINTPREF)print.$(LINTSUF) \
+		$(LINTLIBDIR)/$(LINTPREF)string.$(LINTSUF) \
+		$(LINTLIBDIR)/$(LINTPREF)system.$(LINTSUF)
+
+PROFILE =
+INCLUDES =	-I$(TARGET_HOME)/modules/h -I. -I$(SRC_DIR) -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

+ 115 - 0
lang/basic/src/proto.make

@@ -0,0 +1,115 @@
+# $Header$
+
+# make basic compiler
+
+#PARAMS		do not remove this line!
+
+UTIL_BIN = \
+	$(UTIL_HOME)/bin
+SRC_DIR = \
+	$(SRC_HOME)/lang/basic/src
+
+TABGEN=	$(UTIL_BIN)/tabgen
+LLGEN =	$(UTIL_BIN)/LLgen
+LLGENOPTIONS = \
+	-v
+
+SRC_G =	$(SRC_DIR)/basic.g
+GEN_G =
+GFILES=	$(GEN_G) $(SRC_G)
+
+SRC_C = \
+	$(SRC_DIR)/bem.c \
+	$(SRC_DIR)/symbols.c \
+	$(SRC_DIR)/initialize.c \
+	$(SRC_DIR)/compile.c \
+	$(SRC_DIR)/parsepar.c \
+	$(SRC_DIR)/gencode.c \
+	$(SRC_DIR)/util.c \
+	$(SRC_DIR)/graph.c \
+	$(SRC_DIR)/eval.c \
+	$(SRC_DIR)/func.c
+GEN_C =	basic.c Lpars.c
+CFILES=	$(SRC_C) $(GEN_C)
+
+SRC_H = \
+	$(SRC_DIR)/bem.h \
+	$(SRC_DIR)/symbols.h \
+	$(SRC_DIR)/graph.h \
+	$(SRC_DIR)/llmess.c \
+	$(SRC_DIR)/yylexp.c
+GEN_H = Lpars.h tokentab.h
+HFILES=	$(GEN_H) $(SRC_H)
+
+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_bem
+
+cmp:		all
+		-cmp main $(TARGET_HOME)/lib.bin/em_bem
+
+opr:
+		make pr | opr
+
+pr:
+		@pr $(SRC_DIR)/proto.make $(SRC_DIR)/proto.main \
+			$(SRC_DIR)/maketokentab $(SRC_DIR)/basic.lex \
+			$(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) $(GEN_L) LLfiles Cfiles LL.output
+		rm -f resolved *.dep lists make.main make_macros
+
+LLfiles:	$(GFILES)
+		$(LLGEN) $(LLGENOPTIONS) $(GFILES)
+		@touch LLfiles
+
+tokentab.h:	Lpars.h $(SRC_DIR)/maketokentab
+		$(SRC_DIR)/maketokentab

+ 2 - 1
lang/occam/comp/.distr

@@ -1,4 +1,5 @@
-Makefile
+proto.make
+proto.main
 builtin.c
 code.c
 code.h

+ 58 - 0
lang/occam/comp/proto.main

@@ -0,0 +1,58 @@
+# $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)/liballoc.$(LIBSUF) \
+		$(MALLOC) \
+		$(LIBDIR)/libprint.$(LIBSUF) \
+		$(LIBDIR)/libstring.$(LIBSUF) \
+		$(LIBDIR)/libsystem.$(LIBSUF)
+
+LIBS =		$(EMLIB) $(MODLIB)
+
+LINTLIBS =	$(LINTLIBDIR)/$(LINTPREF)em_mes.$(LINTSUF) \
+		$(LINTLIBDIR)/$(LINTPREF)emk.$(LINTSUF) \
+		$(LINTLIBDIR)/$(LINTPREF)alloc.$(LINTSUF) \
+		$(LINTLIBDIR)/$(LINTPREF)print.$(LINTSUF) \
+		$(LINTLIBDIR)/$(LINTPREF)string.$(LINTSUF) \
+		$(LINTLIBDIR)/$(LINTPREF)system.$(LINTSUF)
+
+PROFILE =
+INCLUDES =	-I$(TARGET_HOME)/modules/h -I. -I$(SRC_DIR) -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

+ 116 - 0
lang/occam/comp/proto.make

@@ -0,0 +1,116 @@
+# $Header$
+
+# make occam compiler
+
+#PARAMS		do not remove this line!
+
+UTIL_BIN = \
+	$(UTIL_HOME)/bin
+SRC_DIR = \
+	$(SRC_HOME)/lang/occam/comp
+
+TABGEN=	$(UTIL_BIN)/tabgen
+LLGEN =	$(UTIL_BIN)/LLgen
+LLGENOPTIONS = \
+	-v
+
+SRC_G =	$(SRC_DIR)/occam.g
+GEN_G =
+GFILES=	$(GEN_G) $(SRC_G)
+
+SRC_C = \
+	$(SRC_DIR)/builtin.c \
+	$(SRC_DIR)/code.c \
+	$(SRC_DIR)/em.c \
+	$(SRC_DIR)/expr.c \
+	$(SRC_DIR)/keytab.c \
+	$(SRC_DIR)/report.c \
+	$(SRC_DIR)/symtab.c
+GEN_C =	occam.c lex.yy.c Lpars.c
+CFILES=	$(SRC_C) $(GEN_C)
+
+SRC_H = \
+	$(SRC_DIR)/code.h \
+	$(SRC_DIR)/em.h \
+	$(SRC_DIR)/expr.h \
+	$(SRC_DIR)/sizes.h \
+	$(SRC_DIR)/symtab.h \
+	$(SRC_DIR)/token.h
+GEN_H = Lpars.h
+HFILES=	$(GEN_H) $(SRC_H)
+
+SRC_L =	$(SRC_DIR)/lex.l
+GEN_L =
+LFILES = $(SRC_L) $(GEN_L)
+
+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_occam
+
+cmp:		all
+		-cmp main $(TARGET_HOME)/lib.bin/em_occam
+
+opr:
+		make pr | opr
+
+pr:
+		@pr $(SRC_DIR)/proto.make $(SRC_DIR)/proto.main \
+			$(SRC_L) $(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) $(GEN_L) LLfiles Cfiles LL.output
+		rm -f resolved *.dep lists make.main make_macros
+
+LLfiles:	$(GFILES)
+		$(LLGEN) $(LLGENOPTIONS) $(GFILES)
+		@touch LLfiles
+
+lex.yy.c:	$(LFILES)
+		flex -s $(LFILES)