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
This commit is contained in:
David Given 2015-03-23 00:08:51 +01:00
parent c5018d7088
commit 9f23fbbe6a
4 changed files with 78 additions and 2 deletions

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

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

View file

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

25
util/cgg/build.mk Normal file
View file

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

View file

@ -1009,3 +1009,8 @@ max(a,b) {
return(a);
return(b);
}
int yywrap(void) {
return 1;
}