Makefile: Compile binder's output w/o gnat config
The code generated by the binder (gnatbind) isn't always compilable
with the restrictions in our gnat configuration file `gnat.adc`. This
is in accordance with how `gnatlink` would do the job.
Change-Id: I59ea4a68749cabfb6cccdda1db4c23c6c0d5be60
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/18782
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
diff --git a/Makefile b/Makefile
index c08b437..359a28c 100644
--- a/Makefile
+++ b/Makefile
@@ -223,11 +223,13 @@
# $1 source type (ads, adb)
# $2 source files (including the colon)
# $3 obj path prefix (including the trailing slash)
+# $4 compiler flags (if empty, $(ADAFLAGS) apply)
define add_ada_rule
$(2) $(3)%.o: %.$(1)
@printf " COMPILE $$(subst $(obj)/,,$$@)\n"
$(CC) \
- $(ADAFLAGS) $(addprefix -I,$($(name)-ada-dirs) $($(name)-extra-incs)) \
+ $(if $(4),$(4),$(ADAFLAGS)) \
+ $(addprefix -I,$($(name)-ada-dirs) $($(name)-extra-incs)) \
-c -o $$@ $$<
endef
@@ -264,7 +266,7 @@
cd $(dir $@) && \
$(GNATBIND) $(addprefix -aO,$(abspath $($(name)-bind-dirs))) \
$($(name)-bind-flags) -o $(notdir $@) $($(name)-bind-alis)
-$(eval $(call add_ada_rule,adb,$(obj)/b__$(prefixed-name).o:,))
+$(eval $(call add_ada_rule,adb,$(obj)/b__$(prefixed-name).o:,,$(filter-out -gnatec=%,$(ADAFLAGS))))
$(name)-objs += $(obj)/b__$(prefixed-name).o
# Compilation rule for C sources