From 9f23fbbe6a8f32dba3fa6aa7acf776b081d14af9 Mon Sep 17 00:00:00 2001 From: David Given Date: Mon, 23 Mar 2015 00:08:51 +0100 Subject: [PATCH] Allow machines to use cg if they wish. --HG-- rename : mach/proto/ncg/build.mk => mach/proto/cg/build.mk rename : util/ncgg/build.mk => util/cgg/build.mk --- mach/proto/cg/build.mk | 46 ++++++++++++++++++++++++++++++++++++++++++ plat/build.mk | 4 ++-- util/cgg/build.mk | 25 +++++++++++++++++++++++ util/cgg/main.c | 5 +++++ 4 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 mach/proto/cg/build.mk create mode 100644 util/cgg/build.mk diff --git a/mach/proto/cg/build.mk b/mach/proto/cg/build.mk new file mode 100644 index 000000000..2327009e0 --- /dev/null +++ b/mach/proto/cg/build.mk @@ -0,0 +1,46 @@ +define build-cg-impl + +$(call reset) + +$(eval cflags += -Imach/$(ARCH)/cg -I$(OBJDIR)/$D -Imach/proto/cg) +$(eval objdir := $(ARCH)) + +$(call cfile, mach/proto/cg/codegen.c) +$(call cfile, mach/proto/cg/compute.c) +$(call cfile, mach/proto/cg/equiv.c) +$(call cfile, mach/proto/cg/fillem.c) +$(call cfile, mach/proto/cg/gencode.c) +$(call cfile, mach/proto/cg/glosym.c) +$(call cfile, mach/proto/cg/main.c) +$(call cfile, mach/proto/cg/move.c) +$(call cfile, mach/proto/cg/nextem.c) +$(call cfile, mach/proto/cg/reg.c) +$(call cfile, mach/proto/cg/regvar.c) +$(call cfile, mach/proto/cg/salloc.c) +$(call cfile, mach/proto/cg/state.c) +$(call cfile, mach/proto/cg/subr.c) +$(call cfile, mach/proto/cg/var.c) + +$(eval $q: $(OBJDIR)/$D/tables.h) +$(eval CLEANABLES += $(OBJDIR)/$D/tables.h $(OBJDIR)/$D/tables.c) +$(OBJDIR)/$D/tables.c: $(OBJDIR)/$D/tables.h +$(OBJDIR)/$D/tables.h: $(CGG) $(CPPANSI) mach/$(ARCH)/cg/table + @echo CGG $$@ + @mkdir -p $$(dir $$@) + $(hide) cd $$(dir $$@) && \ + $(abspath $(CPPANSI)) -I$(abspath mach/$(ARCH)/cg) $(abspath mach/$(ARCH)/cg/table) | $(abspath $(CGG)) + +$(call cfile, $(OBJDIR)/$D/tables.c) + +$(eval $q: $(INCDIR)/flt_arith.h) + +$(call rawfile, $(LIBEM_DATA)) +$(call rawfile, $(LIBFLT_ARITH)) + +$(call cprogram, $(BINDIR)/$(PLATFORM)/cg) +$(call installto, $(PLATDEP)/$(PLATFORM)/cg) + +endef + +build-cg = $(eval $(build-cg-impl)) + diff --git a/plat/build.mk b/plat/build.mk index aff84c04c..623658b07 100644 --- a/plat/build.mk +++ b/plat/build.mk @@ -17,7 +17,7 @@ define build-platform-impl $(PLATIND)/descr/$(PLATFORM) \ $(PLATFORM_HEADERS_$(PLATFORM)) \ $(PLATDEP)/$(PLATFORM)/as \ - $(PLATDEP)/$(PLATFORM)/ncg \ + $(if $(arch-cg-$(ARCH)), $(PLATDEP)/$(PLATFORM)/cg, $(PLATDEP)/$(PLATFORM)/ncg) \ $(ARCHITECTURE_$(ARCH))) # libsys @@ -48,7 +48,7 @@ define build-platform-impl # The tools themselves $(call build-as) - $(call build-ncg) + $(if $(arch-cg-$(ARCH)), $(call build-cg), $(call build-ncg)) # Build top only if the architecture asks for it. diff --git a/util/cgg/build.mk b/util/cgg/build.mk new file mode 100644 index 000000000..4fc8532b2 --- /dev/null +++ b/util/cgg/build.mk @@ -0,0 +1,25 @@ +D := util/cgg + +define build-cgg-impl + +$(call reset) +$(eval cflags += -I$D) + +$(call yacc, $(OBJDIR)/$D, $D/bootgram.y) + +$(call flex, $(OBJDIR)/$D, $D/bootlex.l) +$(call dependson, $(OBJDIR)/$D/y.tab.h) + +$(call cfile, $D/main.c) + +$(eval $q: $(INCDIR)/em_spec.h) + +$(call rawfile, $(LIBEM_DATA)) +$(call rawfile, $(LIBASSERT)) +$(call rawfile, $(LIBSYSTEM)) +$(call cprogram, $(BINDIR)/cgg) +$(eval CGG := $o) + +endef + +$(eval $(build-cgg-impl)) diff --git a/util/cgg/main.c b/util/cgg/main.c index fba8e31b5..86375b776 100644 --- a/util/cgg/main.c +++ b/util/cgg/main.c @@ -1009,3 +1009,8 @@ max(a,b) { return(a); return(b); } + +int yywrap(void) { + return 1; +} + -- 2.34.1