First milestone of replacing the build system.

--HG--
branch : dtrg-buildsystem
rename : lang/cem/cpp.ansi/Parameters => lang/cem/cpp.ansi/parameters.h
This commit is contained in:
David Given 2013-05-12 20:45:55 +01:00
parent bcfb3d802f
commit c1aca7dae5
119 changed files with 1584 additions and 319 deletions

84
Makefile Normal file
View file

@ -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)

199
first/core.mk Normal file
View file

@ -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))

6
lang/cem/build.mk Normal file
View file

@ -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))

View 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"

View file

@ -11,7 +11,6 @@
*/
#include "file_info.h"
#include "nopp.h"
/* the structure of a token: */
struct token {

View file

@ -6,7 +6,6 @@
/* PARSER ERROR ADMINISTRATION */
#include <alloc.h>
#include "idf.h"
#include "arith.h"
#include "LLlex.h"
#include "Lpars.h"

View 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

View file

@ -11,11 +11,8 @@
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"

View file

@ -13,7 +13,7 @@
be handy.
*/
#include "spec_arith.h"
#include "parameters.h"
#ifndef SPECIAL_ARITHMETICS

View 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 */

View 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>

View file

@ -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))

View 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"

View 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"

View 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"

View 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"

View 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>

View 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"

View file

@ -9,7 +9,7 @@
Use the compiler option --d.
*/
#include "dataflow.h" /* UF */
#include "parameters.h" /* UF */
#ifdef DATAFLOW
char *CurrentFunction = 0;

View 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"

View 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"

View file

@ -5,7 +5,7 @@
/* $Id$ */
/* IDENTIFIER DEFINITION DESCRIPTOR */
#include "lint.h"
#include "parameters.h"
struct def { /* for ordinary tags */
struct def *next;

View 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>

View 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"

View 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
@ -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 <flt_arith.h>
#include "arith.h"

View 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

View 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[];

View 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"

View 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"

View 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"

View 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"

View file

@ -5,7 +5,7 @@
/* $Id$ */
/* IDENTIFIER DESCRIPTOR */
#include "nopp.h"
#include "parameters.h"
struct id_u {
#ifndef NOPP

View 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();

View 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"
@ -15,12 +15,9 @@
#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>

View 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"
@ -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)

View file

@ -5,10 +5,9 @@
/* $Id$ */
/* Lint-specific comment handling */
#include "parameters.h"
#include <ctype.h>
#include "lint.h"
#ifdef LINT
#include <alloc.h>

View 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"

View 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"

View 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"

View 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"

View 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"

View 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"

View 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

View 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"

View file

@ -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\

View 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;

View 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

View file

@ -45,13 +45,10 @@
%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 */

View 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"

View file

@ -7,16 +7,10 @@
#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 "input.h"
@ -25,8 +19,6 @@
#include "LLlex.h"
#include "class.h"
#include "assert.h"
#include "static.h"
#include "macbuf.h"
#include "replace.h"
extern struct idf *GetIdentifier();

View 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

View 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"

View file

@ -9,7 +9,7 @@
/* $Id$ */
#include "dbsymtab.h"
#include "parameters.h"
#ifdef DBSYMTAB
@ -20,13 +20,13 @@
#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"

View 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"

View file

@ -6,7 +6,7 @@
/* STATEMENT SYNTAX PARSER */
{
#include "lint.h"
#include "parameters.h"
#ifndef LINT
#include <em.h>
#else
@ -14,15 +14,11 @@
#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"

View 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"

View 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"

View file

@ -5,6 +5,7 @@
/* $Id$ */
/* TOKEN NAME DEFINITIONS */
#include "parameters.h"
#include "idf.h"
#include "arith.h"
#include "LLlex.h"

View 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"

View 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 */

View file

@ -11,7 +11,7 @@
allowing re-use.
*/
#include "lint.h"
#include "parameters.h"
#ifndef LINT
#include <em.h>
#else
@ -22,10 +22,7 @@
#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"

View 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

View 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;

View 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"

View 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

104
lang/cem/cpp.ansi/build.mk Normal file
View file

@ -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))

View 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[];

View 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

View 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.

View 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"

View file

@ -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)"

View 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"

View 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

View file

@ -10,16 +10,13 @@
#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

View 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();

View file

@ -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))

View 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;

View 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

43
mach/proto/as/build.mk Normal file
View file

@ -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))

46
mach/proto/ncg/build.mk Normal file
View file

@ -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))

View file

@ -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))

View file

@ -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, ))

View file

@ -9,6 +9,7 @@
they can be written immediately.
*/
#include <stdlib.h>
#include <em_path.h>
#include <alloc.h>
#include "insert.h"

View file

@ -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))

View file

@ -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))

14
modules/src/idf/build.mk Normal file
View file

@ -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))

View file

@ -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))

View file

@ -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))

View file

@ -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))

View file

@ -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))

View file

@ -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))

26
plat/build.mk Normal file
View file

@ -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))

14
plat/cpm/build.mk Normal file
View file

@ -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

View 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

28
plat/cpm/libsys/build.mk Normal file
View file

@ -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))

14
plat/pc86/build.mk Normal file
View file

@ -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

View 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

26
plat/pc86/libsys/build.mk Normal file
View file

@ -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))

55
util/LLgen/build.mk Normal file
View file

@ -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))

View 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"

Some files were not shown because too many files have changed in this diff Show more