summaryrefslogtreecommitdiffstats
path: root/scripts/Makefile.build
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/Makefile.build')
-rw-r--r--scripts/Makefile.build31
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 50c0394d5f..1b3d77fea2 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -67,6 +67,37 @@ endif
#########################################################################
+# Allow boards to use custom optimize flags on a per dir/file basis
+ALL_AFLAGS = $(AFLAGS) $(AFLAGS_$(BCURDIR)/$(@F)) $(AFLAGS_$(BCURDIR))
+ALL_CFLAGS = $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR))
+EXTRA_CPPFLAGS = $(CPPFLAGS_$(BCURDIR)/$(@F)) $(CPPFLAGS_$(BCURDIR))
+ALL_CFLAGS += $(EXTRA_CPPFLAGS)
+
+# The _DEP version uses the $< file target (for dependency generation)
+# See rules.mk
+EXTRA_CPPFLAGS_DEP = $(CPPFLAGS_$(BCURDIR)/$(addsuffix .o,$(basename $<))) \
+ $(CPPFLAGS_$(BCURDIR))
+$(obj)%.s: %.S
+ $(CPP) $(ALL_AFLAGS) -o $@ $<
+$(obj)%.o: %.S
+ $(CC) $(ALL_AFLAGS) -o $@ $< -c
+$(obj)%.o: %.c
+ifneq ($(CHECKSRC),0)
+ $(CHECK) $(CHECKFLAGS) $(ALL_CFLAGS) $<
+endif
+ $(CC) $(ALL_CFLAGS) -o $@ $< -c
+$(obj)%.i: %.c
+ $(CPP) $(ALL_CFLAGS) -o $@ $< -c
+$(obj)%.s: %.c
+ $(CC) $(ALL_CFLAGS) -o $@ $< -c -S
+
+# If the list of objects to link is empty, just create an empty built-in.o
+cmd_link_o_target = $(if $(strip $1),\
+ $(LD) $(LDFLAGS) -r -o $@ $1,\
+ rm -f $@; $(AR) rcs $@ )
+
+#########################################################################
+
# defines $(obj).depend target
include $(TOPDIR)/rules.mk
OpenPOWER on IntegriCloud