From 80a607ee0c33b06f3236be4d6b1aa9ec042e4fee Mon Sep 17 00:00:00 2001 From: Alexander Senier Date: Wed, 30 Jan 2019 16:57:05 +0100 Subject: [PATCH] Abandon gnatmake and generate elaboration code --- repos/base/mk/generic.mk | 11 +++++------ repos/base/mk/global.mk | 6 +++--- repos/base/mk/prg.mk | 19 ++++++++++++++++++- repos/libports/lib/mk/ada.mk | 1 - 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/repos/base/mk/generic.mk b/repos/base/mk/generic.mk index 73f2aa4ef5..5f65f35df4 100644 --- a/repos/base/mk/generic.mk +++ b/repos/base/mk/generic.mk @@ -78,18 +78,17 @@ endif # # We need to override these to build the ada runtime # -CUSTOM_ADA_MAKE ?= $(GNATMAKE) -CUSTOM_ADA_FLAGS ?= -q -c --GCC=$(ADA_CC) --RTS=$(ADA_RTS) -CUSTOM_ADA_OPT ?= -cargs $(CC_ADA_OPT) -gnatef +CUSTOM_ADA_FLAGS ?= --RTS=$(ADA_RTS) +CUSTOM_ADA_OPT ?= $(CC_ADA_OPT) -gnatef CUSTOM_ADA_INCLUDE ?= -I- $(INCLUDES) -%.o: %.adb +%.ali %.o: %.adb $(MSG_COMP)$@ - $(VERBOSE)$(CUSTOM_ADA_MAKE) $(CUSTOM_ADA_FLAGS) $< $(CUSTOM_ADA_OPT) $(CUSTOM_ADA_INCLUDE) + $(VERBOSE)$(CC) -c $(CUSTOM_ADA_FLAGS) $< $(CUSTOM_ADA_OPT) $(CUSTOM_ADA_INCLUDE) %.ali %.o: %.ads $(MSG_COMP)$@ - $(VERBOSE)$(CUSTOM_ADA_MAKE) $(CUSTOM_ADA_FLAGS) $< $(CUSTOM_ADA_OPT) $(CUSTOM_ADA_INCLUDE) + $(VERBOSE)$(CC) -c $(CUSTOM_ADA_FLAGS) $< $(CUSTOM_ADA_OPT) $(CUSTOM_ADA_INCLUDE) # # Compiling Rust sources diff --git a/repos/base/mk/global.mk b/repos/base/mk/global.mk index c297afce61..84fdc8f554 100644 --- a/repos/base/mk/global.mk +++ b/repos/base/mk/global.mk @@ -22,7 +22,7 @@ CUSTOM_NM ?= $(CROSS_DEV_PREFIX)nm CUSTOM_OBJCOPY ?= $(CROSS_DEV_PREFIX)objcopy CUSTOM_RANLIB ?= $(CROSS_DEV_PREFIX)ranlib CUSTOM_STRIP ?= $(CROSS_DEV_PREFIX)strip -CUSTOM_GNATMAKE ?= $(CROSS_DEV_PREFIX)gnatmake +CUSTOM_GNATBIND ?= $(CROSS_DEV_PREFIX)gnatbind CUSTOM_HOST_CC ?= gcc CUSTOM_ADA_CC ?= $(CUSTOM_CC) @@ -50,7 +50,7 @@ NM = $(CUSTOM_NM) OBJCOPY = $(CUSTOM_OBJCOPY) RANLIB = $(CUSTOM_RANLIB) STRIP = $(CUSTOM_STRIP) -GNATMAKE = $(CUSTOM_GNATMAKE) +GNATBIND = $(CUSTOM_GNATBIND) HOST_CC = $(CUSTOM_HOST_CC) ADA_CC = $(CUSTOM_ADA_CC) @@ -166,7 +166,7 @@ CC_OPT += $(CC_OPT_PIC) # CC_CXX_OPT += $(CC_OPT) $(CC_CXX_WARN) CC_C_OPT += $(CC_OPT) -CC_ADA_OPT += $(CC_OPT) -fexceptions +CC_ADA_OPT += $(filter-out -fno-builtin-cos -fno-builtin-sin -fno-builtin-cosf -fno-builtin-sinf ,$(CC_OPT)) -fexceptions # # Rust-specific arguments diff --git a/repos/base/mk/prg.mk b/repos/base/mk/prg.mk index 56107d2d85..2c0c2ac493 100644 --- a/repos/base/mk/prg.mk +++ b/repos/base/mk/prg.mk @@ -101,6 +101,23 @@ message: FORCE: $(SRC_ADA:.adb=.o): FORCE +# +# Run binder if Ada sources are included in the build +# +ifneq ($(SRC_ADS)$(SRC_ADB),) + +CUSTOM_BINDER_FLAGS ?= -n -we + +OBJECTS += b~$(TARGET).o + +ALIS := $(addsuffix .ali, $(basename $(SRC_ADS) $(SRC_ADB))) +BINDER_SEARCH_DIRS = $(addprefix -I$(BUILD_BASE_DIR)/var/libcache/, $(LIBS)) +BINDER_SRC := b~$(TARGET).ads b~$(TARGET).adb + +$(BINDER_SRC): $(ALIS) + $(VERBOSE)$(GNATBIND) $(CUSTOM_BINDER_FLAGS) $(BINDER_SEARCH_DIRS) $(INCLUDES) --RTS=$(ADA_RTS) -o $@ $^ +endif + # # Use CXX for linking # @@ -215,7 +232,7 @@ endif clean_prg_objects: $(MSG_CLEAN)$(PRG_REL_DIR) - $(VERBOSE)$(RM) -f $(OBJECTS) $(OBJECTS:.o=.d) $(TARGET) $(TARGET).stripped + $(VERBOSE)$(RM) -f $(OBJECTS) $(OBJECTS:.o=.d) $(TARGET) $(TARGET).stripped $(BINDER_SRC) $(VERBOSE)$(RM) -f *.d *.i *.ii *.s *.ali *.lib.so clean: clean_prg_objects diff --git a/repos/libports/lib/mk/ada.mk b/repos/libports/lib/mk/ada.mk index ae3ec3fd02..ce81d56be2 100644 --- a/repos/libports/lib/mk/ada.mk +++ b/repos/libports/lib/mk/ada.mk @@ -20,7 +20,6 @@ SRC_ADS += system.ads \ SRC_ADB += g-io.adb -CUSTOM_ADA_MAKE = $(CC) CUSTOM_ADA_FLAGS = -c -gnatg -gnatp -gnatpg -gnatn2 CUSTOM_ADA_OPT = $(CC_ADA_OPT) CUSTOM_ADA_INCLUDE = -I- -I$(ADA_RUNTIME_DIR) -I$(ADA_RTS_SOURCE) -I$(ADA_RUNTIME_LIB_DIR)