First milestone of replacing the build system.
authorDavid Given <dg@cowlark.com>
Sun, 12 May 2013 19:45:55 +0000 (20:45 +0100)
committerDavid Given <dg@cowlark.com>
Sun, 12 May 2013 19:45:55 +0000 (20:45 +0100)
--HG--
branch : dtrg-buildsystem
rename : lang/cem/cpp.ansi/Parameters => lang/cem/cpp.ansi/parameters.h

119 files changed:
Makefile [new file with mode: 0644]
first/core.mk [new file with mode: 0644]
lang/cem/build.mk [new file with mode: 0644]
lang/cem/cemcom.ansi/LLlex.c
lang/cem/cemcom.ansi/LLlex.h
lang/cem/cemcom.ansi/LLmessage.c
lang/cem/cemcom.ansi/align.h
lang/cem/cemcom.ansi/arith.c
lang/cem/cemcom.ansi/arith.h
lang/cem/cemcom.ansi/assert.h
lang/cem/cemcom.ansi/blocks.c
lang/cem/cemcom.ansi/build.mk [new file with mode: 0644]
lang/cem/cemcom.ansi/ch3.c
lang/cem/cemcom.ansi/ch3bin.c
lang/cem/cemcom.ansi/ch3mon.c
lang/cem/cemcom.ansi/code.c
lang/cem/cemcom.ansi/conversion.c
lang/cem/cemcom.ansi/cstoper.c
lang/cem/cemcom.ansi/dataflow.c
lang/cem/cemcom.ansi/declar.g
lang/cem/cemcom.ansi/declarator.c
lang/cem/cemcom.ansi/def.str
lang/cem/cemcom.ansi/domacro.c
lang/cem/cemcom.ansi/dumpidf.c
lang/cem/cemcom.ansi/error.c
lang/cem/cemcom.ansi/eval.c
lang/cem/cemcom.ansi/expr.c
lang/cem/cemcom.ansi/expression.g
lang/cem/cemcom.ansi/field.c
lang/cem/cemcom.ansi/fltcstoper.c
lang/cem/cemcom.ansi/idf.c
lang/cem/cemcom.ansi/idf.str
lang/cem/cemcom.ansi/init.c
lang/cem/cemcom.ansi/input.c
lang/cem/cemcom.ansi/ival.g
lang/cem/cemcom.ansi/l_comment.c
lang/cem/cemcom.ansi/l_ev_ord.c
lang/cem/cemcom.ansi/l_lint.c
lang/cem/cemcom.ansi/l_misc.c
lang/cem/cemcom.ansi/l_outdef.c
lang/cem/cemcom.ansi/l_states.c
lang/cem/cemcom.ansi/label.c
lang/cem/cemcom.ansi/macro.str
lang/cem/cemcom.ansi/main.c
lang/cem/cemcom.ansi/make.next
lang/cem/cemcom.ansi/options.c
lang/cem/cemcom.ansi/pragma.c
lang/cem/cemcom.ansi/program.g
lang/cem/cemcom.ansi/proto.c
lang/cem/cemcom.ansi/replace.c
lang/cem/cemcom.ansi/sizes.h
lang/cem/cemcom.ansi/skip.c
lang/cem/cemcom.ansi/stab.c
lang/cem/cemcom.ansi/stack.c
lang/cem/cemcom.ansi/statement.g
lang/cem/cemcom.ansi/struct.c
lang/cem/cemcom.ansi/switch.c
lang/cem/cemcom.ansi/tokenname.c
lang/cem/cemcom.ansi/type.c
lang/cem/cemcom.ansi/type.str
lang/cem/cemcom.ansi/util.c
lang/cem/cemcom/eval.c
lang/cem/cemcom/replace.c
lang/cem/cpp.ansi/LLlex.c
lang/cem/cpp.ansi/bits.h
lang/cem/cpp.ansi/build.mk [new file with mode: 0644]
lang/cem/cpp.ansi/domacro.c
lang/cem/cpp.ansi/error.c
lang/cem/cpp.ansi/input.h
lang/cem/cpp.ansi/main.c
lang/cem/cpp.ansi/make.hfiles [deleted file]
lang/cem/cpp.ansi/options.c
lang/cem/cpp.ansi/parameters.h [moved from lang/cem/cpp.ansi/Parameters with 72% similarity]
lang/cem/cpp.ansi/preprocess.c
lang/cem/cpp.ansi/replace.c
lang/cem/libcc.ansi/build.mk [new file with mode: 0644]
lang/pc/comp/enter.c
lib/descr/fe
mach/proto/as/build.mk [new file with mode: 0644]
mach/proto/ncg/build.mk [new file with mode: 0644]
modules/src/alloc/build.mk [new file with mode: 0644]
modules/src/em_code/build.mk [new file with mode: 0644]
modules/src/em_code/insert.c
modules/src/em_mes/build.mk [new file with mode: 0644]
modules/src/flt_arith/build.mk [new file with mode: 0644]
modules/src/idf/build.mk [new file with mode: 0644]
modules/src/input/build.mk [new file with mode: 0644]
modules/src/object/build.mk [new file with mode: 0644]
modules/src/print/build.mk [new file with mode: 0644]
modules/src/string/build.mk [new file with mode: 0644]
modules/src/system/build.mk [new file with mode: 0644]
plat/build.mk [new file with mode: 0644]
plat/cpm/build.mk [new file with mode: 0644]
plat/cpm/descr
plat/cpm/libsys/build.mk [new file with mode: 0644]
plat/pc86/build.mk [new file with mode: 0644]
plat/pc86/descr
plat/pc86/libsys/build.mk [new file with mode: 0644]
util/LLgen/build.mk [new file with mode: 0644]
util/LLgen/src/compute.c
util/LLgen/src/gencode.c
util/LLgen/src/savegram.c
util/ack/build.mk [new file with mode: 0644]
util/ack/files.c
util/ack/grows.c
util/ack/list.c
util/ack/rmach.c
util/amisc/build.mk [new file with mode: 0644]
util/arch/build.mk [new file with mode: 0644]
util/cmisc/build.mk [new file with mode: 0644]
util/cpp/replace.c
util/data/build.mk [new file with mode: 0644]
util/ego/sr/sr.h
util/ncgg/build.mk [new file with mode: 0644]
util/ncgg/cgg.y
util/ncgg/scan.l
util/opt/build.mk [new file with mode: 0644]
util/opt/mktab.y
util/opt/scan.l

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..7c6371d
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,84 @@
+BUILDDIR = /tmp/obj
+OBJDIR = $(BUILDDIR)/obj
+BINDIR = $(BUILDDIR)/bin
+LIBDIR = $(BUILDDIR)/lib
+INCDIR = $(BUILDDIR)/include
+INSDIR = $(BUILDDIR)/staging
+
+PLATIND = $(INSDIR)/share/ack
+PLATDEP = $(INSDIR)/lib/ack
+
+CC = gcc
+AR = ar
+RM = rm -f
+CP = cp
+
+hide = @
+
+CFLAGS = \
+       -g \
+       -I$(INCDIR) \
+       -Imodules/h \
+       -Ih
+
+LDFLAGS =
+
+all: installables
+
+.DELETE_ON_ERROR:
+
+include first/core.mk
+
+include modules/src/object/build.mk
+include modules/src/alloc/build.mk
+include modules/src/input/build.mk
+include modules/src/idf/build.mk
+include modules/src/system/build.mk
+include modules/src/string/build.mk
+include modules/src/print/build.mk
+include modules/src/flt_arith/build.mk
+include modules/src/em_code/build.mk
+include modules/src/em_mes/build.mk
+
+include util/amisc/build.mk
+include util/cmisc/build.mk
+include util/ack/build.mk
+include util/LLgen/build.mk
+include util/data/build.mk
+include util/opt/build.mk
+include util/ncgg/build.mk
+include util/arch/build.mk
+
+include lang/cem/build.mk
+
+include mach/proto/as/build.mk
+include mach/proto/ncg/build.mk
+
+include plat/build.mk
+include plat/pc86/build.mk
+include plat/cpm/build.mk
+
+.PHONY: installables
+installables: $(INSTALLABLES)
+
+.PHONY: clean
+clean:
+       @echo CLEAN
+       $(hide) $(RM) $(CLEANABLES)
+
+$(INCDIR)/local.h:
+       @echo LOCAL
+       @mkdir -p $(dir $@)
+       $(hide) echo '#define VERSION 3' > $@
+       $(hide) echo '#define ACKM "pc86"' >> $@
+       $(hide) echo '#define BIGMACHINE 1' >> $@
+       $(hide) echo '#define SYS_5' >> $@
+
+$(INCDIR)/em_path.h:
+       @echo EM_PATH
+       @mkdir -p $(dir $@)
+       $(hide) echo '#define TMP_DIR "/tmp"' > $@
+       $(hide) echo '#define EM_DIR "/tmp/obj/staging"' >> $@
+       $(hide) echo '#define ACK_PATH "share/ack/descr"' >> $@
+
+-include $(DEPENDS)
diff --git a/first/core.mk b/first/core.mk
new file mode 100644 (file)
index 0000000..898cf0d
--- /dev/null
@@ -0,0 +1,199 @@
+define reset
+       $(eval q :=)
+       $(eval o :=)
+       $(eval s :=)
+       $(eval cflags :=)
+       $(eval ldflags :=)
+       $(eval objdir :=)
+endef
+
+# --- Host compiler
+
+define cfile-rule
+$o: $s
+       @echo CC $o
+       @mkdir -p $(dir $o)
+       @$(CC) $(CFLAGS) $(cflags) -MM -MQ $d -o $d $s
+       $(hide) $(CC) $(CFLAGS) $(cflags) -c -o $o $s
+endef
+
+define cfile
+       $(eval s := $1)
+       $(eval o := $(OBJDIR)/$(objdir)/$(1:.c=.o))
+       $(eval d := $(OBJDIR)/$(objdir)/$(1:.c=.d))
+       $(eval DEPENDS += $d)
+       $(eval CLEANABLES += $o $d)
+       $(eval q += $o)
+       $(eval $(cfile-rule))
+endef
+
+# --- ACK compiler
+
+define ackfile-rule
+$o: $s $(ACK) \
+               $(PLATIND)/descr/$(PLATFORM) \
+               $(PLATDEP)/$(PLATFORM)/as \
+               $(CCOMPILER) \
+               $(PLATFORM_$(PLATFORM))
+       @echo ACK $o
+       @mkdir -p $(dir $o)
+       $(hide) ACKDIR=$(INSDIR) $(ACK) $(ACKFLAGS) $(ackflags) -m$(PLATFORM) -c -o $o $s
+endef
+
+define ackfile
+       $(eval s := $1)
+       $(eval o := $(OBJDIR)/$(basename $1).o)
+       $(eval d := $(OBJDIR)/$(basename $1).d)
+       $(eval DEPENDS += $d)
+       $(eval CLEANABLES += $o $d)
+       $(eval q += $o)
+       $(eval $(ackfile-rule))
+endef
+
+# --- Add a raw to the queue
+
+define file
+       $(eval q += $1)
+endef
+
+# --- Host compiler linking
+
+define cprogram-rule
+$o: $s
+       @echo CPROGRAM $o
+       @mkdir -p $(dir $o)
+       $(hide) $(CC) $(CFLAGS) $(cflags) $(LDFLAGS) $(ldflags) -o $o $s
+endef
+
+define cprogram
+       $(eval o := $1)
+       $(eval s := $q)
+       $(eval CLEANABLES += $o)
+       $(eval q := $o)
+       $(eval $(cprogram-rule))
+endef
+
+# --- Host library linking
+
+define clibrary-rule
+$o: $s
+       @echo CLIBRARY $o
+       @mkdir -p $(dir $o)
+       @$(RM) $o
+       $(hide) $(AR) qsc $o $s
+endef
+
+define clibrary
+       $(eval o := $1)
+       $(eval s := $q)
+       $(eval CLEANABLES += $o)
+       $(eval q := $o)
+       $(eval $(clibrary-rule))
+endef
+
+# --- ACK library linking
+
+define acklibrary-rule
+$o: $s $(ACKAR)
+       @echo ACKLIBRARY $o
+       @mkdir -p $(dir $o)
+       @$(RM) $o
+       $(hide) $(AAL) q $o $s
+endef
+
+define acklibrary
+       $(eval o := $1)
+       $(eval s := $q)
+       $(eval CLEANABLES += $o)
+       $(eval q := $o)
+       $(eval $(acklibrary-rule))
+endef
+
+# --- Copies a file.
+
+define copyto-rule
+$o: $s
+       @echo CP $o
+       @mkdir -p $(dir $o)
+       $(hide) $(CP) $s $o
+endef
+
+define copyto
+       $(eval o := $1)
+       $(eval s := $q)
+       $(eval CLEANABLES += $o)
+       $(eval q := $o)
+       $(eval $(copyto-rule))
+endef
+
+# --- Installs a file (copies it and adds it to INSTALLABLES).
+
+define installto-rule
+$o: $s
+       @echo INSTALL $o
+       @mkdir -p $(dir $o)
+       $(hide) $(CP) $s $o
+endef
+
+define installto
+       $(eval o := $1)
+       $(eval s := $q)
+       $(eval CLEANABLES += $o)
+       $(eval INSTALLABLES += $o)
+       $(eval q := $o)
+       $(eval $(installto-rule))
+endef
+
+# --- Adds a dependency for the last object file
+
+define dependson
+       $(eval $o: $1)
+endef
+
+# --- Runs yacc.
+
+#  $1: directory to put output files
+#  $2: input files
+#
+# Output files are compiled via cfile and queued.
+
+define yacc-impl
+       $(eval o := $1/y.tab.c)
+       $(eval CLEANABLES += $o $1/y.tab.h)
+
+$o: $2
+       @echo YACC $o
+       @mkdir -p $(dir $o)
+       $(hide) yacc -t -b $1/y -d $2
+
+       $(call cfile, $o)
+
+$1/y.tab.h: $o
+
+endef
+
+yacc = $(eval $(call yacc-impl,$1,$2))
+
+# --- Runs flex.
+
+#  $1: directory to put output files
+#  $2: input files
+#
+# Output files are compiled via cfile and queued.
+
+define flex-impl
+
+$(eval o := $1/lex.yy.c)
+$(eval CLEANABLES += $o)
+
+$o: $2
+       @echo FLEX $o
+       @mkdir -p $(dir $o)
+       $(hide) flex -s -t $2 > $o
+
+$(call cfile, $o)
+
+endef
+
+flex = $(eval $(call flex-impl,$1,$2))
+
diff --git a/lang/cem/build.mk b/lang/cem/build.mk
new file mode 100644 (file)
index 0000000..23e0dba
--- /dev/null
@@ -0,0 +1,6 @@
+include lang/cem/cpp.ansi/build.mk
+include lang/cem/cemcom.ansi/build.mk
+include lang/cem/libcc.ansi/build.mk
+
+$(eval CCOMPILER := $(CPPANSI) $(CEMCOMANSI) $(LIBCCANSIHEADERS))
+
index 9736b44..07a79ad 100644 (file)
@@ -5,13 +5,8 @@
 /* $Id$ */
 /*                 L E X I C A L   A N A L Y Z E R                     */
 
-#include       "debug.h"
-#include       "lint.h"
 #include       <alloc.h>
-#include       "idfsize.h"
-#include       "numsize.h"
-#include       "strsize.h"
-#include       "nopp.h"
+#include    "parameters.h"
 #include       "input.h"
 #include       "arith.h"
 #include       "def.h"
index 7fb8829..90b0039 100644 (file)
@@ -11,7 +11,6 @@
 */
 
 #include "file_info.h"
-#include "nopp.h"
 
 /* the structure of a token:   */
 struct token   {
index c88c5eb..9010ce4 100644 (file)
@@ -6,7 +6,6 @@
 /*             PARSER ERROR ADMINISTRATION             */
 
 #include       <alloc.h>
-#include       "idf.h"
 #include       "arith.h"
 #include       "LLlex.h"
 #include       "Lpars.h"
index 1e4ee3f..79b9be9 100644 (file)
@@ -5,8 +5,7 @@
 /* $Id$ */
 /*      A L I G N M E N T   D E F I N I T I O N S      */
 
-#include "nocross.h"
-#include "trgt_sizes.h"
+#include "parameters.h"
 
 #ifndef NOCROSS
 extern int
index ed3dc50..d5f3af3 100644 (file)
        semantics of C is a mess.
 */
 
+#include    "parameters.h"
 #include       <alloc.h>
-#include       "debug.h"
-#include       "lint.h"
-#include       "nobitfield.h"
-#include       "idf.h"
 #include       <flt_arith.h>
 #include       "arith.h"
 #include       "sizes.h"
index 399e264..4bb4034 100644 (file)
@@ -13,7 +13,7 @@
        be handy.
 */
 
-#include       "spec_arith.h"
+#include       "parameters.h"
 
 #ifndef        SPECIAL_ARITHMETICS
 
index 2210f79..da650da 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
 /* $Id$ */
@@ -10,7 +11,8 @@
        there is no reasonable method to prove that a program is 100%
        correct, these assertions are needed in some places.
 */
-#include       "debug.h"       /* UF */
+
+#include       "parameters.h"
 
 #ifdef DEBUG
 /*     Note: this macro uses parameter substitution inside strings */
index 88c6a49..6d75a36 100644 (file)
@@ -5,7 +5,7 @@
 /* $Id$ */
 /*     B L O C K   S T O R I N G   A N D   L O A D I N G       */
 
-#include       "lint.h"
+#include       "parameters.h"
 #ifndef        LINT
 
 #include <em.h>
diff --git a/lang/cem/cemcom.ansi/build.mk b/lang/cem/cemcom.ansi/build.mk
new file mode 100644 (file)
index 0000000..f47959a
--- /dev/null
@@ -0,0 +1,156 @@
+D := lang/cem/cemcom.ansi
+
+define build-cemcom-ansi-allocd-header
+$(eval g := $(OBJDIR)/$D/$(strip $1).h)
+$g: $D/$(strip $1).str $D/make.allocd
+       @echo ALLOCD $$@
+       @mkdir -p $$(dir $$@)
+       $(hide) $D/make.allocd < $$^ > $$@
+
+$(eval CLEANABLES += $g)
+$(eval $q: $g)
+endef
+
+define build-cemcom-ansi-next
+$(eval CLEANABLES += $(OBJDIR)/$D/next.c)
+$(OBJDIR)/$D/next.c: $D/make.next $1
+       @echo NEXT $$@
+       @mkdir -p $$(dir $$@)
+       $(hide) $$^ > $$@
+$(call cfile, $(OBJDIR)/$D/next.c)
+
+$(foreach f, $1, $(call build-cemcom-ansi-allocd-header, \
+       $(basename $(notdir $f))))
+endef
+
+define build-cemcom-ansi-impl
+
+$(call reset)
+$(eval cflags += -I$(OBJDIR)/$D -I$D)
+
+$(call cfile, $D/arith.c)
+$(call dependson, $(INCDIR)/flt_arith.h)
+
+$(call cfile, $D/blocks.c)
+$(call dependson, $(INCDIR)/em_codeEK.h)
+
+$(call cfile, $D/LLlex.c)
+$(call cfile, $D/LLmessage.c)
+
+$(call cfile, $D/ch3.c)
+$(call cfile, $D/ch3bin.c)
+$(call cfile, $D/ch3mon.c)
+$(call cfile, $D/code.c)
+$(call cfile, $D/conversion.c)
+$(call cfile, $D/cstoper.c)
+$(call cfile, $D/dataflow.c)
+$(call cfile, $D/declarator.c)
+$(call cfile, $D/decspecs.c)
+$(call cfile, $D/domacro.c)
+$(call cfile, $D/dumpidf.c)
+$(call cfile, $D/error.c)
+$(call cfile, $D/eval.c)
+$(call cfile, $D/expr.c)
+$(call cfile, $D/field.c)
+$(call cfile, $D/fltcstoper.c)
+$(call cfile, $D/idf.c)
+$(call cfile, $D/init.c)
+$(call cfile, $D/input.c)
+$(call cfile, $D/l_comment.c)
+$(call cfile, $D/l_ev_ord.c)
+$(call cfile, $D/l_lint.c)
+$(call cfile, $D/l_misc.c)
+$(call cfile, $D/l_outdef.c)
+$(call cfile, $D/l_states.c)
+$(call cfile, $D/label.c)
+$(call cfile, $D/main.c)
+$(call cfile, $D/options.c)
+$(call cfile, $D/pragma.c)
+$(call cfile, $D/proto.c)
+$(call cfile, $D/replace.c)
+$(call cfile, $D/skip.c)
+$(call cfile, $D/stab.c)
+$(call cfile, $D/stack.c)
+$(call cfile, $D/struct.c)
+$(call cfile, $D/switch.c)
+$(call cfile, $D/tokenname.c)
+$(call cfile, $D/type.c)
+$(call cfile, $D/util.c)
+
+$(call llgen, $(OBJDIR)/$D, \
+       $(OBJDIR)/$D/tokenfile.g \
+       $D/program.g \
+       $D/declar.g \
+       $D/expression.g \
+       $D/statement.g \
+       $D/ival.g)
+
+$(eval CLEANABLES += $(OBJDIR)/$D/tokenfile.g)
+$(OBJDIR)/$D/tokenfile.g: $D/make.tokfile $D/tokenname.c
+       @echo TOKENFILE $$@
+       @mkdir -p $$(dir $$@)
+       $(hide) sh $D/make.tokfile < $D/tokenname.c > $$@
+
+$(call tabgen, $D/char.tab)
+
+$(eval $q: $(OBJDIR)/$D/parameters.h)
+
+$(eval CLEANABLES += $(OBJDIR)/$D/parameters.h)
+$(OBJDIR)/$D/parameters.h: $D/BigPars
+       @echo PARAMETERS $$@
+       @mkdir -p $$(dir $$@)
+       $(hide) echo '#ifndef PARAMETERS_H' > $$@
+       $(hide) echo '#define PARAMETERS_H' >> $$@
+       $(hide) grep -v '^!' < $D/BigPars >> $$@
+       $(hide) echo '#endif' >> $$@
+
+$(eval CLEANABLES += $(OBJDIR)/$D/symbol2str.c)
+$(OBJDIR)/$D/symbol2str.c: $D/make.tokcase $D/tokenname.c
+       @echo TOKCASE $$@
+       @mkdir -p $$(dir $$@)
+       $(hide) $D/make.tokcase < $D/tokenname.c > $$@
+$(call cfile, $(OBJDIR)/$D/symbol2str.c)
+
+$(call build-cemcom-ansi-next, \
+               $D/code.str \
+               $D/declar.str \
+               $D/def.str \
+               $D/expr.str \
+               $D/field.str \
+               $D/estack.str \
+               $D/util.str \
+               $D/proto.str \
+               $D/replace.str \
+               $D/idf.str \
+               $D/macro.str \
+               $D/stack.str \
+               $D/stmt.str \
+               $D/struct.str \
+               $D/switch.str \
+               $D/type.str \
+               $D/l_brace.str \
+               $D/l_state.str \
+               $D/l_outdef.str)
+
+$(eval $q: $(OBJDIR)/$D/Lpars.h)
+
+$(call file, $(LIBEM_MES))
+$(call file, $(LIBEMK))
+$(call file, $(LIBEM_DATA))
+$(call file, $(LIBINPUT))
+$(call file, $(LIBASSERT))
+$(call file, $(LIBALLOC))
+$(call file, $(LIBFLT_ARITH))
+$(call file, $(LIBPRINT))
+$(call file, $(LIBSYSTEM))
+$(call file, $(LIBSTRING))
+$(call cprogram, $(BINDIR)/cemcom.ansi)
+$(call installto, $(PLATDEP)/em_cemcom.ansi)
+$(eval CEMCOMANSI := $o)
+
+$(call reset)
+$(eval q := $D/cemcom.1)
+$(call installto, $(INSDIR)/share/man/man1/cemcom.6)
+endef
+
+$(eval $(build-cemcom-ansi-impl))
index 6270dfd..bebe77e 100644 (file)
@@ -5,12 +5,10 @@
 /* $Id$ */
 /*     S E M A N T I C   A N A L Y S I S -- C H A P T E R  3.3         */
 
-#include       "debug.h"
-#include       "lint.h"
-#include       "nobitfield.h"
-#include       "idf.h"
+#include       "parameters.h"
 #include       <flt_arith.h>
 #include       "arith.h"
+#include    "idf.h"
 #include       "proto.h"
 #include       "type.h"
 #include       "struct.h"
index cb30e10..8145b93 100644 (file)
@@ -5,11 +5,8 @@
 /* $Id$ */
 /* SEMANTIC ANALYSIS (CHAPTER 3.3)  --  BINARY OPERATORS */
 
-#include       "botch_free.h"
-#include       "debug.h"
+#include       "parameters.h"
 #include       <alloc.h>
-#include       "lint.h"
-#include       "idf.h"
 #include       <flt_arith.h>
 #include       "arith.h"
 #include       "type.h"
index 40cc440..8cffc2c 100644 (file)
@@ -5,17 +5,15 @@
 /* $Id$ */
 /* SEMANTIC ANALYSIS (CHAPTER 3.3) -- MONADIC OPERATORS */
 
-#include       "botch_free.h"
-#include       "debug.h"
+#include       "parameters.h"
 #include       <alloc.h>
-#include       "nobitfield.h"
 #include       "Lpars.h"
 #include       <flt_arith.h>
+#include    "idf.h"
 #include       "arith.h"
 #include       "type.h"
 #include       "label.h"
 #include       "expr.h"
-#include       "idf.h"
 #include       "def.h"
 #include       "sizes.h"
 
index 6289529..1beeb12 100644 (file)
@@ -7,23 +7,18 @@
 
 #include       <stdlib.h>
 #include       <string.h>
-#include       "lint.h"
-#include       "debug.h"
-#include       "dbsymtab.h"
+#include       "parameters.h"
 #ifndef        LINT
 #include       <em.h>
 #else
 #include       "l_em.h"
 #include       "l_lint.h"
 #endif /* LINT */
-#include       "botch_free.h"
 #include       <alloc.h>
-#include       "dataflow.h"
-#include       "use_tmp.h"
 #include       <flt_arith.h>
+#include    "idf.h"
 #include       "arith.h"
 #include       "type.h"
-#include       "idf.h"
 #include       "label.h"
 #include       "code.h"
 #include       "stmt.h"
index 6627a30..485d8b8 100644 (file)
@@ -5,7 +5,7 @@
 /* $Id$ */
 /*     C O N V E R S I O N - C O D E  G E N E R A T O R        */
 
-#include       "lint.h"
+#include       "parameters.h"
 #ifndef        LINT
 
 #include       <em.h>
index c86f122..ac11c2c 100644 (file)
@@ -5,8 +5,7 @@
 /* $Id$ */
 /*     C O N S T A N T   E X P R E S S I O N   H A N D L I N G         */
 
-#include       "trgt_sizes.h"
-#include       "idf.h"
+#include    "parameters.h"
 #include       <flt_arith.h>
 #include       "arith.h"
 #include       "type.h"
index e6f00ab..6a3fbcf 100644 (file)
@@ -9,7 +9,7 @@
        Use the compiler option --d.
 */
 
-#include       "dataflow.h"    /* UF */
+#include       "parameters.h"  /* UF */
 
 #ifdef DATAFLOW
 char *CurrentFunction = 0;
index 4322cbe..d6119f5 100644 (file)
@@ -6,17 +6,14 @@
 /*     DECLARATION SYNTAX PARSER       */
 
 {
-#include       "lint.h"
-#include       "dbsymtab.h"
+#include       "parameters.h"
 #include       <alloc.h>
-#include       "nobitfield.h"
-#include       "debug.h"
 #include       <flt_arith.h>
+#include    "idf.h"
 #include       "arith.h"
 #include       "LLlex.h"
 #include       "label.h"
 #include       "code.h"
-#include       "idf.h"
 #include       "type.h"
 #include       "proto.h"
 #include       "struct.h"
index 3d33a83..212b8ae 100644 (file)
@@ -5,8 +5,7 @@
 /* $Id$ */
 /*     D E C L A R A T O R   M A N I P U L A T I O N           */
 
-#include       "debug.h"
-#include       "botch_free.h"
+#include       "parameters.h"
 #include       <alloc.h>
 #include       <flt_arith.h>
 #include       "arith.h"
@@ -15,7 +14,6 @@
 #include       "Lpars.h"
 #include       "declar.h"
 #include       "def.h"
-#include       "idf.h"
 #include       "label.h"
 #include       "expr.h"
 #include       "sizes.h"
index adee486..0ad7af3 100644 (file)
@@ -5,7 +5,7 @@
 /* $Id$ */
 /* IDENTIFIER DEFINITION DESCRIPTOR */
 
-#include       "lint.h"
+#include       "parameters.h"
 
 struct def     {               /* for ordinary tags */
        struct def *next;
index f2ac213..4173a11 100644 (file)
@@ -5,29 +5,20 @@
 /* $Id$ */
 /* PREPROCESSOR: CONTROLLINE INTERPRETER */
 
-#include       "debug.h"
+#include    <stdlib.h>
+#include       "parameters.h"
+#include    "idf.h"
 #include       "arith.h"
 #include       "LLlex.h"
 #include       "Lpars.h"
-#include       "idf.h"
 #include       "input.h"
-#include       "nopp.h"
-#include       "lint.h"
+#include    "replace.h"
 
 #ifndef NOPP
-#include       "ifdepth.h"
-#include       "botch_free.h"
-#include       "nparams.h"
-#include       "parbufsize.h"
-#include       "textsize.h"
-#include       "idfsize.h"     
 #include       "assert.h"
 #include       <alloc.h>
 #include       "class.h"
 #include       "macro.h"
-#include       "macbuf.h"
-#include       "replace.h"
-#include       "dbsymtab.h"
 #ifdef DBSYMTAB
 #include       <stb.h>
 #include       <em.h>
index 18f425f..849354b 100644 (file)
@@ -5,16 +5,13 @@
 /* $Id$ */
 /*     DUMP ROUTINES   */
 
-#include       "debug.h"
 
 #ifdef DEBUG
+#include       "parameters.h"
 #include       <alloc.h>
-#include       "nopp.h"
-#include       "nobitfield.h"
 #include       <flt_arith.h>
 #include       "arith.h"
 #include       "stack.h"
-#include       "idf.h"
 #include       "def.h"
 #include       "type.h"
 #include       "proto.h"
index 4b92b32..10b237d 100644 (file)
@@ -5,7 +5,7 @@
 /* $Id$ */
 /*     E R R O R   A N D  D I A G N O S T I C   R O U T I N E S        */
 
-#include       "lint.h"
+#include       "parameters.h"
 #if __STDC__
 #include       <stdarg.h>
 #else
 #include       "l_em.h"
 #endif /* LINT */
 
-#include       "debug.h"
-#include       "lint.h"
-#include       "nopp.h"
-#include       "errout.h"
-
 #include       "tokenname.h"
 #include       <flt_arith.h>
 #include       "arith.h"
index 78a283c..16f19c0 100644 (file)
@@ -5,19 +5,16 @@
 /* $Id$ */
 /* EXPRESSION-CODE GENERATOR */
 
-#include       "lint.h"
+#include       "parameters.h"
 #ifndef        LINT
 
 #include       <em.h>
 #include       <em_reg.h>
 #include       <alloc.h>
-#include       "debug.h"
-#include       "nobitfield.h"
-#include       "dataflow.h"
 #include       <flt_arith.h>
+#include    "idf.h"
 #include       "arith.h"
 #include       "type.h"
-#include       "idf.h"
 #include       "label.h"
 #include       "code.h"
 #include       "assert.h"
@@ -41,7 +38,7 @@ arith NewLocal();     /* util.c */
 extern int     err_occurred; /* error.c */
 
 /*     EVAL() is the main expression-tree evaluator, which turns
-       any legal expression tree into EM code. Parameters:
+       any legal expression tree into EM code. parameters.h:
 
        struct expr *expr
                pointer to root of the expression tree to be evaluated
index 6f0eb2c..6d8c1e2 100644 (file)
@@ -5,13 +5,12 @@
 /* $Id$ */
 /* EXPRESSION TREE HANDLING */
 
-#include       "lint.h"
-#include       "debug.h"
+#include    <stdlib.h>
+#include       "parameters.h"
 #include       "assert.h"
-#include       "botch_free.h"
 #include       <alloc.h>
-#include       "idf.h"
 #include       <flt_arith.h>
+#include    "idf.h"
 #include       "arith.h"
 #include       "def.h"
 #include       "type.h"
@@ -23,7 +22,6 @@
 #include       "declar.h"
 #include       "sizes.h"
 #include       "level.h"
-#include       "use_tmp.h"
 
 extern char *symbol2str();
 extern char options[];
index e802812..3a1284e 100644 (file)
@@ -7,13 +7,11 @@
 
 {
 #include       <alloc.h>
-#include       "lint.h"
-#include       "debug.h"
+#include       "parameters.h"
 #include       <flt_arith.h>
 #include       "arith.h"
 #include       "LLlex.h"
 #include       "type.h"
-#include       "idf.h"
 #include       "label.h"
 #include       "expr.h"
 #include       "code.h"
index 3f8c07a..1514942 100644 (file)
@@ -5,19 +5,16 @@
 /* $Id$ */
 /*     BITFIELD EXPRESSION EVALUATOR   */
 
-#include       "lint.h"
+#include       "parameters.h"
 #ifndef        LINT
 
-#include       "nobitfield.h"
 
 #ifndef NOBITFIELD
 #include       <em.h>
 #include       <em_reg.h>
-#include       "debug.h"
 #include       <flt_arith.h>
 #include       "arith.h"
 #include       "type.h"
-#include       "idf.h"
 #include       "label.h"
 #include       "code.h"
 #include       "assert.h"
index 8ac330d..de4d26e 100644 (file)
@@ -6,11 +6,9 @@
 /*     C O N S T A N T   E X P R E S S I O N   H A N D L I N G         */
 /*       F O R   F L O A T I N G   P O I N T   N U M B E R S           */
 
-#include       "debug.h"
+#include       "parameters.h"
 #include       "assert.h"
 #include       <alloc.h>
-#include       "trgt_sizes.h"
-#include       "idf.h"
 #include       <flt_arith.h>
 #include       "arith.h"
 #include       "type.h"
index 56db5c2..eb43e34 100644 (file)
@@ -7,20 +7,15 @@
 
 #include       <stdlib.h>
 #include       <string.h>
-#include       "lint.h"
+#include       "parameters.h"
 #include       <em_reg.h>
-#include       "debug.h"
-#include       "idfsize.h"
-#include       "botch_free.h"
-#include       "nopp.h"
-#include       "nparams.h"
 #include       <alloc.h>
+#include    "idf.h"
 #include       "arith.h"
 #include       "align.h"
 #include       "LLlex.h"
 #include       "level.h"
 #include       "stack.h"
-#include       "idf.h"
 #include       "label.h"
 #include       "def.h"
 #include       "type.h"
index c4d01ea..fab9683 100644 (file)
@@ -5,7 +5,7 @@
 /* $Id$ */
 /* IDENTIFIER DESCRIPTOR */
 
-#include       "nopp.h"
+#include       "parameters.h"
 
 struct id_u {
 #ifndef NOPP
index d59b1de..bb1fd55 100644 (file)
@@ -7,15 +7,15 @@
 
 #include       <stdlib.h>
 #include       <string.h>
-#include       "nopp.h"
+#include       "parameters.h"
 
 #ifndef NOPP
 #include       <system.h>
 #include       <alloc.h>
 #include       <time.h>
+#include    "idf.h"
 #include       "class.h"
 #include       "macro.h"
-#include       "idf.h"
 
 extern char *sprint();
 
index e10aacb..fc1e99f 100644 (file)
@@ -4,10 +4,10 @@
  */
 /* $Id$ */
 
+#include "parameters.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include "inputtype.h"
 #include "file_info.h"
 #include "input.h"
 
 #define INP_TYPE       struct file_info
 #define INP_VAR                finfo
 struct file_info       finfo;
-#include "nopp.h"
 #include <inp_pkg.body>
 #include <alloc.h>
 
-#include        "dbsymtab.h"
-#include       "lint.h"
 #ifndef NOPP
 #ifdef DBSYMTAB
 #include <stb.h>
index 0304d75..b085ebc 100644 (file)
@@ -6,18 +6,18 @@
 /* CODE FOR THE INITIALISATION OF GLOBAL VARIABLES */
 
 {
-#include       "lint.h"
+#include    <stdlib.h>
+#include       "parameters.h"
 #ifndef        LINT
 #include       <em.h>
 #else
 #include       "l_em.h"
 #include       "l_lint.h"
 #endif /* LINT */
-#include       "debug.h"
 #include       <alloc.h>
 #include       <assert.h>
-#include       "nobitfield.h"
 #include       <flt_arith.h>
+#include    "idf.h"
 #include       "arith.h"
 #include       "label.h"
 #include       "expr.h"
 #include       "Lpars.h"
 #include       "sizes.h"
 #include       "align.h"
-#include       "idf.h"
 #include       "level.h"
 #include       "def.h"
 #include       "LLlex.h"
 #include       "estack.h"
+#include    "stack.h"
 
 #define con_nullbyte() C_con_ucon("0", (arith)1)
 #define aggregate_type(tp) ((tp)->tp_fund == ARRAY || (tp)->tp_fund == STRUCT)
index da9d2b7..2ab983a 100644 (file)
@@ -5,10 +5,9 @@
 /* $Id$ */
 /*     Lint-specific comment handling  */
 
+#include       "parameters.h"
 #include       <ctype.h>
 
-#include       "lint.h"
-
 #ifdef LINT
 
 #include       <alloc.h>
index 56515eb..c5d7550 100644 (file)
@@ -5,7 +5,7 @@
 /* $Id$ */
 /*     Lint evaluation order checking  */
 
-#include       "lint.h"
+#include       "parameters.h"
 
 #ifdef LINT
 
@@ -18,7 +18,6 @@
 #include       "arith.h"       /* definition arith */
 #include       "label.h"       /* definition label */
 #include       "expr.h"
-#include       "idf.h"
 #include       "def.h"
 #include       "code.h"        /* RVAL etc */
 #include       "LLlex.h"
index 497d7bd..5f95cb0 100644 (file)
@@ -5,12 +5,11 @@
 /* $Id$ */
 /*     Lint main routines      */
 
-#include       "lint.h"
+#include       "parameters.h"
 
 #ifdef LINT
 
 #include       <alloc.h>       /* for st_free */
-#include       "debug.h"
 #include       "interface.h"
 #include       "assert.h"
 #ifdef ANSI
@@ -19,7 +18,6 @@
 #include       "arith.h"       /* definition arith */
 #include       "label.h"       /* definition label */
 #include       "expr.h"
-#include       "idf.h"
 #include       "def.h"
 #include       "code.h"        /* RVAL etc */
 #include       "LLlex.h"
index 5e8cd08..c09c84b 100644 (file)
@@ -5,7 +5,7 @@
 /* $Id$ */
 /*     Lint miscellaneous routines     */
 
-#include       "lint.h"
+#include       "parameters.h"
 
 #ifdef LINT
 
@@ -17,7 +17,6 @@
 #include       "arith.h"       /* definition arith */
 #include       "label.h"       /* definition label */
 #include       "expr.h"
-#include       "idf.h"
 #include       "def.h"
 #include       "code.h"        /* RVAL etc */
 #include       "LLlex.h"
index a88945f..32e2172 100644 (file)
@@ -5,7 +5,7 @@
 /* $Id$ */
 /*     Lint outdef construction        */
 
-#include       "lint.h"
+#include       "parameters.h"
 
 #ifdef LINT
 
@@ -26,7 +26,6 @@
 #include       "def.h"
 #include       "struct.h"
 #include       "field.h"
-#include       "idf.h"
 #include       "level.h"
 #include       "label.h"
 #include       "code.h"
index 99e1a49..74d31b3 100644 (file)
@@ -5,21 +5,19 @@
 /* $Id$ */
 /*     Lint status checking    */
 
-#include       "lint.h"
+#include       "parameters.h"
 
 #ifdef LINT
 
 #include       <alloc.h>       /* for st_free */
 #include       "interface.h"
 #include       "assert.h"
-#include       "debug.h"
 #ifdef ANSI
 #include       <flt_arith.h>
 #endif /* ANSI */
 #include       "arith.h"
 #include       "label.h"
 #include       "expr.h"
-#include       "idf.h"
 #include       "def.h"
 #include       "code.h"        /* RVAL etc */
 #include       "LLlex.h"
index 6430004..fb20095 100644 (file)
@@ -5,9 +5,10 @@
 /* $Id$ */
 /*             L A B E L   H A N D L I N G             */
 
+#include    "parameters.h"
+#include    "idf.h"
 #include       "Lpars.h"
 #include       "level.h"
-#include       "idf.h"
 #include       "label.h"
 #include       "arith.h"
 #include       "def.h"
index 1414741..f229cac 100644 (file)
@@ -5,7 +5,7 @@
 /* $Id$ */
 /* PREPROCESSOR: DEFINITION OF MACRO DESCRIPTOR */
 
-#include       "nopp.h"
+#include       "parameters.h"
 
 #ifndef NOPP
 /*     The flags of the mc_flag field of the macro structure. Note that
index 4f56feb..556e234 100644 (file)
@@ -5,16 +5,11 @@
 /* $Id$ */
 /* MAIN PROGRAM */
 
-#include       "lint.h"
+#include       "parameters.h"
 #include       <system.h>
-#include       "debug.h"
-#include       "nopp.h"
-#include       "trgt_sizes.h"
-#include       "use_tmp.h"
-#include       "inputtype.h"
+#include    "idf.h"
 #include       "input.h"
 #include       "level.h"
-#include       "idf.h"
 #include       "arith.h"
 #include       "type.h"
 #include       "proto.h"
@@ -24,7 +19,6 @@
 #include       "LLlex.h"
 #include       <alloc.h>
 #include       "specials.h"
-#include       "nocross.h"
 #include       "sizes.h"
 #include       "align.h"
 #include       "macro.h"
index 26c24d0..06d50f0 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-echo '#include "debug.h"'
+echo '#include "parameters.h"'
 sed -n '
 s:^.*ALLOCDEF.*"\(.*\)".*$:struct \1 *h_\1 = 0;\
 #ifdef DEBUG\
index 379c7c6..a8f3823 100644 (file)
@@ -5,23 +5,15 @@
 /* $Id$ */
 /*     U S E R   O P T I O N - H A N D L I N G         */
 
+#include       "parameters.h"
 #include       <stdlib.h>
 #include       <string.h>
-#include       "lint.h"
-#include       "botch_free.h"
 #include       <alloc.h>
-#include       "nopp.h"
-#include       "idfsize.h"
-#include       "nobitfield.h"
 #include       "class.h"
 #include       "macro.h"
-#include       "idf.h"
 #include       "arith.h"
 #include       "sizes.h"
 #include       "align.h"
-#include       "use_tmp.h"
-#include       "dataflow.h"
-#include       "dbsymtab.h"
 
 #ifndef NOPP
 extern char **inctable;
index 92739dd..b4198d9 100644 (file)
@@ -5,8 +5,7 @@
 /* $Id$ */
 /* PREPROCESSOR: PRAGMA INTERPRETER */
 
-#include       "debug.h"
-#include       "idf.h"
+#include       "parameters.h"
 
 #define P_UNKNOWN      0
 #define NR_PRAGMAS     0
index 937effa..861c97b 100644 (file)
 %start         If_expr, control_if_expression;
 
 {
-#include       "lint.h"
-#include       "nopp.h"
-#include       "debug.h"
+#include       "parameters.h"
 #include       <flt_arith.h>
 #include       "arith.h"
 #include       "LLlex.h"
-#include       "idf.h"
 #include       "label.h"
 #include       "type.h"
 #include       "declar.h"
@@ -59,6 +56,7 @@
 #include       "code.h"
 #include       "expr.h"
 #include       "def.h"
+#include    "stack.h"
 #ifdef LINT
 #include       "l_lint.h"
 #endif /* LINT */
index e1ff73a..1f7f6bf 100644 (file)
@@ -5,19 +5,15 @@
 /* $Id$ */
 /*  P R O T O T Y P E   F I D D L I N G  */
 
-#include       "lint.h"
-#include       "debug.h"
-#include       "idfsize.h"
-#include       "nparams.h"
-#include       "botch_free.h"
+#include       "parameters.h"
 #include       <alloc.h>
+#include    "idf.h"
 #include       "Lpars.h"
 #include       "level.h"
 #include       <flt_arith.h>
 #include       "arith.h"
 #include       "align.h"
 #include       "stack.h"
-#include       "idf.h"
 #include       "def.h"
 #include       "type.h"
 #include       "struct.h"
index 856c38d..cde3aaf 100644 (file)
@@ -7,26 +7,18 @@
 
 #include       <stdlib.h>
 #include       <string.h>
-#include       "nopp.h"
+#include       "parameters.h"
 
 #ifndef NOPP
 
-#include       "debug.h"
-#include       "pathlength.h"
-#include       "strsize.h"
-#include       "nparams.h"
-#include       "idfsize.h"
-#include       "numsize.h"
 #include       <alloc.h>
-#include       "idf.h"
+#include    "idf.h"
 #include       "input.h"
 #include       "macro.h"
 #include       "arith.h"
 #include       "LLlex.h"
 #include       "class.h"
 #include       "assert.h"
-#include       "static.h"
-#include       "macbuf.h"
 #include       "replace.h"
 
 extern struct idf *GetIdentifier();
index 69785fd..0f38c56 100644 (file)
@@ -5,8 +5,7 @@
 /* $Id$ */
 /* VARIOUS TARGET MACHINE SIZE DESCRIPTORS */
 
-#include "nocross.h"
-#include "trgt_sizes.h"
+#include "parameters.h"
 
 #ifndef NOCROSS
 extern arith
index c3687fd..d4a6714 100644 (file)
@@ -5,7 +5,7 @@
 /* $Id$ */
 /* PREPROCESSOR: INPUT SKIP FUNCTIONS */
 
-#include       "nopp.h"
+#include       "parameters.h"
 #include       "arith.h"
 #include       "LLlex.h"
 #include       "class.h"
index 401d91b..8c00838 100644 (file)
@@ -9,7 +9,7 @@
 
 /* $Id$ */
 
-#include       "dbsymtab.h"
+#include       "parameters.h"
 
 #ifdef DBSYMTAB
 
 #include       <flt_arith.h>
 #include       <stb.h>
 
+#include    "idf.h"
 #include       "LLlex.h"
 #include       "stack.h"
 #include       "def.h"
 #include       "type.h"
 #include       "struct.h"
 #include       "field.h"
-#include       "idf.h"
 #include       "Lpars.h"
 #include       "level.h"
 
index b0cf97c..49dfbfa 100644 (file)
@@ -5,21 +5,19 @@
 /* $Id$ */
 /*     S T A C K / U N S T A C K  R O U T I N E S      */
 
-#include       "lint.h"
+#include       "parameters.h"
 #include       <system.h>
 #ifndef        LINT
 #include       <em.h>
 #else
 #include       "l_em.h"
 #endif /* LINT */
-#include       "debug.h"
-#include       "botch_free.h"
 #include       <alloc.h>
+#include    "idf.h"
 #include       "Lpars.h"
 #include       "arith.h"
 #include       "stack.h"
 #include       "type.h"
-#include       "idf.h"
 #include       "def.h"
 #include       "struct.h"
 #include       "level.h"
index 97fd969..9eb60d2 100644 (file)
@@ -6,7 +6,7 @@
 /*     STATEMENT SYNTAX PARSER */
 
 {
-#include       "lint.h"
+#include       "parameters.h"
 #ifndef        LINT
 #include       <em.h>
 #else
 #include       "l_lint.h"
 #endif /* LINT */
 
-#include       "debug.h"
-#include       "botch_free.h"
-#include       "dbsymtab.h"
-
 #include       <flt_arith.h>
+#include    "idf.h"
 #include       "arith.h"
 #include       "LLlex.h"
 #include       "type.h"
-#include       "idf.h"
 #include       "label.h"
 #include       "expr.h"
 #include       "code.h"
index 805df0b..505107c 100644 (file)
@@ -5,13 +5,11 @@
 /* $Id$ */
 /*     ADMINISTRATION OF STRUCT AND UNION DECLARATIONS */
 
-#include       "nobitfield.h"
-#include       "debug.h"
-#include       "botch_free.h"
+#include       "parameters.h"
 #include       <alloc.h>
+#include    "idf.h"
 #include       "arith.h"
 #include       "stack.h"
-#include       "idf.h"
 #include       "def.h"
 #include       "type.h"
 #include       "proto.h"
index 59413f6..856e1b1 100644 (file)
@@ -5,18 +5,14 @@
 /* $Id$ */
 /*     S W I T C H - S T A T E M E N T  A D M I N I S T R A T I O N    */
 
-#include       "lint.h"
+#include       "parameters.h"
 #ifndef        LINT
 #include       <em.h>
 #else
 #include       "l_em.h"
 #endif /* LINT */
-#include       "debug.h"
-#include       "botch_free.h"
 #include       <alloc.h>
-#include       "density.h"
 #include       "Lpars.h"
-#include       "idf.h"
 #include       "label.h"
 #include       <flt_arith.h>
 #include       "arith.h"
index 75e5931..8c52b4d 100644 (file)
@@ -5,7 +5,8 @@
 /* $Id$ */
 /* TOKEN NAME DEFINITIONS */
 
-#include       "idf.h"
+#include       "parameters.h"
+#include    "idf.h"
 #include       "arith.h"
 #include       "LLlex.h"
 #include       "tokenname.h"
index ef0d2cd..2b477a7 100644 (file)
@@ -5,14 +5,12 @@
 /* $Id$ */
 /*     T Y P E   D E F I N I T I O N   M E C H A N I S M        */
 
-#include       "nobitfield.h"
-#include       "debug.h"
-#include       "botch_free.h"
+#include       "parameters.h"
 #include       <alloc.h>
+#include    "idf.h"
 #include       "Lpars.h"
 #include       "arith.h"
 #include       "type.h"
-#include       "idf.h"
 #include       "def.h"
 #include       "proto.h"
 #include       "sizes.h"
index c1c6205..8796d61 100644 (file)
@@ -5,8 +5,7 @@
 /* $Id$ */
 /* TYPE DESCRIPTOR */
 
-#include       "nobitfield.h"
-#include       "dbsymtab.h"
+#include       "parameters.h"
 
 struct type    {
        struct type *next;      /* used for ARRAY and for qualifiers */
index 9b9d115..7326f04 100644 (file)
@@ -11,7 +11,7 @@
        allowing re-use.
 */
 
-#include       "lint.h"
+#include       "parameters.h"
 #ifndef        LINT
 #include       <em.h>
 #else
 #include       <alloc.h>
 #include       <em_mes.h>
 
-#include       "debug.h"
 #include       "util.h"
-#include       "use_tmp.h"
-#include       "regcount.h"
 #include       "sizes.h"
 #include       "align.h"
 #include       "stack.h"
index abfc1a2..542980d 100644 (file)
@@ -39,7 +39,7 @@ arith NewLocal();     /* util.c */
 #define LocalPtrVar()  NewLocal(pointer_size, pointer_align, reg_pointer, REGISTER)
 
 /*     EVAL() is the main expression-tree evaluator, which turns
-       any legal expression tree into EM code. Parameters:
+       any legal expression tree into EM code. parameters.h:
 
        struct expr *expr
                pointer to root of the expression tree to be evaluated
index 15f9c1d..758d14d 100644 (file)
@@ -70,7 +70,7 @@ replace(idef)
                                return 0;
                }
                if (++mac->mc_count > 100) {
-                       /* 100 must be some number in Parameters */
+                       /* 100 must be some number in parameters.h */
                        lexwarning("macro %s is assumed recursive",
                                    idef->id_text);
                        return 0;
index e828ac7..3cd1628 100644 (file)
@@ -5,9 +5,7 @@
 /* $Id$ */
 /*                 L E X I C A L   A N A L Y Z E R                     */
 
-#include       "idfsize.h"
-#include       "numsize.h"
-#include       "strsize.h"
+#include       "parameters.h"
 
 #include       <alloc.h>
 #include       "input.h"
index 95eb2f3..7473d93 100644 (file)
@@ -3,7 +3,7 @@
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
 /* $Id$ */
-#include "dobits.h"
+#include "parameters.h"
 #ifdef DOBITS
 #define bit0   0x01
 #define bit1   0x02
diff --git a/lang/cem/cpp.ansi/build.mk b/lang/cem/cpp.ansi/build.mk
new file mode 100644 (file)
index 0000000..e102c52
--- /dev/null
@@ -0,0 +1,104 @@
+D := lang/cem/cpp.ansi
+
+define build-cpp-ansi-allocd-header
+$1: $2 $D/make.allocd
+       @echo ALLOCD $1
+       @mkdir -p $(dir $1)
+       $(hide) $D/make.allocd < $2 > $1
+
+$(eval CLEANABLES += $1)
+endef
+
+define build-cpp-ansi-tokfile
+$(OBJDIR)/$D/tokenfile.g: $D/make.tokfile $D/tokenname.c
+       @echo TOKENFILE $$@
+       @mkdir -p $$(dir $$@)
+       $(hide) sh $D/make.tokfile < $D/tokenname.c > $$@
+
+$(eval CLEANABLES += $(OBJDIR)/$D/tokenfile.g)
+endef
+
+define build-cpp-ansi-tokcase
+$(OBJDIR)/$D/symbol2str.c: $D/make.tokcase $D/tokenname.c
+       @echo TOKCASE $$@
+       @mkdir -p $$(dir $$@)
+       $(hide) sh $D/make.tokcase < $D/tokenname.c > $$@
+
+$(eval CLEANABLES += $(OBJDIR)/$D/symbol2str.c)
+endef
+
+define build-cpp-ansi-next
+$(OBJDIR)/$D/next.c: $D/make.next $D/macro.str $D/replace.str
+       @echo NEXT $$@
+       @mkdir -p $$(dir $$@)
+       $(hide) sh $D/make.next $D/macro.str $D/replace.str > $$@
+
+$(eval CLEANABLES += $(OBJDIR)/$D/next.c)
+endef
+
+define build-cpp-ansi-impl
+       $(eval $(call build-cpp-ansi-next))
+       $(eval $(call build-cpp-ansi-tokcase))
+       $(eval $(call build-cpp-ansi-tokfile))
+       $(eval $(call build-cpp-ansi-allocd-header, \
+           $(OBJDIR)/$D/macro.h, $D/macro.str \
+       ))
+       $(eval $(call build-cpp-ansi-allocd-header, \
+           $(OBJDIR)/$D/replace.h, $D/replace.str \
+       ))
+
+       $(call reset)
+       $(eval cflags += -I$(OBJDIR)/$D -I$D)
+
+       $(call cfile, $D/LLlex.c)
+       $(call cfile, $D/LLmessage.c)
+       $(call cfile, $D/ch3bin.c)
+       $(call cfile, $D/ch3mon.c)
+       $(call cfile, $D/domacro.c)
+       $(call cfile, $D/error.c)
+       $(call cfile, $D/idf.c)
+       $(call cfile, $D/init.c)
+       $(call cfile, $D/input.c)
+       $(call cfile, $D/main.c)
+       $(call cfile, $D/options.c)
+       $(call cfile, $D/preprocess.c)
+       $(call cfile, $D/replace.c)
+       $(call cfile, $D/skip.c)
+       $(call cfile, $D/tokenname.c)
+       $(call cfile, $D/expr.c)
+       $(call cfile, $(OBJDIR)/$D/symbol2str.c)
+       $(call cfile, $(OBJDIR)/$D/next.c)
+
+       $(call llgen, $(OBJDIR)/$D, $(OBJDIR)/$D/tokenfile.g $D/expression.g)
+
+       $(call file, $(LIBINPUT))
+       $(call file, $(LIBASSERT))
+       $(call file, $(LIBALLOC))
+       $(call file, $(LIBPRINT))
+       $(call file, $(LIBSYSTEM))
+       $(call file, $(LIBSTRING))
+
+       $(call tabgen, $D/char.tab)
+
+       $(eval $q: \
+               $(OBJDIR)/$D/macro.h \
+               $(OBJDIR)/$D/Lpars.h \
+               $(INCDIR)/alloc.h \
+               $(INCDIR)/inp_pkg.spec \
+               $(INCDIR)/idf_pkg.spec \
+               $(OBJDIR)/$D/replace.h \
+               $(INCDIR)/system.h \
+               $(INCDIR)/inp_pkg.body \
+               $(INCDIR)/inp_pkg.spec \
+               $(INCDIR)/idf_pkg.body)
+
+       $(call cprogram, $(BINDIR)/cpp.ansi)
+       $(call installto, $(PLATDEP)/cpp.ansi)
+       $(eval CPPANSI := $o)
+
+       $(call reset)
+       $(eval q := $D/ncpp.6)
+       $(call installto, $(INSDIR)/share/man/man6/cpp.ansi.6)
+endef
+
+$(eval $(build-cpp-ansi-impl))
index 47f09af..a5cc940 100644 (file)
@@ -5,25 +5,19 @@
 /* $Id$ */
 /* PREPROCESSOR: CONTROLLINE INTERPRETER */
 
+#include    <stdlib.h>
 #include       "arith.h"
 #include       "LLlex.h"
 #include       "Lpars.h"
 #include       "idf.h"
 #include       "input.h"
 
-#include       "ifdepth.h"     
-#include       "botch_free.h"  
-#include       "nparams.h"     
-#include       "parbufsize.h"  
-#include       "textsize.h"    
-#include       "idfsize.h"     
-#include       "debug.h"
+#include    "parameters.h"
 #include       <assert.h>
 #include       <alloc.h>
 #include       "class.h"
 #include       "macro.h"
 #include       "bits.h"
-#include       "macbuf.h"
 #include       "replace.h"
 
 extern char options[];
index a567b3d..0920976 100644 (file)
@@ -12,8 +12,8 @@
 #include       <varargs.h>
 #endif
 
+#include    "parameters.h"
 #include       "arith.h"
-#include       "errout.h"
 #include       "LLlex.h"
 
 /*     This file contains the (non-portable) error-message and diagnostic
index 97a8198..55a79ac 100644 (file)
@@ -4,7 +4,6 @@
  */
 /* $Id$ */
 #define INP_PUSHBACK 3
-#include "inputtype.h"
 #include <inp_pkg.spec>
 
 /*     Note: The following macro only garuantees one PushBack.
index 46f9fd2..db444ae 100644 (file)
@@ -5,14 +5,14 @@
 /* $Id$ */
 /* MAIN PROGRAM */
 
-#include       "debug.h"
+#include    <stdlib.h>
+#include       "parameters.h"
 
 #include       <alloc.h>
 #include       <assert.h>
 #include       <system.h>
 #include       "arith.h"
 #include       "file_info.h"
-#include       "idfsize.h"
 #include       "idf.h"
 #include       "macro.h"
 
diff --git a/lang/cem/cpp.ansi/make.hfiles b/lang/cem/cpp.ansi/make.hfiles
deleted file mode 100755 (executable)
index 3bc972f..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/sh
-: Update Files from database
-
-PATH=/bin:/usr/bin
-
-case $# in
-1) ;;
-*)     echo use: $0 file >&2
-       exit 1
-esac
-
-(
-IFCOMMAND="if [ -r \$FN ] ;\
-       then    if cmp -s \$FN \$TMP;\
-               then    rm \$TMP;\
-               else    mv \$TMP \$FN;\
-                       echo update \$FN;\
-               fi;\
-       else    mv \$TMP \$FN;\
-               echo create \$FN;\
-       fi"
-echo 'TMP=.uf$$'
-echo 'FN=$TMP'
-echo 'cat >$TMP <<\!EOF!'
-sed -n '/^!File:/,${
-/^$/d
-/^!File:[       ]*\(.*\)$/s@@!EOF!\
-'"$IFCOMMAND"'\
-FN=\1\
-cat >$TMP <<\\!EOF!@
-p
-}' $1
-echo '!EOF!'
-echo $IFCOMMAND
-) | eval "$(cat)"
index fb16ef8..21d1e22 100644 (file)
@@ -8,7 +8,7 @@
 #include    <stdlib.h>
 #include    <string.h>
 #include       "alloc.h"
-#include       "idfsize.h"
+#include    "parameters.h"
 #include       "class.h"
 #include       "macro.h"
 #include       "idf.h"
similarity index 72%
rename from lang/cem/cpp.ansi/Parameters
rename to lang/cem/cpp.ansi/parameters.h
index 0917443..37bdebe 100644 (file)
@@ -1,72 +1,67 @@
-!File: pathlength.h
+#ifndef PARAMETERS_H
+#define PARAMETERS_H
+
 #define PATHLENGTH     1024    /* max. length of path to file          */
 
 
-!File: errout.h
 #define        ERROUT          STDERR  /* file pointer for writing messages    */
 #define        MAXERR_LINE     5       /* maximum number of error messages given
                                        on the same input line.         */
 
 
-!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       */
 #define        STDC_NPARAMS 31 /* ANSI limit on number of parameters           */
 
 
-!File: ifdepth.h
 #define        IFDEPTH 256     /* maximum number of nested if-constructions    */
 
 
-!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       16      /* minimum number of bytes allocated for
                                        storing a string                */
 
 
-!File: botch_free.h
-/*#define BOTCH_FREE   1       /* botch freed memory, as a check       */
+#if 0
+#define BOTCH_FREE     1       /* botch freed memory, as a check       */
+#endif
 
 
-!File: debug.h
-/*#define DEBUG                1       /* perform various self-tests           */
+#if 0
+#define DEBUG          1       /* perform various self-tests           */
+#endif
 #define NDEBUG         1       /* disable assertions                   */
 
 
-!File: parbufsize.h
 #define PARBUFSIZE     1024
 
 
-!File: textsize.h
 #define ITEXTSIZE      16      /* 1st piece of memory for repl. text   */
 
 
-!File: inputtype.h
-/*#define INP_READ_IN_ONE      1       /* read input file in one.  */
+#if 0
+#define INP_READ_IN_ONE        1       /* read input file in one.  */
                                /* If defined, we cannot read from a pipe */
+#endif
 
 
-!File: obufsize.h
 #define OBUFSIZE       8192    /* output buffer size */
 
 
-!File: dobits.h
 #define DOBITS         1       /* use trick to reduce symboltable accesses */
 
 
-!File: ln_prefix.h
 #define LINE_PREFIX    "#"     /* prefix for generated line directives,
                                   either "#" or "#line"
                                */
 
+#endif
+
index 72fa647..7c3840d 100644 (file)
 #include       <system.h>
 #include       <alloc.h>
 #include       "input.h"
-#include       "obufsize.h"
+#include       "parameters.h"
 #include       "arith.h"
 #include       "LLlex.h"
 #include       "class.h"
 #include       "macro.h"
 #include       "idf.h"
-#include       "idfsize.h"
 #include       "bits.h"
-#include       "ln_prefix.h"
-#include       "textsize.h"
 
 char   _obuf[OBUFSIZE];
 #ifdef DOBITS
index 94bb22f..255902f 100644 (file)
@@ -9,11 +9,7 @@
 #include       <stdio.h>
 #include       <string.h>
 
-#include       "pathlength.h"
-#include       "strsize.h"
-#include       "nparams.h"
-#include       "idfsize.h"
-#include       "numsize.h"
+#include       "parameters.h"
 #include       "alloc.h"
 #include       "idf.h"
 #include       "input.h"
@@ -21,9 +17,7 @@
 #include       "arith.h"
 #include       "LLlex.h"
 #include       "class.h"
-#include       "debug.h"
 #include       "assert.h"
-#include       "macbuf.h"
 #include       "replace.h"
 
 extern char *GetIdentifier();
diff --git a/lang/cem/libcc.ansi/build.mk b/lang/cem/libcc.ansi/build.mk
new file mode 100644 (file)
index 0000000..640f7f3
--- /dev/null
@@ -0,0 +1,36 @@
+define build-libcc-ansi-headers-install-one-impl
+       $(call reset)
+       $(eval q := lang/cem/libcc.ansi/headers/$(strip $1))
+       $(call installto, $(PLATIND)/include/ansi/$(strip $1))
+       $(eval LIBCCANSIHEADERS += $o)
+endef
+
+define build-libcc-ansi-headers-impl
+       $(eval g := \
+               sys/time.h \
+               sys/ioctl.h \
+               assert.h \
+               ctype.h \
+               errno.h \
+               float.h \
+               limits.h \
+               math.h \
+               setjmp.h \
+               signal.h \
+               stdarg.h \
+               stddef.h \
+               stdint.h \
+               stdio.h \
+               stdlib.h \
+               string.h \
+               time.h \
+               iso646.h \
+               stdbool.h \
+               locale.h \
+               tgmath.h)
+
+       $(eval LIBCCANSIHEADERS :=)
+       $(foreach f,$g,$(call build-libcc-ansi-headers-install-one-impl,$f))
+endef
+
+$(eval $(build-libcc-ansi-headers-impl))
index 703b376..ec50ae9 100644 (file)
@@ -219,7 +219,7 @@ EnterParTypes(fpl, parlist)
        register struct node *fpl;
        struct paramlist **parlist;
 {
-       /* Parameters in heading of procedural and functional
+       /* parameters.h in heading of procedural and functional
           parameters (only types are important, not the names).
        */
        register arith nb_pars = 0;
index aa2f33b..2e69b0f 100644 (file)
@@ -4,15 +4,15 @@
 # Don't generate line updating code by default (i.e.: -L flag provided to cem).
 # To put it on again: use -NL
 var LFLAG=-L
-var MODULA2_INCLUDES=-I{EM}/include/m2
-var OCCAM_INCLUDES=-I{EM}/include/occam
-var C_INCLUDES=-I{EM}/include/ansi
+var MODULA2_INCLUDES=-I{EM}/share/ack/include/m2
+var OCCAM_INCLUDES=-I{EM}/share/ack/include/occam
+var C_INCLUDES=-I{EM}/share/ack/include/ansi
 
 callname ack
 name cpp
        # no from, this is a preprocessor
        to .i
-       program {EM}/lib.bin/cpp.ansi
+       program {EM}/lib/ack/cpp.ansi
        mapflag -I* CPP_F={CPP_F?} -I*
        mapflag -U* CPP_F={CPP_F?} -U*
        mapflag -D* CPP_F={CPP_F?} -D*
@@ -38,7 +38,7 @@ end
 name f77
        from .f
        to .c
-       program {EM}/lib.bin/f2c
+       program {EM}/lib/ack/f2c
        mapflag -ansi F2_F={F2_F?} -A
        mapflag -w* F2_F={F2_F?} -w*
        args \
@@ -54,7 +54,7 @@ end
 name cem
        from .c
        to .k
-       program {EM}/lib.bin/em_cemcom.ansi
+       program {EM}/lib/ack/em_cemcom.ansi
 #      mapflag -I* CPP_F={CPP_F?} -I*
 #      mapflag -U* CPP_F={CPP_F?} -U*
 #      mapflag -D* CPP_F={CPP_F?} -D*
@@ -93,7 +93,7 @@ end
 name pc
        from .p
        to .k
-       program {EM}/lib.bin/em_pc
+       program {EM}/lib/ack/em_pc
        mapflag -L PC_F={PC_F?} -L
 #      mapflag -s PC_F={PC_F?} -s
        mapflag -_ PC_F={PC_F?} -U
@@ -118,7 +118,7 @@ end
 name m2
        from .mod.def
        to .k
-       program {EM}/lib.bin/em_m2
+       program {EM}/lib/ack/em_m2
        mapflag -I* M2_INCL={M2_INCL?} -I*
        mapflag -L M2_F={M2_F?} -L
        mapflag -g* M2_F={M2_F?} -g*
@@ -142,7 +142,7 @@ end
 name ocm
        from .ocm
        to .k
-       program {EM}/lib.bin/em_occam
+       program {EM}/lib/ack/em_occam
        mapflag -L OCM_F={OCM_F?} -L
        mapflag -V* OCM_F={OCM_F?} -V*
        args -Vw{w}p{p}l{l} {OCM_F?}
@@ -168,7 +168,7 @@ name abc
        need .b
        callname abc
 end
-var A68INIT={EM}/lib.bin/em_a68s_init
+var A68INIT={EM}/lib/ack/em_a68s_init
 name a68s
         from .8.a68
         to .k
@@ -183,7 +183,7 @@ end
 name encode
        from .e
        to .k
-       program {EM}/lib.bin/em_encode
+       program {EM}/lib/ack/em_encode
        args <
        prep cond
        stdout
@@ -191,7 +191,7 @@ end
 name opt
        from .k
        to .m
-       program {EM}/lib.bin/em_opt
+       program {EM}/lib/ack/em_opt
        mapflag -LIB OPT_F={OPT_F?} -L
 # when running the global optimizer, no multiplication optimization here.
        mapflag -O2 OPT2_F=-m0
@@ -204,7 +204,7 @@ end
 name ego
        from .m.ma
        to .gk
-       program {EM}/lib.bin/em_ego
+       program {EM}/lib/ack/em_ego
        mapflag -EGO-* EGO_F={EGO_F?} -*
 # The following lines are obsolete, but here for backwards compatibility.
 # They should be removed some day.
@@ -237,7 +237,7 @@ name opt2
        # of the em peephole optimizer
        from .gk
        to .g
-       program {EM}/lib.bin/em_opt2
+       program {EM}/lib/ack/em_opt2
 #      mapflag -LIB OPT_F={OPT_F?} -L
        args {OPT_F?} {MACHOPT_F?} <
        optimizer
@@ -246,7 +246,7 @@ end
 name decode
        from .k.m.g.gk
        to .e
-       program {EM}/lib.bin/em_decode
+       program {EM}/lib/ack/em_decode
        args <
        stdout
 end
diff --git a/mach/proto/as/build.mk b/mach/proto/as/build.mk
new file mode 100644 (file)
index 0000000..d98fe74
--- /dev/null
@@ -0,0 +1,43 @@
+define build-as-impl
+    $(call reset)
+
+    $(eval cflags += -Imach/$(ARCH)/as -I$(OBJDIR)/$D)
+    $(eval objdir := $D)
+
+    $(call cfile, mach/proto/as/comm3.c)
+    $(call dependson, $(OBJDIR)/$D/y.tab.h)
+
+    $(call cfile, mach/proto/as/comm4.c)
+    $(call dependson, $(OBJDIR)/$D/y.tab.h)
+
+    $(call cfile, mach/proto/as/comm5.c)
+    $(call dependson, $(OBJDIR)/$D/y.tab.h)
+
+    $(call cfile, mach/proto/as/comm6.c)
+    $(call dependson, $(OBJDIR)/$D/y.tab.h)
+
+    $(call cfile, mach/proto/as/comm7.c)
+    $(call dependson, $(OBJDIR)/$D/y.tab.h)
+
+    $(call cfile, mach/proto/as/comm8.c)
+    $(call dependson, $(OBJDIR)/$D/y.tab.h)
+
+       $(call yacc, $(OBJDIR)/$D, $(OBJDIR)/$D/preprocessed-comm2.y)
+
+$(eval CLEANABLES += $(OBJDIR)/$D/preprocessed-comm2.y)
+$(OBJDIR)/$D/preprocessed-comm2.y: mach/proto/as/comm2.y $(CPPANSI)
+       @echo PREPROCESS $$@
+       @mkdir -p $$(dir $$@)
+       $(hide) $(CPPANSI) -P \
+               -Imach/$(ARCH)/as \
+               -Imach/proto/as \
+               -Ih \
+               mach/proto/as/comm2.y > $$@
+
+       $(call file, $(LIBOBJECT))
+    $(call cprogram, $(BINDIR)/$(PLATFORM)/as)
+    $(call installto, $(PLATDEP)/$(PLATFORM)/as)
+endef
+
+build-as = $(eval $(build-as-impl))
+
diff --git a/mach/proto/ncg/build.mk b/mach/proto/ncg/build.mk
new file mode 100644 (file)
index 0000000..e3843b7
--- /dev/null
@@ -0,0 +1,46 @@
+define build-ncg-impl
+
+$(call reset)
+
+$(eval cflags += -Imach/$(ARCH)/ncg -I$(OBJDIR)/$D -Imach/proto/ncg)
+$(eval objdir := $D/ncg)
+
+$(call cfile, mach/proto/ncg/codegen.c)
+$(call cfile, mach/proto/ncg/compute.c)
+$(call cfile, mach/proto/ncg/equiv.c)
+$(call cfile, mach/proto/ncg/fillem.c)
+$(call cfile, mach/proto/ncg/gencode.c)
+$(call cfile, mach/proto/ncg/glosym.c)
+$(call cfile, mach/proto/ncg/label.c)
+$(call cfile, mach/proto/ncg/main.c)
+$(call cfile, mach/proto/ncg/move.c)
+$(call cfile, mach/proto/ncg/nextem.c)
+$(call cfile, mach/proto/ncg/reg.c)
+$(call cfile, mach/proto/ncg/regvar.c)
+$(call cfile, mach/proto/ncg/salloc.c)
+$(call cfile, mach/proto/ncg/state.c)
+$(call cfile, mach/proto/ncg/subr.c)
+$(call cfile, mach/proto/ncg/var.c)
+
+$(eval $q: $(OBJDIR)/$D/tables.h)
+$(eval CLEANABLES += $(OBJDIR)/$D/tables.h $(OBJDIR)/$D/table.c)
+$(OBJDIR)/$D/tables.c: $(OBJDIR)/$D/tables.h
+$(OBJDIR)/$D/tables.h: $(NCGG) $(CPPANSI) mach/$(ARCH)/ncg/table
+       @echo NCGG $$@
+       @mkdir -p $$(dir $$@)
+       $(hide) cd $$(dir $$@) && \
+               $(abspath $(CPPANSI)) $(abspath mach/$(ARCH)/ncg/table) | $(abspath $(NCGG))
+       $(hide) mv $(OBJDIR)/$D/tables.H $(OBJDIR)/$D/tables.h
+
+$(call cfile, $(OBJDIR)/$D/tables.c)
+
+$(call file, $(LIBEM_DATA))
+$(call file, $(LIBFLT_ARITH))
+
+$(call cprogram, $(BINDIR)/$(PLATFORM)/ncg)
+$(call installto, $(PLATDEP)/$(PLATFORM)/ncg)
+
+endef
+
+build-ncg = $(eval $(build-ncg-impl))
+
diff --git a/modules/src/alloc/build.mk b/modules/src/alloc/build.mk
new file mode 100644 (file)
index 0000000..808dcca
--- /dev/null
@@ -0,0 +1,23 @@
+D := modules/src/alloc
+
+define build-liballoc-impl
+       $(call reset)
+       $(call cfile, $D/Malloc.c)
+       $(call cfile, $D/Salloc.c)
+       $(call cfile, $D/Srealloc.c)
+       $(call cfile, $D/Realloc.c)
+       $(call cfile, $D/botch.c)
+       $(call cfile, $D/clear.c)
+       $(call cfile, $D/st_alloc.c)
+       $(call cfile, $D/std_alloc.c)
+       $(call cfile, $D/No_Mem.c)
+       $(call clibrary, $(LIBDIR)/liballoc.a)
+       LIBALLOC := $o
+
+       $(call reset)
+       $(eval q := $D/alloc.h)
+       $(call copyto, $(INCDIR)/alloc.h)
+endef
+
+$(eval $(build-liballoc-impl))
+
diff --git a/modules/src/em_code/build.mk b/modules/src/em_code/build.mk
new file mode 100644 (file)
index 0000000..8fcba3c
--- /dev/null
@@ -0,0 +1,89 @@
+D := modules/src/em_code
+
+# $1 = capital letter for library specialisation (E or K)
+# $2 = lowercase letter for library specialisation (e or k)
+# $3 = cflags that specalise this library
+
+define build-em_code-impl
+       $(call reset)
+       $(eval cflags += $3)
+       $(eval objdir := $D/$1)
+       $(call cfile, $D/bhcst.c)
+       $(call cfile, $D/bhdlb.c)
+       $(call cfile, $D/bhdnam.c)
+       $(call cfile, $D/bhfcon.c)
+       $(call cfile, $D/bhicon.c)
+       $(call cfile, $D/bhilb.c)
+       $(call cfile, $D/bhpnam.c)
+       $(call cfile, $D/bhucon.c)
+       $(call cfile, $D/crcst.c)
+       $(call cfile, $D/crdlb.c)
+       $(call cfile, $D/crdnam.c)
+       $(call cfile, $D/crxcon.c)
+       $(call cfile, $D/crilb.c)
+       $(call cfile, $D/crpnam.c)
+       $(call cfile, $D/crscon.c)
+       $(call cfile, $D/cst.c)
+       $(call cfile, $D/dfdlb.c)
+       $(call cfile, $D/dfdnam.c)
+       $(call cfile, $D/dfilb.c)
+       $(call cfile, $D/dlb.c)
+       $(call cfile, $D/dnam.c)
+       $(call cfile, $D/end.c)
+       $(call cfile, $D/endarg.c)
+       $(call cfile, $D/exc.c)
+       $(call cfile, $D/fcon.c)
+       $(call cfile, $D/getid.c)
+       $(call cfile, $D/icon.c)
+       $(call cfile, $D/ilb.c)
+       $(call cfile, $D/insert.c)
+       $(call cfile, $D/internerr.c)
+       $(call cfile, $D/msend.c)
+       $(call cfile, $D/op.c)
+       $(call cfile, $D/opcst.c)
+       $(call cfile, $D/opdlb.c)
+       $(call cfile, $D/opdnam.c)
+       $(call cfile, $D/opilb.c)
+       $(call cfile, $D/opnarg.c)
+       $(call cfile, $D/oppnam.c)
+       $(call cfile, $D/pnam.c)
+       $(call cfile, $D/pro.c)
+       $(call cfile, $D/pronarg.c)
+       $(call cfile, $D/msstart.c)
+       $(call cfile, $D/psdlb.c)
+       $(call cfile, $D/psdnam.c)
+       $(call cfile, $D/pspnam.c)
+       $(call cfile, $D/scon.c)
+       $(call cfile, $D/ucon.c)
+       $(call cfile, $D/C_out.c)
+       $(call cfile, $D/failed.c)
+       $(call cfile, $D/em.c)
+
+       $(eval $q: $(INCDIR)/em_codeEK.h)
+
+       $(call clibrary, $(LIBDIR)/libem$2.a)
+       $(eval LIBEM$1 := $o)
+endef
+
+define build-em_code-header-impl
+$(OBJDIR)/$D/em_codeEK.h: $D/make.em.gen $D/em.nogen h/em_table
+       @echo MAKE_EM_GEN $$@
+       @mkdir -p $$(dir $$@)
+       $(hide) $D/make.em.gen h/em_table > $$@
+       $(hide) cat $D/em.nogen >> $$@
+
+$(call reset)
+$(eval q := $(OBJDIR)/$D/em_codeEK.h)
+$(eval CLEANABLES += $q)
+$(call copyto, $(INCDIR)/em_codeEK.h)
+
+$(eval CLEANABLES += $o)
+$(eval $o: $(INCDIR)/em_pseu.h)
+
+endef
+
+$(eval $(call build-em_code-header-impl))
+$(eval $(call build-em_code-impl,E,e, -DREADABLE_EM))
+$(eval $(call build-em_code-impl,K,k, ))
+
+
index 9da09a4..f7526b8 100644 (file)
@@ -9,6 +9,7 @@
    they can be written immediately.
 */
 
+#include <stdlib.h>
 #include <em_path.h>
 #include <alloc.h>
 #include "insert.h"
diff --git a/modules/src/em_mes/build.mk b/modules/src/em_mes/build.mk
new file mode 100644 (file)
index 0000000..7ae2621
--- /dev/null
@@ -0,0 +1,26 @@
+D := modules/src/em_mes
+
+define build-em_mes-impl
+       $(call reset)
+       $(call cfile, $D/C_ms_err.c)
+       $(call cfile, $D/C_ms_opt.c)
+       $(call cfile, $D/C_ms_emx.c)
+       $(call cfile, $D/C_ms_reg.c)
+       $(call cfile, $D/C_ms_src.c)
+       $(call cfile, $D/C_ms_flt.c)
+       $(call cfile, $D/C_ms_com.c)
+       $(call cfile, $D/C_ms_par.c)
+       $(call cfile, $D/C_ms_ego.c)
+       $(call cfile, $D/C_ms_gto.c)
+       $(call cfile, $D/C_ms_stb.c)
+       $(call cfile, $D/C_ms_std.c)
+
+       $(eval $q: $(INCDIR)/em_codeEK.h)
+
+       $(call clibrary, $(LIBDIR)/libem_mes.a)
+       $(eval LIBEM_MES := $o)
+endef
+
+$(eval $(call build-em_mes-impl))
+
+
diff --git a/modules/src/flt_arith/build.mk b/modules/src/flt_arith/build.mk
new file mode 100644 (file)
index 0000000..6a34b7d
--- /dev/null
@@ -0,0 +1,29 @@
+D := modules/src/flt_arith
+
+define build-libflt_arith-impl
+       $(call reset)
+       $(call cfile, $D/flt_ar2flt.c)
+       $(call cfile, $D/flt_div.c)
+       $(call cfile, $D/flt_flt2ar.c)
+       $(call cfile, $D/flt_modf.c)
+       $(call cfile, $D/flt_str2fl.c)
+       $(call cfile, $D/flt_cmp.c)
+       $(call cfile, $D/flt_add.c)
+       $(call cfile, $D/b64_add.c)
+       $(call cfile, $D/flt_mul.c)
+       $(call cfile, $D/flt_nrm.c)
+       $(call cfile, $D/b64_sft.c)
+       $(call cfile, $D/flt_umin.c)
+       $(call cfile, $D/flt_chk.c)
+       $(call cfile, $D/split.c)
+       $(call cfile, $D/ucmp.c)
+       $(call clibrary, $(LIBDIR)/libflt_arith.a)
+       LIBFLT_ARITH := $o
+
+       $(call reset)
+       $(eval q := $D/flt_arith.h)
+       $(call copyto, $(INCDIR)/flt_arith.h)
+endef
+
+$(eval $(build-libflt_arith-impl))
+
diff --git a/modules/src/idf/build.mk b/modules/src/idf/build.mk
new file mode 100644 (file)
index 0000000..b8dee6f
--- /dev/null
@@ -0,0 +1,14 @@
+D := modules/src/idf
+
+define build-libidf-impl
+       $(call reset)
+       $(eval q := $D/idf_pkg.body)
+       $(call copyto, $(INCDIR)/idf_pkg.body)
+
+       $(call reset)
+       $(eval q := $D/idf_pkg.spec)
+       $(call copyto, $(INCDIR)/idf_pkg.spec)
+endef
+
+$(eval $(build-libidf-impl))
+
diff --git a/modules/src/input/build.mk b/modules/src/input/build.mk
new file mode 100644 (file)
index 0000000..ef6e1aa
--- /dev/null
@@ -0,0 +1,20 @@
+D := modules/src/input
+
+define build-libinput-impl
+       $(call reset)
+       $(call cfile, $D/AtEoIF.c)
+       $(call cfile, $D/AtEoIT.c)
+       $(call clibrary, $(LIBDIR)/libinput.a)
+       $(eval LIBINPUT := $o)
+
+       $(call reset)
+       $(eval q := $D/inp_pkg.body)
+       $(call copyto, $(INCDIR)/inp_pkg.body)
+
+       $(call reset)
+       $(eval q := $D/inp_pkg.spec)
+       $(call copyto, $(INCDIR)/inp_pkg.spec)
+endef
+
+$(eval $(build-libinput-impl))
+
diff --git a/modules/src/object/build.mk b/modules/src/object/build.mk
new file mode 100644 (file)
index 0000000..d256cba
--- /dev/null
@@ -0,0 +1,27 @@
+D := modules/src/object
+
+define build-libobject-impl
+       $(call reset)
+       $(call cfile, $D/rd.c)
+       $(call cfile, $D/rd_arhdr.c)
+       $(call cfile, $D/rd_bytes.c)
+       $(call cfile, $D/rd_int2.c)
+       $(call cfile, $D/rd_long.c)
+       $(call cfile, $D/rd_ranlib.c)
+       $(call cfile, $D/rd_unsig2.c)
+       $(call cfile, $D/wr.c)
+       $(call cfile, $D/wr_arhdr.c)
+       $(call cfile, $D/wr_bytes.c)
+       $(call cfile, $D/wr_int2.c)
+       $(call cfile, $D/wr_long.c)
+       $(call cfile, $D/wr_putc.c)
+       $(call cfile, $D/wr_ranlib.c)
+
+       $(eval $q: $(INCDIR)/local.h)
+
+       $(call clibrary, $(LIBDIR)/libobject.a)
+       LIBOBJECT := $o
+endef
+
+$(eval $(build-libobject-impl))
+
diff --git a/modules/src/print/build.mk b/modules/src/print/build.mk
new file mode 100644 (file)
index 0000000..17974b4
--- /dev/null
@@ -0,0 +1,22 @@
+D := modules/src/print
+
+define build-libprint-impl
+       $(call reset)
+       $(call cfile, $D/doprnt.c)
+       $(call cfile, $D/fprint.c)
+       $(call cfile, $D/print.c)
+       $(call cfile, $D/sprint.c)
+       $(call cfile, $D/format.c)
+
+       $(eval $q: $(INCDIR)/system.h)
+
+       $(call clibrary, $(LIBDIR)/libprint.a)
+       LIBPRINT := $o
+
+       $(call reset)
+       $(eval q := $D/print.h)
+       $(call copyto, $(INCDIR)/print.h)
+endef
+
+$(eval $(build-libprint-impl))
+
diff --git a/modules/src/string/build.mk b/modules/src/string/build.mk
new file mode 100644 (file)
index 0000000..7139f1e
--- /dev/null
@@ -0,0 +1,19 @@
+D := modules/src/string
+
+define build-libstring-impl
+       $(call reset)
+       $(call cfile, $D/bts2str.c)
+       $(call cfile, $D/btscat.c)
+       $(call cfile, $D/btscmp.c)
+       $(call cfile, $D/btscpy.c)
+       $(call cfile, $D/btszero.c)
+       $(call cfile, $D/long2str.c)
+       $(call cfile, $D/str2bts.c)
+       $(call cfile, $D/str2long.c)
+       $(call cfile, $D/strzero.c)
+       $(call clibrary, $(LIBDIR)/libstring.a)
+       LIBSTRING := $o
+endef
+
+$(eval $(build-libstring-impl))
+
diff --git a/modules/src/system/build.mk b/modules/src/system/build.mk
new file mode 100644 (file)
index 0000000..e76b5c5
--- /dev/null
@@ -0,0 +1,29 @@
+D := modules/src/system
+
+define build-libsystem-impl
+       $(call reset)
+       $(call cfile, $D/access.c)
+       $(call cfile, $D/break.c)
+       $(call cfile, $D/chmode.c)
+       $(call cfile, $D/close.c)
+       $(call cfile, $D/create.c)
+       $(call cfile, $D/filesize.c)
+       $(call cfile, $D/open.c)
+       $(call cfile, $D/read.c)
+       $(call cfile, $D/remove.c)
+       $(call cfile, $D/stop.c)
+       $(call cfile, $D/system.c)
+       $(call cfile, $D/time.c)
+       $(call cfile, $D/write.c)
+       $(call cfile, $D/seek.c)
+       $(call cfile, $D/rename.c)
+       $(call clibrary, $(LIBDIR)/libsystem.a)
+       LIBSYSTEM := $o
+
+       $(call reset)
+       $(eval q := $D/system.h)
+       $(call copyto, $(INCDIR)/system.h)
+endef
+
+$(eval $(build-libsystem-impl))
+
diff --git a/plat/build.mk b/plat/build.mk
new file mode 100644 (file)
index 0000000..dde7578
--- /dev/null
@@ -0,0 +1,26 @@
+
+define build-platform-headers
+$(call reset)
+$(eval q := $D/include/$(strip $1))
+$(call installto, $(PLATIND)/$(PLATFORM)/include/$(strip $1))
+$(eval PLATFORM_HEADERS_$(PLATFORM) += $q)
+endef
+
+define build-platform-impl
+    $(call reset)
+       $(eval q := $D/descr)
+       $(call installto, $(PLATIND)/descr/$(PLATFORM))
+
+       $(foreach f, $1, $(call build-platform-headers, $f))
+
+       $(eval PLATFORM_$(PLATFORM) := \
+                       $(PLATFORM_HEADERS_$(PLATFORM)) \
+                       $(PLATDEP)/$(PLATFORM)/ncg)
+
+    $(call build-as)
+    $(call build-ncg)
+endef
+
+build-platform = $(eval $(call build-platform-impl, $1))
+
+
diff --git a/plat/cpm/build.mk b/plat/cpm/build.mk
new file mode 100644 (file)
index 0000000..83f029f
--- /dev/null
@@ -0,0 +1,14 @@
+ARCH := i80
+PLATFORM := cpm
+OPTIMISATION := -O
+
+D := plat/cpm
+
+$(eval $(call build-platform, \
+       ack/config.h \
+       cpm.h \
+       unistd.h \
+))
+
+include plat/cpm/libsys/build.mk
+
index da320fe..b1b5799 100644 (file)
@@ -10,7 +10,7 @@ var f=4
 var d=8
 var ARCH=i80
 var PLATFORM=cpm
-var PLATFORMDIR={EM}/lib/{PLATFORM}
+var PLATFORMDIR={EM}/lib/ack/{PLATFORM}
 var CPP_F=-D__unix
 var ALIGN=-a0:1 -a1:1 -a2:1 -a3:1 -b0:0x0100
 var MACHOPT_F=-m8
@@ -18,12 +18,12 @@ var MACHOPT_F=-m8
 # Override the setting in fe so that files compiled for linux386 can see
 # the platform-specific headers.
 
-var C_INCLUDES=-I{PLATFORMDIR}/include -I{EM}/include/ansi
+var C_INCLUDES=-I{EM}/share/ack/{PLATFORM}/include -I{EM}/share/ack/include/ansi
 
 name be
        from .m.g
        to .s
-       program {EM}/lib.bin/{PLATFORM}/ncg
+       program {EM}/lib/ack/{PLATFORM}/ncg
        args <
        stdout
        need .e
@@ -31,7 +31,7 @@ end
 name asopt
        from .s
        to .so
-       program {EM}/lib.bin/{PLATFORM}/top
+       program {EM}/lib/ack/{PLATFORM}/top
        args
        optimizer
        stdin
@@ -40,14 +40,14 @@ end
 name as
        from .s.so
        to .o
-       program {EM}/lib.bin/{PLATFORM}/as
+       program {EM}/lib/ack/{PLATFORM}/as
        args - -o > <
        prep cond
 end
 name led
        from .o.a
        to .out
-       program {EM}/lib.bin/em_led
+       program {EM}/lib/ack/em_led
        mapflag -l* LNAME={PLATFORMDIR}/lib*
        mapflag -i SEPID=-b1:0
        mapflag -fp FLOATS={EM}/{ILIB}fp
diff --git a/plat/cpm/libsys/build.mk b/plat/cpm/libsys/build.mk
new file mode 100644 (file)
index 0000000..be6dfa3
--- /dev/null
@@ -0,0 +1,28 @@
+D := plat/cpm/libsys
+
+define build-cpm-libsys-impl
+       $(call reset)
+       $(call ackfile, $D/_bdos.s)
+       $(call ackfile, $D/_hol0.s)
+       $(call ackfile, $D/_inn2.s)
+       $(call ackfile, $D/_trap.s)
+       $(call ackfile, $D/brk.c)
+       $(call ackfile, $D/close.c)
+       $(call ackfile, $D/creat.c)
+       $(call ackfile, $D/errno.s)
+       $(call ackfile, $D/getpid.c)
+       $(call ackfile, $D/isatty.c)
+       $(call ackfile, $D/kill.c)
+       $(call ackfile, $D/lseek.c)
+       $(call ackfile, $D/open.c)
+       $(call ackfile, $D/read.c)
+       $(call ackfile, $D/signal.c)
+       $(call ackfile, $D/time.c)
+       $(call ackfile, $D/write.c)
+
+       $(call acklibrary, $(LIBDIR)/$(PLATFORM)/libsys.a)
+       $(call installto, $(PLATIND)/$(PLATFORM)/libsys.a)
+endef
+
+$(eval $(build-cpm-libsys-impl))
+
diff --git a/plat/pc86/build.mk b/plat/pc86/build.mk
new file mode 100644 (file)
index 0000000..e7e6713
--- /dev/null
@@ -0,0 +1,14 @@
+ARCH := i86
+PLATFORM := pc86
+OPTIMISATION := -O
+
+D := plat/pc86/
+
+$(eval $(call build-platform, \
+       ack/config.h \
+       unistd.h \
+))
+
+include plat/pc86/libsys/build.mk
+
+
index 65b63a1..a3f11fc 100644 (file)
@@ -10,20 +10,20 @@ var f=4
 var d=8
 var ARCH=i86
 var PLATFORM=pc86
-var PLATFORMDIR={EM}/lib/{PLATFORM}
+var PLATFORMDIR={EM}/share/ack/{PLATFORM}
 var CPP_F=-D__unix
 var ALIGN=-a0:1 -a1:1 -a2:1 -a3:1
 var MACHOPT_F=-m8
 
-# Override the setting in fe so that files compiled for linux386 can see
+# Override the setting in fe so that files compiled for this platform can see
 # the platform-specific headers.
 
-var C_INCLUDES=-I{PLATFORMDIR}/include -I{EM}/include/ansi
+var C_INCLUDES=-I{PLATFORMDIR}/include -I{EM}/share/ack/include/ansi
 
 name be
        from .m.g
        to .s
-       program {EM}/lib.bin/{PLATFORM}/ncg
+       program {EM}/lib/ack/{PLATFORM}/ncg
        args <
        stdout
        need .e
@@ -31,14 +31,14 @@ end
 name as
        from .s.so
        to .o
-       program {EM}/lib.bin/{PLATFORM}/as
+       program {EM}/lib/ack/{PLATFORM}/as
        args - -o > <
        prep cond
 end
 name led
        from .o.a
        to .out
-       program {EM}/lib.bin/em_led
+       program {EM}/lib/ack/em_led
        mapflag -l* LNAME={PLATFORMDIR}/lib*
        mapflag -i SEPID=-b1:0
        mapflag -fp FLOATS={EM}/{ILIB}fp
diff --git a/plat/pc86/libsys/build.mk b/plat/pc86/libsys/build.mk
new file mode 100644 (file)
index 0000000..bf0fda6
--- /dev/null
@@ -0,0 +1,26 @@
+D := plat/pc86/libsys
+
+define build-pc86-libsys-impl
+       $(call reset)
+       $(call ackfile, $D/errno.s)
+       $(call ackfile, $D/_hol0.s)
+       $(call ackfile, $D/_sys_rawread.s)
+       $(call ackfile, $D/_sys_rawwrite.s)
+       $(call ackfile, $D/open.c)
+       $(call ackfile, $D/creat.c)
+       $(call ackfile, $D/close.c)
+       $(call ackfile, $D/read.c)
+       $(call ackfile, $D/write.c)
+       $(call ackfile, $D/brk.c)
+       $(call ackfile, $D/getpid.c)
+       $(call ackfile, $D/kill.c)
+       $(call ackfile, $D/isatty.c)
+       $(call ackfile, $D/lseek.c)
+       $(call ackfile, $D/time.c)
+       $(call ackfile, $D/signal.c)
+       $(call acklibrary, $(LIBDIR)/$(PLATFORM)/libsys.a)
+       $(call installto, $(PLATIND)/$(PLATFORM)/libsys.a)
+endef
+
+$(eval $(build-pc86-libsys-impl))
+
diff --git a/util/LLgen/build.mk b/util/LLgen/build.mk
new file mode 100644 (file)
index 0000000..44b63f8
--- /dev/null
@@ -0,0 +1,55 @@
+D := util/LLgen
+
+# Rule to build LLgen.
+
+define build-llgen-impl
+       $(call reset)
+       $(eval cflags += -DNON_CORRECTING -DLIBDIR=\"$(abspath $D/lib)\")
+       $(call cfile, $D/src/main.c)
+       $(call cfile, $D/src/gencode.c)
+       $(call cfile, $D/src/compute.c)
+       $(call cfile, $D/src/check.c)
+       $(call cfile, $D/src/reach.c)
+       $(call cfile, $D/src/global.c)
+       $(call cfile, $D/src/name.c)
+       $(call cfile, $D/src/sets.c)
+       $(call cfile, $D/src/alloc.c)
+       $(call cfile, $D/src/machdep.c)
+       $(call cfile, $D/src/cclass.c)
+       $(call cfile, $D/src/savegram.c)
+
+       # These use pre-LLgen'd version of the files. If LLgen.g gets updated,
+       # they need rebuilding. Use the bootstrap script to do this.
+
+       $(call cfile, $D/src/LLgen.c)
+       $(call cfile, $D/src/Lpars.c)
+       $(call cfile, $D/src/tokens.c)
+
+       $(call cprogram, $(BINDIR)/LLgen)
+       LLGEN := $o
+endef
+
+$(eval $(build-llgen-impl))
+
+# Rule to invoke to *use* LLgen.
+#
+#  $1: directory to put output files
+#  $2: input files
+#
+# Output files are compiled via cfile and queued.
+
+define llgen-impl
+$(eval o := $1/Lpars.c $(patsubst %.g, $(strip $1)/%.c, $(notdir $2)))
+$(eval CLEANABLES += $o $1/Lpars.h)
+
+$o: $1/Lpars.h
+$1/Lpars.h: $2 $(LLGEN)
+       @echo LLGEN $1/Lpars.c
+       @mkdir -p $(dir $o)
+       $(hide) cd $(dir $o) && $(LLGEN) $(abspath $2)
+
+$(foreach f,$o,$(call cfile,$f))
+
+endef
+
+llgen = $(eval $(call llgen-impl,$1,$2))
index ef6b284..c17d99d 100644 (file)
@@ -17,6 +17,7 @@
  * Also checks the continuation grammar from the specified grammar.
  */
 
+# include <stdlib.h>
 # include "types.h"
 # include "extern.h"
 # include "sets.h"
index 20d0d6c..94dd312 100644 (file)
@@ -18,6 +18,7 @@
  * This file is a mess, it should be cleaned up some time.
  */
 
+#include <stdlib.h>
 # include "types.h"
 # include "io.h"
 # include "extern.h"
index d1b6a57..625dc1b 100644 (file)
@@ -25,6 +25,7 @@
  */
 
 
+#include <stdlib.h>
 # include "types.h"
 # include "extern.h"
 # include "io.h"
diff --git a/util/ack/build.mk b/util/ack/build.mk
new file mode 100644 (file)
index 0000000..1b4fc14
--- /dev/null
@@ -0,0 +1,57 @@
+D := util/ack
+
+define util-ack-makeheaders-rule
+$(eval g := $(OBJDIR)/$D/dmach.c $(OBJDIR)/$D/intable.c)
+$(wordlist 2, $(words $g), $g): $(firstword $g)
+$(firstword $g): $(util-ack-mktables)
+       @echo MKTABLES
+       @mkdir -p $(dir $g)
+       $(hide) cd $(dir $g) && $(util-ack-mktables) $(INSDIR)/share
+
+$(eval CLEANABLES += $g)
+endef
+
+define build-ack-impl
+       $(call reset)
+       $(call cfile, $D/mktables.c)
+       $(call cprogram, $(OBJDIR)/$D/mktables)
+       $(eval util-ack-mktables := $o)
+
+       $(call reset)
+       $(eval cflags += -I$D)
+       $(call cfile, $D/list.c)
+       $(call cfile, $D/data.c)
+       $(call cfile, $D/main.c)
+       $(call cfile, $D/scan.c)
+       $(call cfile, $D/svars.c)
+       $(call cfile, $D/trans.c)
+       $(call cfile, $D/util.c)
+
+       $(call cfile, $D/rmach.c)
+       $(call dependson, $(INCDIR)/em_path.h)
+
+       $(call cfile, $D/run.c)
+       $(call cfile, $D/grows.c)
+
+       $(call cfile, $D/files.c)
+       $(call dependson, $(INCDIR)/em_path.h)
+
+       $(eval $(util-ack-makeheaders-rule))
+       $(call cfile, $(OBJDIR)/$D/dmach.c)
+       $(call cfile, $(OBJDIR)/$D/intable.c)
+
+       $(call cprogram, $(BINDIR)/ack)
+       $(call installto, $(INSDIR)/bin/ack)
+       $(eval ACK := $o)
+
+       $(call reset)
+       $(eval q := lib/descr/fe)
+       $(call installto, $(PLATIND)/descr/fe)
+       $(eval $(ACK): $o)
+
+       $(call reset)
+       $(eval q := $D/ack.1.X)
+       $(call installto, $(INSDIR)/share/man/man1/ack.1)
+endef
+
+$(eval $(build-ack-impl))
index 0218c80..b47376b 100644 (file)
@@ -4,6 +4,7 @@
  *
  */
 
+#include <stdlib.h>
 #include "ack.h"
 #include "list.h"
 #include "trans.h"
index 4fbc054..ca089d4 100644 (file)
@@ -10,6 +10,7 @@
 /*                                                                        */
 /**************************************************************************/
 
+#include <stdlib.h>
 #include "ack.h"
 #include "grows.h"
 
index 7bc62a8..278f555 100644 (file)
@@ -4,6 +4,7 @@
  *
  */
 
+#include <stdlib.h>
 #include "ack.h"
 #include "list.h"
 
index d1ce5d2..38b2a54 100644 (file)
@@ -4,6 +4,8 @@
  *
  */
 
+#include <stdlib.h>
+#include <stdio.h>
 #include "ack.h"
 #include <em_path.h>
 #include "list.h"
@@ -11,7 +13,6 @@
 #include "grows.h"
 #include "dmach.h"
 #include "data.h"
-#include <stdio.h>
 
 #ifndef NORCSID
 static char rcs_id[] = "$Id$" ;
diff --git a/util/amisc/build.mk b/util/amisc/build.mk
new file mode 100644 (file)
index 0000000..e7f71e3
--- /dev/null
@@ -0,0 +1,22 @@
+
+define build-simple-tool-impl
+       $(call reset)
+       $(call cfile, util/amisc/$1.c)
+       $(call file, $(LIBOBJECT))
+       $(call cprogram, $(BINDIR)/$1)
+       $(eval INSTALLABLES += $o)
+       $(call installto, $(INSDIR)/bin/$1)
+
+       $(call reset)
+       $(eval q := util/amisc/$1.1)
+       $(call installto, $(INSDIR)/share/man/man1/$1.1)
+endef
+
+build-simple-tool = $(eval $(build-simple-tool-impl))
+
+$(call build-simple-tool,anm)
+$(call build-simple-tool,ashow)
+$(call build-simple-tool,asize)
+$(call build-simple-tool,aslod)
+$(call build-simple-tool,astrip)
+
diff --git a/util/arch/build.mk b/util/arch/build.mk
new file mode 100644 (file)
index 0000000..b70893f
--- /dev/null
@@ -0,0 +1,23 @@
+D := util/arch
+
+define build-aal-impl
+       $(call reset)
+       $(eval cflags += -DAAL)
+
+       $(call cfile, $D/archiver.c)
+
+       $(call file, $(LIBOBJECT))
+       $(call file, $(LIBPRINT))
+       $(call file, $(LIBSTRING))
+       $(call file, $(LIBSYSTEM))
+
+       $(call cprogram, $(BINDIR)/aal)
+       $(call installto, $(INSDIR)/bin/aal)
+       $(eval AAL := $o)
+
+       $(call reset)
+       $(eval q := $D/aal.1)
+       $(call installto, $(INSDIR)/share/man/man1/aal.1)
+endef
+
+$(eval $(build-aal-impl))
diff --git a/util/cmisc/build.mk b/util/cmisc/build.mk
new file mode 100644 (file)
index 0000000..185c3ac
--- /dev/null
@@ -0,0 +1,31 @@
+# Building tabgen.
+
+define build-tabgen-impl
+       $(call reset)
+       $(call cfile, util/cmisc/tabgen.c)
+       $(call cprogram, $(BINDIR)/tabgen)
+       $(eval TABGEN := $o)
+endef
+
+$(eval $(build-tabgen-impl))
+
+# Using tabgen.
+#
+#  $1 = input file
+#
+# Output file is compiled with cfile and queued.
+
+define tabgen-impl
+$(eval g := $(OBJDIR)/$(strip $1).c)
+
+$g: $1 $(TABGEN)
+       @echo TABGEN $g
+       @mkdir -p $(dir $g)
+       $(hide) $(TABGEN) -f$(strip $1) > $g || $(RM) $g
+
+$(eval CLEANABLES += $g)
+$(call cfile,$g)
+endef
+
+tabgen = $(eval $(call tabgen-impl,$1))
+
index 923b2c9..1951e1b 100644 (file)
@@ -61,7 +61,7 @@ replace(idef)
                                return 0;
                }
                if (++mac->mc_count > 100) {
-                       /* 100 must be some number in Parameters */
+                       /* 100 must be some number in parameters.h */
                        warning("macro %s is assumed recursive",
                                    idef->id_text);
                        return 0;
diff --git a/util/data/build.mk b/util/data/build.mk
new file mode 100644 (file)
index 0000000..196bdd5
--- /dev/null
@@ -0,0 +1,29 @@
+D := util/data
+
+define util-data-impl
+
+$(eval g := \
+       $(INCDIR)/em_spec.h \
+       $(INCDIR)/em_pseu.h \
+       $(INCDIR)/em_mnem.h \
+       $(OBJDIR)/$D/em_flag.c \
+       $(OBJDIR)/$D/em_pseu.c \
+       $(OBJDIR)/$D/em_mnem.c)
+
+$(eval CLEANABLES += $g)
+$g: $D/new_table h/em_table
+       @echo DATA
+       @mkdir -p $(dir $g)
+       $(hide) $D/new_table h/em_table $(INCDIR) $(OBJDIR)/$D
+
+$(call reset)
+$(call cfile, $(OBJDIR)/$D/em_flag.c)
+$(call cfile, $(OBJDIR)/$D/em_pseu.c)
+$(call cfile, $(OBJDIR)/$D/em_mnem.c)
+$(call cfile, $D/em_ptyp.c)
+$(call clibrary, $(LIBDIR)/libem_data.a)
+$(eval LIBEM_DATA := $q)
+
+endef
+
+$(eval $(util-data-impl))
index cf30183..7966415 100644 (file)
@@ -57,7 +57,7 @@ struct code_info {
 #define LP_HEADER      lp_extend->lpx_sr.lpx_header
 #define LP_INSTR       lp_extend->lpx_sr.lpx_instr
 
-/* Parameters to be provided by environment: */
+/* parameters.h to be provided by environment: */
 
 extern int ovfl_harmful;  /* Does overflow during multiplication
                            * cause a trap ?
diff --git a/util/ncgg/build.mk b/util/ncgg/build.mk
new file mode 100644 (file)
index 0000000..9757679
--- /dev/null
@@ -0,0 +1,41 @@
+D := util/ncgg
+
+define build-ncgg-impl
+
+$(call reset)
+$(eval cflags += -I$D)
+
+$(call yacc, $(OBJDIR)/$D, $D/cgg.y)
+
+$(call flex, $(OBJDIR)/$D, $D/scan.l)
+$(call dependson, $(OBJDIR)/$D/y.tab.h)
+
+$(call cfile, $D/subr.c)
+$(call cfile, $D/main.c)
+$(call cfile, $D/coerc.c)
+$(call cfile, $D/error.c)
+$(call cfile, $D/emlookup.c)
+$(call cfile, $D/expr.c)
+$(call cfile, $D/instruct.c)
+$(call cfile, $D/iocc.c)
+$(call cfile, $D/lookup.c)
+$(call cfile, $D/output.c)
+$(call cfile, $D/set.c)
+$(call cfile, $D/strlookup.c)
+$(call cfile, $D/var.c)
+$(call cfile, $D/hall.c)
+
+$(eval CLEANABLES += $(OBJDIR)/$D/enterkeyw.c)
+$(OBJDIR)/$D/enterkeyw.c: $D/cvtkeywords $D/keywords
+       @echo KEYWORDS $$@
+       @mkdir -p $$(dir $$@)
+       $(hide) cd $$(dir $$@) && sh $(abspath $D/cvtkeywords) $(abspath $D/keywords)
+$(call cfile, $(OBJDIR)/$D/enterkeyw.c)
+
+$(call file, $(LIBEM_DATA))
+$(call cprogram, $(BINDIR)/ncgg)
+$(eval NCGG := $o)
+
+endef
+
+$(eval $(build-ncgg-impl))
index f46d2d7..24948ab 100644 (file)
@@ -1100,4 +1100,3 @@ optregvartype
                { $$ = $2; }
        ;
 %%
-#include "scan.c"
index 93552b6..46ea6d5 100644 (file)
@@ -7,6 +7,20 @@
 static char rcsid2[]= "$Id$";
 #endif
 
+#include "param.h"
+#include "varinfo.h"
+#include "lookup.h"
+#include "set.h"
+#include "iocc.h"
+#include "instruct.h"
+#include "expr.h"
+#include "extern.h"
+#include <cgg_cg.h>
+#include <em_reg.h>
+#include "y.tab.h"
+
+extern int emhere;
+
 char *mystrcpy();
 int   myatoi();
 
diff --git a/util/opt/build.mk b/util/opt/build.mk
new file mode 100644 (file)
index 0000000..bb3c464
--- /dev/null
@@ -0,0 +1,78 @@
+D := util/opt
+
+define build-opt-mktab-impl
+
+$(call reset)
+$(eval cflags += -I$D)
+
+$(call yacc, $(OBJDIR)/$D, $D/mktab.y)
+
+$(call flex, $(OBJDIR)/$D, $D/scan.l)
+$(call dependson, $(OBJDIR)/$D/y.tab.h)
+
+$(call file, $(LIBEM_DATA))
+$(call file, -lfl)
+$(call cprogram, $D/mktab)
+
+endef
+
+define build-opt-impl
+
+$(call reset)
+$(eval cflags += -I$D)
+$(call cfile, $D/main.c)
+$(call cfile, $D/getline.c)
+$(call cfile, $D/lookup.c)
+$(call cfile, $D/var.c)
+$(call cfile, $D/process.c)
+$(call cfile, $D/backward.c)
+$(call cfile, $D/util.c)
+$(call cfile, $D/alloc.c)
+$(call cfile, $D/putline.c)
+$(call cfile, $D/cleanup.c)
+$(call cfile, $D/peephole.c)
+$(call cfile, $D/flow.c)
+$(call cfile, $D/tes.c)
+$(call cfile, $D/reg.c)
+
+$(eval CLEANABLES += $(OBJDIR)/$D/pop_push.c)
+$(OBJDIR)/$D/pop_push.c: $D/pop_push.awk h/em_table
+       @echo POP_PUSH $$@
+       @mkdir -p $$(dir $$@)
+       $(hide) awk -f $D/pop_push.awk < h/em_table > $$@
+$(call cfile, $(OBJDIR)/$D/pop_push.c)
+
+$(eval CLEANABLES += $(OBJDIR)/$D/pattern.c)
+$(OBJDIR)/$D/pattern.c: $D/mktab $(OBJDIR)/$D/patterns
+       @echo PATTERNS $$@
+       @mkdir -p $$(dir $$@)
+       $(hide) $D/mktab < $(OBJDIR)/$D/patterns > $$@
+$(call cfile, $(OBJDIR)/$D/pattern.c)
+
+$(eval CLEANABLES += $(OBJDIR)/$D/patterns)
+$(OBJDIR)/$D/patterns: $(CPPANSI) $D/patterns
+       @echo PREPROCESS $$@
+       @mkdir -p $$(dir $$@)
+       $(hide) $(CPPANSI) < $D/patterns > $$@
+
+$(call file, $(LIBEM_DATA))
+$(call file, $(LIBASSERT))
+$(call file, $(LIBPRINT))
+$(call file, $(LIBALLOC))
+$(call file, $(LIBSYSTEM))
+$(call file, $(LIBSTRING))
+
+$(eval $q: $(INCDIR)/em_spec.h)
+
+$(call cprogram, $(BINDIR)/em_opt)
+$(call installto, $(PLATDEP)/em_opt)
+$(eval EM_OPT := $o)
+
+$(call reset)
+$(eval q := $D/em_opt.6)
+$(call installto, $(INSDIR)/share/man/man6/em_opt.6)
+
+endef
+
+$(eval $(build-opt-mktab-impl))
+$(eval $(build-opt-impl))
index a4b5c84..08beaec 100644 (file)
@@ -421,4 +421,3 @@ out(w) {
        }
 }
 
-#include "scan.c"
index 85d4aee..1c26f18 100644 (file)
@@ -11,6 +11,11 @@ static char rcsid2[] = "$Id$";
  */
 
 extern long atol();
+extern char patid[128];
+extern int lino;
+
+#include "y.tab.h"
+
 %}
 %%
 \"[^"]*\"      { strncpy(patid,yytext,sizeof(patid)); return(STRING); }