Abandon gnatmake and generate elaboration code

This commit is contained in:
Alexander Senier 2019-01-30 16:57:05 +01:00 committed by Norman Feske
parent 253d6b0b92
commit 80a607ee0c
4 changed files with 26 additions and 11 deletions

View File

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

View File

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

View File

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

View File

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