Build ego.
authorDavid Given <dg@cowlark.com>
Wed, 15 May 2013 20:14:06 +0000 (21:14 +0100)
committerDavid Given <dg@cowlark.com>
Wed, 15 May 2013 20:14:06 +0000 (21:14 +0100)
--HG--
branch : dtrg-buildsystem
rename : util/arch/build.mk => util/ego/build.mk

17 files changed:
Makefile
config.pm
lib/descr/fe
plat/build.mk
util/ego/build.mk [new file with mode: 0644]
util/ego/cf/cf_loop.c
util/ego/cs/cs_alloc.c
util/ego/il/il1_aux.c
util/ego/il/il2_aux.c
util/ego/il/il3_change.c
util/ego/il/il_aux.c
util/ego/ra/ra_interv.c
util/ego/ra/ra_pack.c
util/ego/share/locals.c
util/ego/share/lset.c
util/ego/share/put.c
util/ego/sr/sr_reduce.c

index 4188b58..2d78f03 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -52,6 +52,7 @@ include util/arch/build.mk
 include util/misc/build.mk
 include util/led/build.mk
 include util/topgen/build.mk
+include util/ego/build.mk
 
 include lang/cem/build.mk
 include lang/basic/build.mk
index 1d59b7f..79dc7c5 100644 (file)
--- a/config.pm
+++ b/config.pm
@@ -13,7 +13,7 @@ ACK_TEMP_DIR = "/tmp"
 
 -- Where is the ACK going to be installed, eventually?
 
-PREFIX = "/usr/local"
+PREFIX = "/tmp/ack-temp/staging"
 
 -- ======================================================================= --
 --                       BROKEN ACK CONFIGURATION                          --
index 96a03ee..a8d6103 100644 (file)
@@ -172,7 +172,7 @@ var A68INIT={EM}/lib/ack/em_a68s_init
 name a68s
         from .8.a68
         to .k
-        program {EM}/lib.bin/em_a68s{w}{p}
+        program {EM}/lib/ack/em_a68s{w}{p}
         mapflag -PA* A68INIT=*
         args < > {SOURCE}.lst {A68INIT}{w}{p} /dev/null
         prep cond
@@ -226,8 +226,8 @@ name ego
        mapflag -a EGO_F={EGO_F?} -a
        mapflag -O* EGO_F={EGO_F?} -O*
        args \
-               {EGO_F?} -P {EM}/lib.bin/ego \
-               -M{EM}/lib.bin/ego/{ARCH}descr <
+               {EGO_F?} -P {EM}/lib/ack/ego \
+               -M{EM}/share/ack/ego/{ARCH}.descr <
        optimizer 2
        stdout
        combiner
index 89acb8c..aff84c0 100644 (file)
@@ -57,6 +57,10 @@ define build-platform-impl
     # Language runtimes
 
     $(foreach runtime, $(RUNTIMES), $(build-runtime-$(runtime)))
+
+    # Install the ego descr file for this architecture
+
+    $(call build-ego-descr)
 endef
 
 build-platform = $(eval $(call build-platform-impl, $1))
diff --git a/util/ego/build.mk b/util/ego/build.mk
new file mode 100644 (file)
index 0000000..ee1e7f8
--- /dev/null
@@ -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))))
\ No newline at end of file
index 6f27288..c14bdba 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 
+#include <stdlib.h>
 #include "../share/types.h"
 #include "../share/debug.h"
 #include "../share/lset.h"
index f1cfe20..6a11282 100644 (file)
@@ -3,6 +3,7 @@
  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
+#include <stdlib.h>
 #include "../share/types.h"
 #include "../share/alloc.h"
 #include "cs.h"
index 8ef4923..76e8ae2 100644 (file)
@@ -8,6 +8,7 @@
  *  I L 1 _ A U X . C
  */
 
+#include <stdlib.h>
 #include <em_spec.h>
 #include "../share/types.h"
 #include "il.h"
index 54d9501..01a13f0 100644 (file)
@@ -8,6 +8,7 @@
  *  I L 2 _ A U X . C
  */
 
+#include <stdlib.h>
 #include <stdio.h>
 #include <em_spec.h>
 #include <em_mnem.h>
index 8f8fd39..6347167 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 
+#include <stdlib.h>
 #include <stdio.h>
 #include <em_mnem.h>
 #include <em_pseu.h>
index beff6f4..2bb5e45 100644 (file)
@@ -9,6 +9,7 @@
  *  I L _ A U X . C
  */
 
+#include <stdlib.h>
 #include <stdio.h>
 #include <em_spec.h>
 #include <em_mnem.h>
index a6c6b7c..b333124 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 
+#include <stdlib.h>
 #include <em_reg.h>
 #include "../share/types.h"
 #include "../share/debug.h"
index 3687b44..373191b 100644 (file)
@@ -8,6 +8,7 @@
  *  R A _ P A C K . C
  */
 
+#include <stdlib.h>
 #include <em_reg.h>
 #include "../share/types.h"
 #include "../share/debug.h"
index f8d4ba2..b8b92f2 100644 (file)
@@ -7,6 +7,7 @@
  *  L O C A L S . C
  */
 
+#include <stdlib.h>
 #include <stdio.h>
 #include <em_mnem.h>
 #include <em_spec.h>
index d95d256..682494a 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 
+#include <stdlib.h>
 #include "types.h"
 #include "lset.h"
 #include "alloc.h"
index 473443a..bbb4aed 100644 (file)
@@ -5,6 +5,7 @@
  */
 /* P U T . C */
 
+#include <stdlib.h>
 #include <stdio.h>
 #include <em_pseu.h>
 #include <em_spec.h>
index c656dce..5b8e782 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 
+#include <stdlib.h>
 #include <em_pseu.h>
 #include <em_reg.h>
 #include <em_mes.h>