From c1aca7dae5fd36249da452c79d2d928590253f11 Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 12 May 2013 20:45:55 +0100 Subject: [PATCH] First milestone of replacing the build system. --HG-- branch : dtrg-buildsystem rename : lang/cem/cpp.ansi/Parameters => lang/cem/cpp.ansi/parameters.h --- Makefile | 84 ++++++++ first/core.mk | 199 ++++++++++++++++++ lang/cem/build.mk | 6 + lang/cem/cemcom.ansi/LLlex.c | 7 +- lang/cem/cemcom.ansi/LLlex.h | 1 - lang/cem/cemcom.ansi/LLmessage.c | 1 - lang/cem/cemcom.ansi/align.h | 3 +- lang/cem/cemcom.ansi/arith.c | 5 +- lang/cem/cemcom.ansi/arith.h | 2 +- lang/cem/cemcom.ansi/assert.h | 4 +- lang/cem/cemcom.ansi/blocks.c | 2 +- lang/cem/cemcom.ansi/build.mk | 156 ++++++++++++++ lang/cem/cemcom.ansi/ch3.c | 6 +- lang/cem/cemcom.ansi/ch3bin.c | 5 +- lang/cem/cemcom.ansi/ch3mon.c | 6 +- lang/cem/cemcom.ansi/code.c | 9 +- lang/cem/cemcom.ansi/conversion.c | 2 +- lang/cem/cemcom.ansi/cstoper.c | 3 +- lang/cem/cemcom.ansi/dataflow.c | 2 +- lang/cem/cemcom.ansi/declar.g | 7 +- lang/cem/cemcom.ansi/declarator.c | 4 +- lang/cem/cemcom.ansi/def.str | 2 +- lang/cem/cemcom.ansi/domacro.c | 17 +- lang/cem/cemcom.ansi/dumpidf.c | 5 +- lang/cem/cemcom.ansi/error.c | 7 +- lang/cem/cemcom.ansi/eval.c | 9 +- lang/cem/cemcom.ansi/expr.c | 8 +- lang/cem/cemcom.ansi/expression.g | 4 +- lang/cem/cemcom.ansi/field.c | 5 +- lang/cem/cemcom.ansi/fltcstoper.c | 4 +- lang/cem/cemcom.ansi/idf.c | 9 +- lang/cem/cemcom.ansi/idf.str | 2 +- lang/cem/cemcom.ansi/init.c | 4 +- lang/cem/cemcom.ansi/input.c | 5 +- lang/cem/cemcom.ansi/ival.g | 8 +- lang/cem/cemcom.ansi/l_comment.c | 3 +- lang/cem/cemcom.ansi/l_ev_ord.c | 3 +- lang/cem/cemcom.ansi/l_lint.c | 4 +- lang/cem/cemcom.ansi/l_misc.c | 3 +- lang/cem/cemcom.ansi/l_outdef.c | 3 +- lang/cem/cemcom.ansi/l_states.c | 4 +- lang/cem/cemcom.ansi/label.c | 3 +- lang/cem/cemcom.ansi/macro.str | 2 +- lang/cem/cemcom.ansi/main.c | 10 +- lang/cem/cemcom.ansi/make.next | 2 +- lang/cem/cemcom.ansi/options.c | 10 +- lang/cem/cemcom.ansi/pragma.c | 3 +- lang/cem/cemcom.ansi/program.g | 6 +- lang/cem/cemcom.ansi/proto.c | 8 +- lang/cem/cemcom.ansi/replace.c | 12 +- lang/cem/cemcom.ansi/sizes.h | 3 +- lang/cem/cemcom.ansi/skip.c | 2 +- lang/cem/cemcom.ansi/stab.c | 4 +- lang/cem/cemcom.ansi/stack.c | 6 +- lang/cem/cemcom.ansi/statement.g | 8 +- lang/cem/cemcom.ansi/struct.c | 6 +- lang/cem/cemcom.ansi/switch.c | 6 +- lang/cem/cemcom.ansi/tokenname.c | 3 +- lang/cem/cemcom.ansi/type.c | 6 +- lang/cem/cemcom.ansi/type.str | 3 +- lang/cem/cemcom.ansi/util.c | 5 +- lang/cem/cemcom/eval.c | 2 +- lang/cem/cemcom/replace.c | 2 +- lang/cem/cpp.ansi/LLlex.c | 4 +- lang/cem/cpp.ansi/bits.h | 2 +- lang/cem/cpp.ansi/build.mk | 104 +++++++++ lang/cem/cpp.ansi/domacro.c | 10 +- lang/cem/cpp.ansi/error.c | 2 +- lang/cem/cpp.ansi/input.h | 1 - lang/cem/cpp.ansi/main.c | 4 +- lang/cem/cpp.ansi/make.hfiles | 35 --- lang/cem/cpp.ansi/options.c | 2 +- .../cem/cpp.ansi/{Parameters => parameters.h} | 33 ++- lang/cem/cpp.ansi/preprocess.c | 5 +- lang/cem/cpp.ansi/replace.c | 8 +- lang/cem/libcc.ansi/build.mk | 36 ++++ lang/pc/comp/enter.c | 2 +- lib/descr/fe | 30 +-- mach/proto/as/build.mk | 43 ++++ mach/proto/ncg/build.mk | 46 ++++ modules/src/alloc/build.mk | 23 ++ modules/src/em_code/build.mk | 89 ++++++++ modules/src/em_code/insert.c | 1 + modules/src/em_mes/build.mk | 26 +++ modules/src/flt_arith/build.mk | 29 +++ modules/src/idf/build.mk | 14 ++ modules/src/input/build.mk | 20 ++ modules/src/object/build.mk | 27 +++ modules/src/print/build.mk | 22 ++ modules/src/string/build.mk | 19 ++ modules/src/system/build.mk | 29 +++ plat/build.mk | 26 +++ plat/cpm/build.mk | 14 ++ plat/cpm/descr | 12 +- plat/cpm/libsys/build.mk | 28 +++ plat/pc86/build.mk | 14 ++ plat/pc86/descr | 12 +- plat/pc86/libsys/build.mk | 26 +++ util/LLgen/build.mk | 55 +++++ util/LLgen/src/compute.c | 1 + util/LLgen/src/gencode.c | 1 + util/LLgen/src/savegram.c | 1 + util/ack/build.mk | 57 +++++ util/ack/files.c | 1 + util/ack/grows.c | 1 + util/ack/list.c | 1 + util/ack/rmach.c | 3 +- util/amisc/build.mk | 22 ++ util/arch/build.mk | 23 ++ util/cmisc/build.mk | 31 +++ util/cpp/replace.c | 2 +- util/data/build.mk | 29 +++ util/ego/sr/sr.h | 2 +- util/ncgg/build.mk | 41 ++++ util/ncgg/cgg.y | 1 - util/ncgg/scan.l | 14 ++ util/opt/build.mk | 78 +++++++ util/opt/mktab.y | 1 - util/opt/scan.l | 5 + 119 files changed, 1584 insertions(+), 319 deletions(-) create mode 100644 Makefile create mode 100644 first/core.mk create mode 100644 lang/cem/build.mk create mode 100644 lang/cem/cemcom.ansi/build.mk create mode 100644 lang/cem/cpp.ansi/build.mk delete mode 100755 lang/cem/cpp.ansi/make.hfiles rename lang/cem/cpp.ansi/{Parameters => parameters.h} (72%) create mode 100644 lang/cem/libcc.ansi/build.mk create mode 100644 mach/proto/as/build.mk create mode 100644 mach/proto/ncg/build.mk create mode 100644 modules/src/alloc/build.mk create mode 100644 modules/src/em_code/build.mk create mode 100644 modules/src/em_mes/build.mk create mode 100644 modules/src/flt_arith/build.mk create mode 100644 modules/src/idf/build.mk create mode 100644 modules/src/input/build.mk create mode 100644 modules/src/object/build.mk create mode 100644 modules/src/print/build.mk create mode 100644 modules/src/string/build.mk create mode 100644 modules/src/system/build.mk create mode 100644 plat/build.mk create mode 100644 plat/cpm/build.mk create mode 100644 plat/cpm/libsys/build.mk create mode 100644 plat/pc86/build.mk create mode 100644 plat/pc86/libsys/build.mk create mode 100644 util/LLgen/build.mk create mode 100644 util/ack/build.mk create mode 100644 util/amisc/build.mk create mode 100644 util/arch/build.mk create mode 100644 util/cmisc/build.mk create mode 100644 util/data/build.mk create mode 100644 util/ncgg/build.mk create mode 100644 util/opt/build.mk diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..7c6371dfc --- /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 index 000000000..898cf0d03 --- /dev/null +++ b/first/core.mk @@ -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 index 000000000..23e0dba95 --- /dev/null +++ b/lang/cem/build.mk @@ -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)) + diff --git a/lang/cem/cemcom.ansi/LLlex.c b/lang/cem/cemcom.ansi/LLlex.c index 9736b4420..07a79ad8e 100644 --- a/lang/cem/cemcom.ansi/LLlex.c +++ b/lang/cem/cemcom.ansi/LLlex.c @@ -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 -#include "idfsize.h" -#include "numsize.h" -#include "strsize.h" -#include "nopp.h" +#include "parameters.h" #include "input.h" #include "arith.h" #include "def.h" diff --git a/lang/cem/cemcom.ansi/LLlex.h b/lang/cem/cemcom.ansi/LLlex.h index 7fb88292d..90b003954 100644 --- a/lang/cem/cemcom.ansi/LLlex.h +++ b/lang/cem/cemcom.ansi/LLlex.h @@ -11,7 +11,6 @@ */ #include "file_info.h" -#include "nopp.h" /* the structure of a token: */ struct token { diff --git a/lang/cem/cemcom.ansi/LLmessage.c b/lang/cem/cemcom.ansi/LLmessage.c index c88c5eb24..9010ce45d 100644 --- a/lang/cem/cemcom.ansi/LLmessage.c +++ b/lang/cem/cemcom.ansi/LLmessage.c @@ -6,7 +6,6 @@ /* PARSER ERROR ADMINISTRATION */ #include -#include "idf.h" #include "arith.h" #include "LLlex.h" #include "Lpars.h" diff --git a/lang/cem/cemcom.ansi/align.h b/lang/cem/cemcom.ansi/align.h index 1e4ee3f94..79b9be97b 100644 --- a/lang/cem/cemcom.ansi/align.h +++ b/lang/cem/cemcom.ansi/align.h @@ -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 diff --git a/lang/cem/cemcom.ansi/arith.c b/lang/cem/cemcom.ansi/arith.c index ed3dc5004..d5f3af3e7 100644 --- a/lang/cem/cemcom.ansi/arith.c +++ b/lang/cem/cemcom.ansi/arith.c @@ -11,11 +11,8 @@ semantics of C is a mess. */ +#include "parameters.h" #include -#include "debug.h" -#include "lint.h" -#include "nobitfield.h" -#include "idf.h" #include #include "arith.h" #include "sizes.h" diff --git a/lang/cem/cemcom.ansi/arith.h b/lang/cem/cemcom.ansi/arith.h index 399e2645a..4bb403458 100644 --- a/lang/cem/cemcom.ansi/arith.h +++ b/lang/cem/cemcom.ansi/arith.h @@ -13,7 +13,7 @@ be handy. */ -#include "spec_arith.h" +#include "parameters.h" #ifndef SPECIAL_ARITHMETICS diff --git a/lang/cem/cemcom.ansi/assert.h b/lang/cem/cemcom.ansi/assert.h index 2210f792a..da650dad3 100644 --- a/lang/cem/cemcom.ansi/assert.h +++ b/lang/cem/cemcom.ansi/assert.h @@ -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 */ diff --git a/lang/cem/cemcom.ansi/blocks.c b/lang/cem/cemcom.ansi/blocks.c index 88c6a49e3..6d75a3670 100644 --- a/lang/cem/cemcom.ansi/blocks.c +++ b/lang/cem/cemcom.ansi/blocks.c @@ -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 diff --git a/lang/cem/cemcom.ansi/build.mk b/lang/cem/cemcom.ansi/build.mk new file mode 100644 index 000000000..f47959ab9 --- /dev/null +++ b/lang/cem/cemcom.ansi/build.mk @@ -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)) diff --git a/lang/cem/cemcom.ansi/ch3.c b/lang/cem/cemcom.ansi/ch3.c index 6270dfd4a..bebe77efa 100644 --- a/lang/cem/cemcom.ansi/ch3.c +++ b/lang/cem/cemcom.ansi/ch3.c @@ -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 #include "arith.h" +#include "idf.h" #include "proto.h" #include "type.h" #include "struct.h" diff --git a/lang/cem/cemcom.ansi/ch3bin.c b/lang/cem/cemcom.ansi/ch3bin.c index cb30e1087..8145b933d 100644 --- a/lang/cem/cemcom.ansi/ch3bin.c +++ b/lang/cem/cemcom.ansi/ch3bin.c @@ -5,11 +5,8 @@ /* $Id$ */ /* SEMANTIC ANALYSIS (CHAPTER 3.3) -- BINARY OPERATORS */ -#include "botch_free.h" -#include "debug.h" +#include "parameters.h" #include -#include "lint.h" -#include "idf.h" #include #include "arith.h" #include "type.h" diff --git a/lang/cem/cemcom.ansi/ch3mon.c b/lang/cem/cemcom.ansi/ch3mon.c index 40cc44025..8cffc2c9d 100644 --- a/lang/cem/cemcom.ansi/ch3mon.c +++ b/lang/cem/cemcom.ansi/ch3mon.c @@ -5,17 +5,15 @@ /* $Id$ */ /* SEMANTIC ANALYSIS (CHAPTER 3.3) -- MONADIC OPERATORS */ -#include "botch_free.h" -#include "debug.h" +#include "parameters.h" #include -#include "nobitfield.h" #include "Lpars.h" #include +#include "idf.h" #include "arith.h" #include "type.h" #include "label.h" #include "expr.h" -#include "idf.h" #include "def.h" #include "sizes.h" diff --git a/lang/cem/cemcom.ansi/code.c b/lang/cem/cemcom.ansi/code.c index 6289529ae..1beeb12c4 100644 --- a/lang/cem/cemcom.ansi/code.c +++ b/lang/cem/cemcom.ansi/code.c @@ -7,23 +7,18 @@ #include #include -#include "lint.h" -#include "debug.h" -#include "dbsymtab.h" +#include "parameters.h" #ifndef LINT #include #else #include "l_em.h" #include "l_lint.h" #endif /* LINT */ -#include "botch_free.h" #include -#include "dataflow.h" -#include "use_tmp.h" #include +#include "idf.h" #include "arith.h" #include "type.h" -#include "idf.h" #include "label.h" #include "code.h" #include "stmt.h" diff --git a/lang/cem/cemcom.ansi/conversion.c b/lang/cem/cemcom.ansi/conversion.c index 6627a30e1..485d8b8bd 100644 --- a/lang/cem/cemcom.ansi/conversion.c +++ b/lang/cem/cemcom.ansi/conversion.c @@ -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 diff --git a/lang/cem/cemcom.ansi/cstoper.c b/lang/cem/cemcom.ansi/cstoper.c index c86f122be..ac11c2ca9 100644 --- a/lang/cem/cemcom.ansi/cstoper.c +++ b/lang/cem/cemcom.ansi/cstoper.c @@ -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 #include "arith.h" #include "type.h" diff --git a/lang/cem/cemcom.ansi/dataflow.c b/lang/cem/cemcom.ansi/dataflow.c index e6f00abac..6a3fbcf65 100644 --- a/lang/cem/cemcom.ansi/dataflow.c +++ b/lang/cem/cemcom.ansi/dataflow.c @@ -9,7 +9,7 @@ Use the compiler option --d. */ -#include "dataflow.h" /* UF */ +#include "parameters.h" /* UF */ #ifdef DATAFLOW char *CurrentFunction = 0; diff --git a/lang/cem/cemcom.ansi/declar.g b/lang/cem/cemcom.ansi/declar.g index 4322cbeb0..d6119f59d 100644 --- a/lang/cem/cemcom.ansi/declar.g +++ b/lang/cem/cemcom.ansi/declar.g @@ -6,17 +6,14 @@ /* DECLARATION SYNTAX PARSER */ { -#include "lint.h" -#include "dbsymtab.h" +#include "parameters.h" #include -#include "nobitfield.h" -#include "debug.h" #include +#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" diff --git a/lang/cem/cemcom.ansi/declarator.c b/lang/cem/cemcom.ansi/declarator.c index 3d33a83be..212b8aeb1 100644 --- a/lang/cem/cemcom.ansi/declarator.c +++ b/lang/cem/cemcom.ansi/declarator.c @@ -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 #include #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" diff --git a/lang/cem/cemcom.ansi/def.str b/lang/cem/cemcom.ansi/def.str index adee48607..0ad7af339 100644 --- a/lang/cem/cemcom.ansi/def.str +++ b/lang/cem/cemcom.ansi/def.str @@ -5,7 +5,7 @@ /* $Id$ */ /* IDENTIFIER DEFINITION DESCRIPTOR */ -#include "lint.h" +#include "parameters.h" struct def { /* for ordinary tags */ struct def *next; diff --git a/lang/cem/cemcom.ansi/domacro.c b/lang/cem/cemcom.ansi/domacro.c index f2ac213aa..4173a11b2 100644 --- a/lang/cem/cemcom.ansi/domacro.c +++ b/lang/cem/cemcom.ansi/domacro.c @@ -5,29 +5,20 @@ /* $Id$ */ /* PREPROCESSOR: CONTROLLINE INTERPRETER */ -#include "debug.h" +#include +#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 #include "class.h" #include "macro.h" -#include "macbuf.h" -#include "replace.h" -#include "dbsymtab.h" #ifdef DBSYMTAB #include #include diff --git a/lang/cem/cemcom.ansi/dumpidf.c b/lang/cem/cemcom.ansi/dumpidf.c index 18f425f26..849354bd3 100644 --- a/lang/cem/cemcom.ansi/dumpidf.c +++ b/lang/cem/cemcom.ansi/dumpidf.c @@ -5,16 +5,13 @@ /* $Id$ */ /* DUMP ROUTINES */ -#include "debug.h" #ifdef DEBUG +#include "parameters.h" #include -#include "nopp.h" -#include "nobitfield.h" #include #include "arith.h" #include "stack.h" -#include "idf.h" #include "def.h" #include "type.h" #include "proto.h" diff --git a/lang/cem/cemcom.ansi/error.c b/lang/cem/cemcom.ansi/error.c index 4b92b3261..10b237db4 100644 --- a/lang/cem/cemcom.ansi/error.c +++ b/lang/cem/cemcom.ansi/error.c @@ -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 #else @@ -18,11 +18,6 @@ #include "l_em.h" #endif /* LINT */ -#include "debug.h" -#include "lint.h" -#include "nopp.h" -#include "errout.h" - #include "tokenname.h" #include #include "arith.h" diff --git a/lang/cem/cemcom.ansi/eval.c b/lang/cem/cemcom.ansi/eval.c index 78a283c62..16f19c0ad 100644 --- a/lang/cem/cemcom.ansi/eval.c +++ b/lang/cem/cemcom.ansi/eval.c @@ -5,19 +5,16 @@ /* $Id$ */ /* EXPRESSION-CODE GENERATOR */ -#include "lint.h" +#include "parameters.h" #ifndef LINT #include #include #include -#include "debug.h" -#include "nobitfield.h" -#include "dataflow.h" #include +#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 diff --git a/lang/cem/cemcom.ansi/expr.c b/lang/cem/cemcom.ansi/expr.c index 6f0eb2c4f..6d8c1e23d 100644 --- a/lang/cem/cemcom.ansi/expr.c +++ b/lang/cem/cemcom.ansi/expr.c @@ -5,13 +5,12 @@ /* $Id$ */ /* EXPRESSION TREE HANDLING */ -#include "lint.h" -#include "debug.h" +#include +#include "parameters.h" #include "assert.h" -#include "botch_free.h" #include -#include "idf.h" #include +#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[]; diff --git a/lang/cem/cemcom.ansi/expression.g b/lang/cem/cemcom.ansi/expression.g index e80281299..3a1284e69 100644 --- a/lang/cem/cemcom.ansi/expression.g +++ b/lang/cem/cemcom.ansi/expression.g @@ -7,13 +7,11 @@ { #include -#include "lint.h" -#include "debug.h" +#include "parameters.h" #include #include "arith.h" #include "LLlex.h" #include "type.h" -#include "idf.h" #include "label.h" #include "expr.h" #include "code.h" diff --git a/lang/cem/cemcom.ansi/field.c b/lang/cem/cemcom.ansi/field.c index 3f8c07a57..1514942e2 100644 --- a/lang/cem/cemcom.ansi/field.c +++ b/lang/cem/cemcom.ansi/field.c @@ -5,19 +5,16 @@ /* $Id$ */ /* BITFIELD EXPRESSION EVALUATOR */ -#include "lint.h" +#include "parameters.h" #ifndef LINT -#include "nobitfield.h" #ifndef NOBITFIELD #include #include -#include "debug.h" #include #include "arith.h" #include "type.h" -#include "idf.h" #include "label.h" #include "code.h" #include "assert.h" diff --git a/lang/cem/cemcom.ansi/fltcstoper.c b/lang/cem/cemcom.ansi/fltcstoper.c index 8ac330df7..de4d26e51 100644 --- a/lang/cem/cemcom.ansi/fltcstoper.c +++ b/lang/cem/cemcom.ansi/fltcstoper.c @@ -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 -#include "trgt_sizes.h" -#include "idf.h" #include #include "arith.h" #include "type.h" diff --git a/lang/cem/cemcom.ansi/idf.c b/lang/cem/cemcom.ansi/idf.c index 56db5c20e..eb43e34bb 100644 --- a/lang/cem/cemcom.ansi/idf.c +++ b/lang/cem/cemcom.ansi/idf.c @@ -7,20 +7,15 @@ #include #include -#include "lint.h" +#include "parameters.h" #include -#include "debug.h" -#include "idfsize.h" -#include "botch_free.h" -#include "nopp.h" -#include "nparams.h" #include +#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" diff --git a/lang/cem/cemcom.ansi/idf.str b/lang/cem/cemcom.ansi/idf.str index c4d01ea4b..fab968321 100644 --- a/lang/cem/cemcom.ansi/idf.str +++ b/lang/cem/cemcom.ansi/idf.str @@ -5,7 +5,7 @@ /* $Id$ */ /* IDENTIFIER DESCRIPTOR */ -#include "nopp.h" +#include "parameters.h" struct id_u { #ifndef NOPP diff --git a/lang/cem/cemcom.ansi/init.c b/lang/cem/cemcom.ansi/init.c index d59b1de18..bb1fd5559 100644 --- a/lang/cem/cemcom.ansi/init.c +++ b/lang/cem/cemcom.ansi/init.c @@ -7,15 +7,15 @@ #include #include -#include "nopp.h" +#include "parameters.h" #ifndef NOPP #include #include #include +#include "idf.h" #include "class.h" #include "macro.h" -#include "idf.h" extern char *sprint(); diff --git a/lang/cem/cemcom.ansi/input.c b/lang/cem/cemcom.ansi/input.c index e10aacb5a..fc1e99f28 100644 --- a/lang/cem/cemcom.ansi/input.c +++ b/lang/cem/cemcom.ansi/input.c @@ -4,10 +4,10 @@ */ /* $Id$ */ +#include "parameters.h" #include #include #include -#include "inputtype.h" #include "file_info.h" #include "input.h" @@ -15,12 +15,9 @@ #define INP_TYPE struct file_info #define INP_VAR finfo struct file_info finfo; -#include "nopp.h" #include #include -#include "dbsymtab.h" -#include "lint.h" #ifndef NOPP #ifdef DBSYMTAB #include diff --git a/lang/cem/cemcom.ansi/ival.g b/lang/cem/cemcom.ansi/ival.g index 0304d75ef..b085ebc73 100644 --- a/lang/cem/cemcom.ansi/ival.g +++ b/lang/cem/cemcom.ansi/ival.g @@ -6,18 +6,18 @@ /* CODE FOR THE INITIALISATION OF GLOBAL VARIABLES */ { -#include "lint.h" +#include +#include "parameters.h" #ifndef LINT #include #else #include "l_em.h" #include "l_lint.h" #endif /* LINT */ -#include "debug.h" #include #include -#include "nobitfield.h" #include +#include "idf.h" #include "arith.h" #include "label.h" #include "expr.h" @@ -29,11 +29,11 @@ #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) diff --git a/lang/cem/cemcom.ansi/l_comment.c b/lang/cem/cemcom.ansi/l_comment.c index da9d2b776..2ab983a85 100644 --- a/lang/cem/cemcom.ansi/l_comment.c +++ b/lang/cem/cemcom.ansi/l_comment.c @@ -5,10 +5,9 @@ /* $Id$ */ /* Lint-specific comment handling */ +#include "parameters.h" #include -#include "lint.h" - #ifdef LINT #include diff --git a/lang/cem/cemcom.ansi/l_ev_ord.c b/lang/cem/cemcom.ansi/l_ev_ord.c index 56515ebb0..c5d7550a3 100644 --- a/lang/cem/cemcom.ansi/l_ev_ord.c +++ b/lang/cem/cemcom.ansi/l_ev_ord.c @@ -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" diff --git a/lang/cem/cemcom.ansi/l_lint.c b/lang/cem/cemcom.ansi/l_lint.c index 497d7bd64..5f95cb0fa 100644 --- a/lang/cem/cemcom.ansi/l_lint.c +++ b/lang/cem/cemcom.ansi/l_lint.c @@ -5,12 +5,11 @@ /* $Id$ */ /* Lint main routines */ -#include "lint.h" +#include "parameters.h" #ifdef LINT #include /* 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" diff --git a/lang/cem/cemcom.ansi/l_misc.c b/lang/cem/cemcom.ansi/l_misc.c index 5e8cd080d..c09c84b8b 100644 --- a/lang/cem/cemcom.ansi/l_misc.c +++ b/lang/cem/cemcom.ansi/l_misc.c @@ -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" diff --git a/lang/cem/cemcom.ansi/l_outdef.c b/lang/cem/cemcom.ansi/l_outdef.c index a88945f6e..32e2172b8 100644 --- a/lang/cem/cemcom.ansi/l_outdef.c +++ b/lang/cem/cemcom.ansi/l_outdef.c @@ -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" diff --git a/lang/cem/cemcom.ansi/l_states.c b/lang/cem/cemcom.ansi/l_states.c index 99e1a4971..74d31b359 100644 --- a/lang/cem/cemcom.ansi/l_states.c +++ b/lang/cem/cemcom.ansi/l_states.c @@ -5,21 +5,19 @@ /* $Id$ */ /* Lint status checking */ -#include "lint.h" +#include "parameters.h" #ifdef LINT #include /* for st_free */ #include "interface.h" #include "assert.h" -#include "debug.h" #ifdef ANSI #include #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" diff --git a/lang/cem/cemcom.ansi/label.c b/lang/cem/cemcom.ansi/label.c index 643000452..fb200956e 100644 --- a/lang/cem/cemcom.ansi/label.c +++ b/lang/cem/cemcom.ansi/label.c @@ -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" diff --git a/lang/cem/cemcom.ansi/macro.str b/lang/cem/cemcom.ansi/macro.str index 1414741c4..f229cac9b 100644 --- a/lang/cem/cemcom.ansi/macro.str +++ b/lang/cem/cemcom.ansi/macro.str @@ -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 diff --git a/lang/cem/cemcom.ansi/main.c b/lang/cem/cemcom.ansi/main.c index 4f56feb1d..556e23495 100644 --- a/lang/cem/cemcom.ansi/main.c +++ b/lang/cem/cemcom.ansi/main.c @@ -5,16 +5,11 @@ /* $Id$ */ /* MAIN PROGRAM */ -#include "lint.h" +#include "parameters.h" #include -#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 #include "specials.h" -#include "nocross.h" #include "sizes.h" #include "align.h" #include "macro.h" diff --git a/lang/cem/cemcom.ansi/make.next b/lang/cem/cemcom.ansi/make.next index 26c24d0ce..06d50f0e0 100755 --- a/lang/cem/cemcom.ansi/make.next +++ b/lang/cem/cemcom.ansi/make.next @@ -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\ diff --git a/lang/cem/cemcom.ansi/options.c b/lang/cem/cemcom.ansi/options.c index 379c7c603..a8f382302 100644 --- a/lang/cem/cemcom.ansi/options.c +++ b/lang/cem/cemcom.ansi/options.c @@ -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 #include -#include "lint.h" -#include "botch_free.h" #include -#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; diff --git a/lang/cem/cemcom.ansi/pragma.c b/lang/cem/cemcom.ansi/pragma.c index 92739dd9a..b4198d92b 100644 --- a/lang/cem/cemcom.ansi/pragma.c +++ b/lang/cem/cemcom.ansi/pragma.c @@ -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 diff --git a/lang/cem/cemcom.ansi/program.g b/lang/cem/cemcom.ansi/program.g index 937effab6..861c97b2e 100644 --- a/lang/cem/cemcom.ansi/program.g +++ b/lang/cem/cemcom.ansi/program.g @@ -45,13 +45,10 @@ %start If_expr, control_if_expression; { -#include "lint.h" -#include "nopp.h" -#include "debug.h" +#include "parameters.h" #include #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 */ diff --git a/lang/cem/cemcom.ansi/proto.c b/lang/cem/cemcom.ansi/proto.c index e1ff73a5e..1f7f6bf6d 100644 --- a/lang/cem/cemcom.ansi/proto.c +++ b/lang/cem/cemcom.ansi/proto.c @@ -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 +#include "idf.h" #include "Lpars.h" #include "level.h" #include #include "arith.h" #include "align.h" #include "stack.h" -#include "idf.h" #include "def.h" #include "type.h" #include "struct.h" diff --git a/lang/cem/cemcom.ansi/replace.c b/lang/cem/cemcom.ansi/replace.c index 856c38d03..cde3aaf43 100644 --- a/lang/cem/cemcom.ansi/replace.c +++ b/lang/cem/cemcom.ansi/replace.c @@ -7,26 +7,18 @@ #include #include -#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 -#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(); diff --git a/lang/cem/cemcom.ansi/sizes.h b/lang/cem/cemcom.ansi/sizes.h index 69785fd04..0f38c5668 100644 --- a/lang/cem/cemcom.ansi/sizes.h +++ b/lang/cem/cemcom.ansi/sizes.h @@ -5,8 +5,7 @@ /* $Id$ */ /* VARIOUS TARGET MACHINE SIZE DESCRIPTORS */ -#include "nocross.h" -#include "trgt_sizes.h" +#include "parameters.h" #ifndef NOCROSS extern arith diff --git a/lang/cem/cemcom.ansi/skip.c b/lang/cem/cemcom.ansi/skip.c index c3687fd0a..d4a67142e 100644 --- a/lang/cem/cemcom.ansi/skip.c +++ b/lang/cem/cemcom.ansi/skip.c @@ -5,7 +5,7 @@ /* $Id$ */ /* PREPROCESSOR: INPUT SKIP FUNCTIONS */ -#include "nopp.h" +#include "parameters.h" #include "arith.h" #include "LLlex.h" #include "class.h" diff --git a/lang/cem/cemcom.ansi/stab.c b/lang/cem/cemcom.ansi/stab.c index 401d91b40..8c00838e3 100644 --- a/lang/cem/cemcom.ansi/stab.c +++ b/lang/cem/cemcom.ansi/stab.c @@ -9,7 +9,7 @@ /* $Id$ */ -#include "dbsymtab.h" +#include "parameters.h" #ifdef DBSYMTAB @@ -20,13 +20,13 @@ #include #include +#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" diff --git a/lang/cem/cemcom.ansi/stack.c b/lang/cem/cemcom.ansi/stack.c index b0cf97cab..49dfbfab4 100644 --- a/lang/cem/cemcom.ansi/stack.c +++ b/lang/cem/cemcom.ansi/stack.c @@ -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 #ifndef LINT #include #else #include "l_em.h" #endif /* LINT */ -#include "debug.h" -#include "botch_free.h" #include +#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" diff --git a/lang/cem/cemcom.ansi/statement.g b/lang/cem/cemcom.ansi/statement.g index 97fd969cc..9eb60d2ed 100644 --- a/lang/cem/cemcom.ansi/statement.g +++ b/lang/cem/cemcom.ansi/statement.g @@ -6,7 +6,7 @@ /* STATEMENT SYNTAX PARSER */ { -#include "lint.h" +#include "parameters.h" #ifndef LINT #include #else @@ -14,15 +14,11 @@ #include "l_lint.h" #endif /* LINT */ -#include "debug.h" -#include "botch_free.h" -#include "dbsymtab.h" - #include +#include "idf.h" #include "arith.h" #include "LLlex.h" #include "type.h" -#include "idf.h" #include "label.h" #include "expr.h" #include "code.h" diff --git a/lang/cem/cemcom.ansi/struct.c b/lang/cem/cemcom.ansi/struct.c index 805df0ba5..505107cc8 100644 --- a/lang/cem/cemcom.ansi/struct.c +++ b/lang/cem/cemcom.ansi/struct.c @@ -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 +#include "idf.h" #include "arith.h" #include "stack.h" -#include "idf.h" #include "def.h" #include "type.h" #include "proto.h" diff --git a/lang/cem/cemcom.ansi/switch.c b/lang/cem/cemcom.ansi/switch.c index 59413f668..856e1b115 100644 --- a/lang/cem/cemcom.ansi/switch.c +++ b/lang/cem/cemcom.ansi/switch.c @@ -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 #else #include "l_em.h" #endif /* LINT */ -#include "debug.h" -#include "botch_free.h" #include -#include "density.h" #include "Lpars.h" -#include "idf.h" #include "label.h" #include #include "arith.h" diff --git a/lang/cem/cemcom.ansi/tokenname.c b/lang/cem/cemcom.ansi/tokenname.c index 75e593174..8c52b4dcb 100644 --- a/lang/cem/cemcom.ansi/tokenname.c +++ b/lang/cem/cemcom.ansi/tokenname.c @@ -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" diff --git a/lang/cem/cemcom.ansi/type.c b/lang/cem/cemcom.ansi/type.c index ef0d2cdf0..2b477a725 100644 --- a/lang/cem/cemcom.ansi/type.c +++ b/lang/cem/cemcom.ansi/type.c @@ -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 +#include "idf.h" #include "Lpars.h" #include "arith.h" #include "type.h" -#include "idf.h" #include "def.h" #include "proto.h" #include "sizes.h" diff --git a/lang/cem/cemcom.ansi/type.str b/lang/cem/cemcom.ansi/type.str index c1c6205d6..8796d61a4 100644 --- a/lang/cem/cemcom.ansi/type.str +++ b/lang/cem/cemcom.ansi/type.str @@ -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 */ diff --git a/lang/cem/cemcom.ansi/util.c b/lang/cem/cemcom.ansi/util.c index 9b9d1151c..7326f04ec 100644 --- a/lang/cem/cemcom.ansi/util.c +++ b/lang/cem/cemcom.ansi/util.c @@ -11,7 +11,7 @@ allowing re-use. */ -#include "lint.h" +#include "parameters.h" #ifndef LINT #include #else @@ -22,10 +22,7 @@ #include #include -#include "debug.h" #include "util.h" -#include "use_tmp.h" -#include "regcount.h" #include "sizes.h" #include "align.h" #include "stack.h" diff --git a/lang/cem/cemcom/eval.c b/lang/cem/cemcom/eval.c index abfc1a2b1..542980db4 100644 --- a/lang/cem/cemcom/eval.c +++ b/lang/cem/cemcom/eval.c @@ -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 diff --git a/lang/cem/cemcom/replace.c b/lang/cem/cemcom/replace.c index 15f9c1df8..758d14df8 100644 --- a/lang/cem/cemcom/replace.c +++ b/lang/cem/cemcom/replace.c @@ -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; diff --git a/lang/cem/cpp.ansi/LLlex.c b/lang/cem/cpp.ansi/LLlex.c index e828ac704..3cd162898 100644 --- a/lang/cem/cpp.ansi/LLlex.c +++ b/lang/cem/cpp.ansi/LLlex.c @@ -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 #include "input.h" diff --git a/lang/cem/cpp.ansi/bits.h b/lang/cem/cpp.ansi/bits.h index 95eb2f3ca..7473d935a 100644 --- a/lang/cem/cpp.ansi/bits.h +++ b/lang/cem/cpp.ansi/bits.h @@ -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 index 000000000..e102c523b --- /dev/null +++ b/lang/cem/cpp.ansi/build.mk @@ -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)) diff --git a/lang/cem/cpp.ansi/domacro.c b/lang/cem/cpp.ansi/domacro.c index 47f09af28..a5cc9407d 100644 --- a/lang/cem/cpp.ansi/domacro.c +++ b/lang/cem/cpp.ansi/domacro.c @@ -5,25 +5,19 @@ /* $Id$ */ /* PREPROCESSOR: CONTROLLINE INTERPRETER */ +#include #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 #include #include "class.h" #include "macro.h" #include "bits.h" -#include "macbuf.h" #include "replace.h" extern char options[]; diff --git a/lang/cem/cpp.ansi/error.c b/lang/cem/cpp.ansi/error.c index a567b3d4a..0920976b8 100644 --- a/lang/cem/cpp.ansi/error.c +++ b/lang/cem/cpp.ansi/error.c @@ -12,8 +12,8 @@ #include #endif +#include "parameters.h" #include "arith.h" -#include "errout.h" #include "LLlex.h" /* This file contains the (non-portable) error-message and diagnostic diff --git a/lang/cem/cpp.ansi/input.h b/lang/cem/cpp.ansi/input.h index 97a81983a..55a79acde 100644 --- a/lang/cem/cpp.ansi/input.h +++ b/lang/cem/cpp.ansi/input.h @@ -4,7 +4,6 @@ */ /* $Id$ */ #define INP_PUSHBACK 3 -#include "inputtype.h" #include /* Note: The following macro only garuantees one PushBack. diff --git a/lang/cem/cpp.ansi/main.c b/lang/cem/cpp.ansi/main.c index 46f9fd2b7..db444ae80 100644 --- a/lang/cem/cpp.ansi/main.c +++ b/lang/cem/cpp.ansi/main.c @@ -5,14 +5,14 @@ /* $Id$ */ /* MAIN PROGRAM */ -#include "debug.h" +#include +#include "parameters.h" #include #include #include #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 index 3bc972faf..000000000 --- a/lang/cem/cpp.ansi/make.hfiles +++ /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)" diff --git a/lang/cem/cpp.ansi/options.c b/lang/cem/cpp.ansi/options.c index fb16ef8fb..21d1e2212 100644 --- a/lang/cem/cpp.ansi/options.c +++ b/lang/cem/cpp.ansi/options.c @@ -8,7 +8,7 @@ #include #include #include "alloc.h" -#include "idfsize.h" +#include "parameters.h" #include "class.h" #include "macro.h" #include "idf.h" diff --git a/lang/cem/cpp.ansi/Parameters b/lang/cem/cpp.ansi/parameters.h similarity index 72% rename from lang/cem/cpp.ansi/Parameters rename to lang/cem/cpp.ansi/parameters.h index 091744391..37bdebe12 100644 --- a/lang/cem/cpp.ansi/Parameters +++ b/lang/cem/cpp.ansi/parameters.h @@ -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 + diff --git a/lang/cem/cpp.ansi/preprocess.c b/lang/cem/cpp.ansi/preprocess.c index 72fa647e9..7c3840d80 100644 --- a/lang/cem/cpp.ansi/preprocess.c +++ b/lang/cem/cpp.ansi/preprocess.c @@ -10,16 +10,13 @@ #include #include #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 diff --git a/lang/cem/cpp.ansi/replace.c b/lang/cem/cpp.ansi/replace.c index 94bb22f3a..255902f68 100644 --- a/lang/cem/cpp.ansi/replace.c +++ b/lang/cem/cpp.ansi/replace.c @@ -9,11 +9,7 @@ #include #include -#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 index 000000000..640f7f344 --- /dev/null +++ b/lang/cem/libcc.ansi/build.mk @@ -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)) diff --git a/lang/pc/comp/enter.c b/lang/pc/comp/enter.c index 703b37671..ec50ae9c2 100644 --- a/lang/pc/comp/enter.c +++ b/lang/pc/comp/enter.c @@ -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; diff --git a/lib/descr/fe b/lib/descr/fe index aa2f33bac..2e69b0f3b 100644 --- a/lib/descr/fe +++ b/lib/descr/fe @@ -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 index 000000000..d98fe7454 --- /dev/null +++ b/mach/proto/as/build.mk @@ -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 index 000000000..e3843b7f3 --- /dev/null +++ b/mach/proto/ncg/build.mk @@ -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 index 000000000..808dcca4a --- /dev/null +++ b/modules/src/alloc/build.mk @@ -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 index 000000000..8fcba3c7f --- /dev/null +++ b/modules/src/em_code/build.mk @@ -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, )) + + diff --git a/modules/src/em_code/insert.c b/modules/src/em_code/insert.c index 9da09a430..f7526b8e4 100644 --- a/modules/src/em_code/insert.c +++ b/modules/src/em_code/insert.c @@ -9,6 +9,7 @@ they can be written immediately. */ +#include #include #include #include "insert.h" diff --git a/modules/src/em_mes/build.mk b/modules/src/em_mes/build.mk new file mode 100644 index 000000000..7ae262114 --- /dev/null +++ b/modules/src/em_mes/build.mk @@ -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 index 000000000..6a34b7d46 --- /dev/null +++ b/modules/src/flt_arith/build.mk @@ -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 index 000000000..b8dee6f79 --- /dev/null +++ b/modules/src/idf/build.mk @@ -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 index 000000000..ef6e1aac0 --- /dev/null +++ b/modules/src/input/build.mk @@ -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 index 000000000..d256cba92 --- /dev/null +++ b/modules/src/object/build.mk @@ -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 index 000000000..17974b4d6 --- /dev/null +++ b/modules/src/print/build.mk @@ -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 index 000000000..7139f1e8e --- /dev/null +++ b/modules/src/string/build.mk @@ -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 index 000000000..e76b5c5e3 --- /dev/null +++ b/modules/src/system/build.mk @@ -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 index 000000000..dde75784c --- /dev/null +++ b/plat/build.mk @@ -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 index 000000000..83f029fb5 --- /dev/null +++ b/plat/cpm/build.mk @@ -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 + diff --git a/plat/cpm/descr b/plat/cpm/descr index da320fe39..b1b579938 100644 --- a/plat/cpm/descr +++ b/plat/cpm/descr @@ -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 index 000000000..be6dfa335 --- /dev/null +++ b/plat/cpm/libsys/build.mk @@ -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 index 000000000..e7e67136c --- /dev/null +++ b/plat/pc86/build.mk @@ -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 + + diff --git a/plat/pc86/descr b/plat/pc86/descr index 65b63a1f8..a3f11fc4f 100644 --- a/plat/pc86/descr +++ b/plat/pc86/descr @@ -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 index 000000000..bf0fda6d5 --- /dev/null +++ b/plat/pc86/libsys/build.mk @@ -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 index 000000000..44b63f891 --- /dev/null +++ b/util/LLgen/build.mk @@ -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)) diff --git a/util/LLgen/src/compute.c b/util/LLgen/src/compute.c index ef6b28499..c17d99d73 100644 --- a/util/LLgen/src/compute.c +++ b/util/LLgen/src/compute.c @@ -17,6 +17,7 @@ * Also checks the continuation grammar from the specified grammar. */ +# include # include "types.h" # include "extern.h" # include "sets.h" diff --git a/util/LLgen/src/gencode.c b/util/LLgen/src/gencode.c index 20d0d6cb2..94dd312ca 100644 --- a/util/LLgen/src/gencode.c +++ b/util/LLgen/src/gencode.c @@ -18,6 +18,7 @@ * This file is a mess, it should be cleaned up some time. */ +#include # include "types.h" # include "io.h" # include "extern.h" diff --git a/util/LLgen/src/savegram.c b/util/LLgen/src/savegram.c index d1b6a57ec..625dc1bab 100644 --- a/util/LLgen/src/savegram.c +++ b/util/LLgen/src/savegram.c @@ -25,6 +25,7 @@ */ +#include # 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 index 000000000..1b4fc146c --- /dev/null +++ b/util/ack/build.mk @@ -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)) diff --git a/util/ack/files.c b/util/ack/files.c index 0218c80f9..b47376b24 100644 --- a/util/ack/files.c +++ b/util/ack/files.c @@ -4,6 +4,7 @@ * */ +#include #include "ack.h" #include "list.h" #include "trans.h" diff --git a/util/ack/grows.c b/util/ack/grows.c index 4fbc054d9..ca089d48c 100644 --- a/util/ack/grows.c +++ b/util/ack/grows.c @@ -10,6 +10,7 @@ /* */ /**************************************************************************/ +#include #include "ack.h" #include "grows.h" diff --git a/util/ack/list.c b/util/ack/list.c index 7bc62a841..278f55580 100644 --- a/util/ack/list.c +++ b/util/ack/list.c @@ -4,6 +4,7 @@ * */ +#include #include "ack.h" #include "list.h" diff --git a/util/ack/rmach.c b/util/ack/rmach.c index d1ce5d2f7..38b2a54b3 100644 --- a/util/ack/rmach.c +++ b/util/ack/rmach.c @@ -4,6 +4,8 @@ * */ +#include +#include #include "ack.h" #include #include "list.h" @@ -11,7 +13,6 @@ #include "grows.h" #include "dmach.h" #include "data.h" -#include #ifndef NORCSID static char rcs_id[] = "$Id$" ; diff --git a/util/amisc/build.mk b/util/amisc/build.mk new file mode 100644 index 000000000..e7f71e33f --- /dev/null +++ b/util/amisc/build.mk @@ -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 index 000000000..b70893f41 --- /dev/null +++ b/util/arch/build.mk @@ -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 index 000000000..185c3ace6 --- /dev/null +++ b/util/cmisc/build.mk @@ -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)) + diff --git a/util/cpp/replace.c b/util/cpp/replace.c index 923b2c902..1951e1bda 100644 --- a/util/cpp/replace.c +++ b/util/cpp/replace.c @@ -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 index 000000000..196bdd52a --- /dev/null +++ b/util/data/build.mk @@ -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)) diff --git a/util/ego/sr/sr.h b/util/ego/sr/sr.h index cf301831c..796641587 100644 --- a/util/ego/sr/sr.h +++ b/util/ego/sr/sr.h @@ -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 index 000000000..97576794d --- /dev/null +++ b/util/ncgg/build.mk @@ -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)) diff --git a/util/ncgg/cgg.y b/util/ncgg/cgg.y index f46d2d724..24948abad 100644 --- a/util/ncgg/cgg.y +++ b/util/ncgg/cgg.y @@ -1100,4 +1100,3 @@ optregvartype { $$ = $2; } ; %% -#include "scan.c" diff --git a/util/ncgg/scan.l b/util/ncgg/scan.l index 93552b6bd..46ea6d5e4 100644 --- a/util/ncgg/scan.l +++ b/util/ncgg/scan.l @@ -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 +#include +#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 index 000000000..bb3c464a6 --- /dev/null +++ b/util/opt/build.mk @@ -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)) diff --git a/util/opt/mktab.y b/util/opt/mktab.y index a4b5c845c..08beaeccc 100644 --- a/util/opt/mktab.y +++ b/util/opt/mktab.y @@ -421,4 +421,3 @@ out(w) { } } -#include "scan.c" diff --git a/util/opt/scan.l b/util/opt/scan.l index 85d4aeefe..1c26f1857 100644 --- a/util/opt/scan.l +++ b/util/opt/scan.l @@ -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); } -- 2.34.1