Build ego.

--HG--
branch : dtrg-buildsystem
rename : util/arch/build.mk => util/ego/build.mk
This commit is contained in:
David Given 2013-05-15 21:14:06 +01:00
parent f6c43b95ef
commit e9233b4712
17 changed files with 226 additions and 4 deletions

View file

@ -52,6 +52,7 @@ include util/arch/build.mk
include util/misc/build.mk include util/misc/build.mk
include util/led/build.mk include util/led/build.mk
include util/topgen/build.mk include util/topgen/build.mk
include util/ego/build.mk
include lang/cem/build.mk include lang/cem/build.mk
include lang/basic/build.mk include lang/basic/build.mk

View file

@ -13,7 +13,7 @@ ACK_TEMP_DIR = "/tmp"
-- Where is the ACK going to be installed, eventually? -- Where is the ACK going to be installed, eventually?
PREFIX = "/usr/local" PREFIX = "/tmp/ack-temp/staging"
-- ======================================================================= -- -- ======================================================================= --
-- BROKEN ACK CONFIGURATION -- -- BROKEN ACK CONFIGURATION --

View file

@ -172,7 +172,7 @@ var A68INIT={EM}/lib/ack/em_a68s_init
name a68s name a68s
from .8.a68 from .8.a68
to .k to .k
program {EM}/lib.bin/em_a68s{w}{p} program {EM}/lib/ack/em_a68s{w}{p}
mapflag -PA* A68INIT=* mapflag -PA* A68INIT=*
args < > {SOURCE}.lst {A68INIT}{w}{p} /dev/null args < > {SOURCE}.lst {A68INIT}{w}{p} /dev/null
prep cond prep cond
@ -226,8 +226,8 @@ name ego
mapflag -a EGO_F={EGO_F?} -a mapflag -a EGO_F={EGO_F?} -a
mapflag -O* EGO_F={EGO_F?} -O* mapflag -O* EGO_F={EGO_F?} -O*
args \ args \
{EGO_F?} -P {EM}/lib.bin/ego \ {EGO_F?} -P {EM}/lib/ack/ego \
-M{EM}/lib.bin/ego/{ARCH}descr < -M{EM}/share/ack/ego/{ARCH}.descr <
optimizer 2 optimizer 2
stdout stdout
combiner combiner

View file

@ -57,6 +57,10 @@ define build-platform-impl
# Language runtimes # Language runtimes
$(foreach runtime, $(RUNTIMES), $(build-runtime-$(runtime))) $(foreach runtime, $(RUNTIMES), $(build-runtime-$(runtime)))
# Install the ego descr file for this architecture
$(call build-ego-descr)
endef endef
build-platform = $(eval $(call build-platform-impl, $1)) build-platform = $(eval $(call build-platform-impl, $1))

205
util/ego/build.mk Normal file
View file

@ -0,0 +1,205 @@
D := util/ego
define build-ego-backend-impl
$(call reset)
$(eval cflags += -DVERBOSE -DNOTCOMPACT)
$(eval cflags += -I$D/share -I$(OBJDIR)/$D)
$(foreach f, $2, $(call cfile, $f))
$(call file, $(LIBDIR)/libegocore.a)
$(call file, $(LIBEM_DATA))
$(call cprogram, $(BINDIR)/ego/$(strip $1))
$(call installto, $(PLATDEP)/ego/$(strip $1))
$(eval EGO_MODULES += $q)
endef
define build-ego-impl
# Generated files that egocore needs.
$(call reset)
$(call cfile, $D/share/makecldef.c)
$(call cprogram, $(OBJDIR)/$D/makecldef)
$(eval g := $(OBJDIR)/$D/classdefs.h)
$(eval CLEANABLES += $g)
$g: $(OBJDIR)/$D/makecldef $(INCDIR)/em_mnem.h $D/share/cldefs.src
@echo MAKECLDEF $g
@mkdir -p $(dir $g)
$(hide) $$^ > $g
$(eval g := $(OBJDIR)/$D/pop_push.h)
$(eval CLEANABLES += $g)
$g: $D/share/pop_push.awk h/em_table
@echo POP_PUSH $g
@mkdir -p $(dir $g)
$(hide) awk -f $D/share/pop_push.awk < h/em_table > $g
# Build the egocore library.
$(call reset)
$(eval cflags += -I$D/share -I$(OBJDIR)/$D)
$(eval cflags += -DVERBOSE -DNOTCOMPACT)
$(call cfile, $D/share/debug.c)
$(call cfile, $D/share/global.c)
$(call cfile, $D/share/files.c)
$(call cfile, $D/share/go.c)
$(call cfile, $D/share/map.c)
$(call cfile, $D/share/aux.c)
$(call cfile, $D/share/get.c)
$(call cfile, $D/share/put.c)
$(call cfile, $D/share/alloc.c)
$(call cfile, $D/share/lset.c)
$(call cfile, $D/share/cset.c)
$(call cfile, $D/share/parser.c)
$(call cfile, $D/share/stack_chg.c)
$(call cfile, $D/share/locals.c)
$(call cfile, $D/share/init_glob.c)
$(eval $q: $(OBJDIR)/$D/classdefs.h $(OBJDIR)/$D/pop_push.h)
$(call clibrary, $(LIBDIR)/libegocore.a)
$(eval CLEANABLES += $q)
# Now build each of the back ends.
$(call build-ego-backend-impl, bo, \
$D/bo/bo.c)
$(call build-ego-backend-impl, ca, \
$D/ca/ca.c \
$D/ca/ca_put.c)
$(call build-ego-backend-impl, cf, \
$D/cf/cf.c \
$D/cf/cf_idom.c \
$D/cf/cf_loop.c \
$D/cf/cf_succ.c)
$(call build-ego-backend-impl, cj, \
$D/cj/cj.c)
$(call build-ego-backend-impl, cs, \
$D/cs/cs.c \
$D/cs/cs_alloc.c \
$D/cs/cs_aux.c \
$D/cs/cs_avail.c \
$D/cs/cs_debug.c \
$D/cs/cs_elim.c \
$D/cs/cs_entity.c \
$D/cs/cs_getent.c \
$D/cs/cs_kill.c \
$D/cs/cs_partit.c \
$D/cs/cs_profit.c \
$D/cs/cs_stack.c \
$D/cs/cs_vnm.c)
$(call build-ego-backend-impl, ic, \
$D/ic/ic.c \
$D/ic/ic_aux.c \
$D/ic/ic_io.c \
$D/ic/ic_lib.c \
$D/ic/ic_lookup.c)
$(call build-ego-backend-impl, il, \
$D/il/il.c \
$D/il/il1_anal.c \
$D/il/il1_aux.c \
$D/il/il1_cal.c \
$D/il/il1_formal.c \
$D/il/il2_aux.c \
$D/il/il3_aux.c \
$D/il/il3_change.c \
$D/il/il3_subst.c \
$D/il/il_aux.c)
$(call build-ego-backend-impl, lv, \
$D/lv/lv.c)
$(call build-ego-backend-impl, ra, \
$D/ra/ra.c \
$D/ra/ra_allocl.c \
$D/ra/ra_aux.c \
$D/ra/ra_interv.c \
$D/ra/ra_lifet.c \
$D/ra/ra_pack.c \
$D/ra/ra_profits.c \
$D/ra/ra_xform.c \
$D/ra/ra_items.c)
$(eval g := $(OBJDIR)/$D/itemtab.h)
$(eval CLEANABLES += $g)
$D/ra/ra_items.c: $g
$g: $(OBJDIR)/$D/makeitems $(INCDIR)/em_mnem.h $D/ra/itemtab.src
@echo MAKEITEMS $g
@mkdir -p $(dir $g)
$(hide) $$^ > $g
$(call reset)
$(call cfile, $D/ra/makeitems.c)
$(call cprogram, $(OBJDIR)/$D/makeitems)
$(call build-ego-backend-impl, sp, \
$D/sp/sp.c)
$(call build-ego-backend-impl, sr, \
$D/sr/sr.c \
$D/sr/sr_aux.c \
$D/sr/sr_cand.c \
$D/sr/sr_expr.c \
$D/sr/sr_iv.c \
$D/sr/sr_reduce.c \
$D/sr/sr_xform.c)
$(call build-ego-backend-impl, ud, \
$D/ud/ud.c \
$D/ud/ud_aux.c \
$D/ud/ud_const.c \
$D/ud/ud_copy.c \
$D/ud/ud_defs.c)
# ...and now the front end, which depends on all the backends.
$(call reset)
$(call cfile, $D/em_ego/em_ego.c)
$(eval $q: $(INCDIR)/print.h $(INCDIR)/system.h)
$(eval $q: $(INCDIR)/em_path.h)
$(call file, $(LIBPRINT))
$(call file, $(LIBSTRING))
$(call file, $(LIBSYSTEM))
$(call cprogram, $(BINDIR)/em_ego)
$(call installto, $(PLATDEP)/em_ego)
$(eval EM_EGO := $q)
$(eval $q: $(EGO_MODULES))
$(eval ACK_CORE_TOOLS += $q)
endef
$(eval $(build-ego-impl))
# Install the ego descr file for the current architecture, if one exists.
# This is a bit annoying because it's called by each platform, so we need
# to protect against the architecture being seen more than once. And some
# architectures don't get descr files.
define build-ego-descr-impl
$(eval EGO_DESCR_$(ARCH) := 1)
$(eval g := $(PLATIND)/ego/$(ARCH).descr)
$(eval CLEANABLES += $g)
$(eval $(EM_EGO): $g)
$g: util/ego/descr/descr.sed util/ego/descr/$(ARCH).descr $(CPPANSI) \
$(INCDIR)/em_mnem.h
@echo EGODESCR $g
@mkdir -p $(dir $g)
$(hide) $(CPPANSI) -P -I$(INCDIR) util/ego/descr/$(ARCH).descr | sed -f util/ego/descr/descr.sed > $g
endef
build-ego-descr = $(if $(EGO_DESCR_$(ARCH)),, \
$(if $(wildcard util/ego/descr/$(ARCH).descr), \
$(eval $(call build-ego-descr-impl, $1))))

View file

@ -9,6 +9,7 @@
*/ */
#include <stdlib.h>
#include "../share/types.h" #include "../share/types.h"
#include "../share/debug.h" #include "../share/debug.h"
#include "../share/lset.h" #include "../share/lset.h"

View file

@ -3,6 +3,7 @@
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright". * See the copyright notice in the ACK home directory, in the file "Copyright".
*/ */
#include <stdlib.h>
#include "../share/types.h" #include "../share/types.h"
#include "../share/alloc.h" #include "../share/alloc.h"
#include "cs.h" #include "cs.h"

View file

@ -8,6 +8,7 @@
* I L 1 _ A U X . C * I L 1 _ A U X . C
*/ */
#include <stdlib.h>
#include <em_spec.h> #include <em_spec.h>
#include "../share/types.h" #include "../share/types.h"
#include "il.h" #include "il.h"

View file

@ -8,6 +8,7 @@
* I L 2 _ A U X . C * I L 2 _ A U X . C
*/ */
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <em_spec.h> #include <em_spec.h>
#include <em_mnem.h> #include <em_mnem.h>

View file

@ -9,6 +9,7 @@
*/ */
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <em_mnem.h> #include <em_mnem.h>
#include <em_pseu.h> #include <em_pseu.h>

View file

@ -9,6 +9,7 @@
* I L _ A U X . C * I L _ A U X . C
*/ */
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <em_spec.h> #include <em_spec.h>
#include <em_mnem.h> #include <em_mnem.h>

View file

@ -9,6 +9,7 @@
*/ */
#include <stdlib.h>
#include <em_reg.h> #include <em_reg.h>
#include "../share/types.h" #include "../share/types.h"
#include "../share/debug.h" #include "../share/debug.h"

View file

@ -8,6 +8,7 @@
* R A _ P A C K . C * R A _ P A C K . C
*/ */
#include <stdlib.h>
#include <em_reg.h> #include <em_reg.h>
#include "../share/types.h" #include "../share/types.h"
#include "../share/debug.h" #include "../share/debug.h"

View file

@ -7,6 +7,7 @@
* L O C A L S . C * L O C A L S . C
*/ */
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <em_mnem.h> #include <em_mnem.h>
#include <em_spec.h> #include <em_spec.h>

View file

@ -9,6 +9,7 @@
*/ */
#include <stdlib.h>
#include "types.h" #include "types.h"
#include "lset.h" #include "lset.h"
#include "alloc.h" #include "alloc.h"

View file

@ -5,6 +5,7 @@
*/ */
/* P U T . C */ /* P U T . C */
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <em_pseu.h> #include <em_pseu.h>
#include <em_spec.h> #include <em_spec.h>

View file

@ -10,6 +10,7 @@
*/ */
#include <stdlib.h>
#include <em_pseu.h> #include <em_pseu.h>
#include <em_reg.h> #include <em_reg.h>
#include <em_mes.h> #include <em_mes.h>