]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
Makfile: move suffix rules to Makefile.build
authorMasahiro Yamada <yamada.m@jp.panasonic.com>
Tue, 4 Feb 2014 08:24:14 +0000 (17:24 +0900)
committerTom Rini <trini@ti.com>
Wed, 19 Feb 2014 16:07:50 +0000 (11:07 -0500)
This commit moves suffix rules from config.mk
to scripts/Makefile.build, which will allow us
to switch smoothly to real Kbuild.

Note1:
post/lib_powerpc/fpu/Makefile has
its own rule to compile C sources.
We need to tweak it to keep the same behavior.

Note2:
There are two file2 with the same name:
arch/arm/lib/crt0.S and eamples/api/crt0.S.
To keep the same build behavior,
examples/api/Makefile also has to be treaked.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
config.mk
examples/api/Makefile
post/lib_powerpc/fpu/Makefile
scripts/Makefile.build

index 07afb350c2ba596dd20a49b36d8fe165e22e986d..b08be7a858c259558766a3e94d5241dc40b53d90 100644 (file)
--- a/config.mk
+++ b/config.mk
@@ -318,38 +318,3 @@ endif
 export HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE \
        AS LD CC CPP AR NM STRIP OBJCOPY OBJDUMP MAKE
 export CONFIG_SYS_TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS
-
-#########################################################################
-
-# 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 $@ )
-
-#########################################################################
index f770859361946ada37ee7435914fd8dac2188c40..52f43680fc610cdef26fc90ddee82492ff847260 100644 (file)
@@ -50,9 +50,9 @@ $(obj)demo.bin: $(obj)demo
                $(OBJCOPY) -O binary $< $@ 2>/dev/null
 
 # Rule to build generic library C files
-$(obj)%.o: $(SRCTREE)/lib/%.c
+$(addprefix $(obj),$(notdir $(EXT_COBJ_FILES-y))): $(obj)%.o: $(SRCTREE)/lib/%.c
        $(CC) -g $(CFLAGS) -c -o $@ $<
 
 # Rule to build architecture-specific library assembly files
-$(obj)%.o: $(SRCTREE)/arch/$(ARCH)/lib/%.S
+$(addprefix $(obj),$(notdir $(EXT_SOBJ_FILES-y))): $(obj)%.o: $(SRCTREE)/arch/$(ARCH)/lib/%.S
        $(CC) -g $(CFLAGS) -c -o $@ $<
index ae56a82af350da370534f468e4723437e691a9af..a7aa5bcb7ea8e65b8c714a141c7a39bda60ec659 100644 (file)
@@ -18,7 +18,7 @@ obj-y += darwin-ldouble.o
 CFLAGS := $(shell echo $(CFLAGS) | sed s/-msoft-float//)
 CFLAGS += -mhard-float -fkeep-inline-functions
 
-$(obj)%.o:     %.c
+$(addprefix $(obj),$(obj-y)): $(obj)%.o:       %.c
        $(CC)  $(ALL_CFLAGS) -o $@.fp $< -c
        $(OBJCOPY) -R .gnu.attributes $@.fp $@
        rm -f $@.fp
index 50c0394d5f98de359326ea7d4d7e7c4b49ecc661..1b3d77fea24354ad8a8138e82efc4f3d816de2bc 100644 (file)
@@ -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