Commit 5651ccffa4aa8ac36961f376927df253b7d0c035

Authored by Masahiro Yamada
Committed by Tom Rini
1 parent a0b14c3f0a

Makfile: move suffix rules to Makefile.build

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>

Showing 4 changed files with 34 additions and 38 deletions Side-by-side Diff

... ... @@ -318,39 +318,4 @@
318 318 export HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE \
319 319 AS LD CC CPP AR NM STRIP OBJCOPY OBJDUMP MAKE
320 320 export CONFIG_SYS_TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS
321   -
322   -#########################################################################
323   -
324   -# Allow boards to use custom optimize flags on a per dir/file basis
325   -ALL_AFLAGS = $(AFLAGS) $(AFLAGS_$(BCURDIR)/$(@F)) $(AFLAGS_$(BCURDIR))
326   -ALL_CFLAGS = $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR))
327   -EXTRA_CPPFLAGS = $(CPPFLAGS_$(BCURDIR)/$(@F)) $(CPPFLAGS_$(BCURDIR))
328   -ALL_CFLAGS += $(EXTRA_CPPFLAGS)
329   -
330   -# The _DEP version uses the $< file target (for dependency generation)
331   -# See rules.mk
332   -EXTRA_CPPFLAGS_DEP = $(CPPFLAGS_$(BCURDIR)/$(addsuffix .o,$(basename $<))) \
333   - $(CPPFLAGS_$(BCURDIR))
334   -$(obj)%.s: %.S
335   - $(CPP) $(ALL_AFLAGS) -o $@ $<
336   -$(obj)%.o: %.S
337   - $(CC) $(ALL_AFLAGS) -o $@ $< -c
338   -$(obj)%.o: %.c
339   -ifneq ($(CHECKSRC),0)
340   - $(CHECK) $(CHECKFLAGS) $(ALL_CFLAGS) $<
341   -endif
342   - $(CC) $(ALL_CFLAGS) -o $@ $< -c
343   -$(obj)%.i: %.c
344   - $(CPP) $(ALL_CFLAGS) -o $@ $< -c
345   -$(obj)%.s: %.c
346   - $(CC) $(ALL_CFLAGS) -o $@ $< -c -S
347   -
348   -#########################################################################
349   -
350   -# If the list of objects to link is empty, just create an empty built-in.o
351   -cmd_link_o_target = $(if $(strip $1),\
352   - $(LD) $(LDFLAGS) -r -o $@ $1,\
353   - rm -f $@; $(AR) rcs $@ )
354   -
355   -#########################################################################
examples/api/Makefile
... ... @@ -50,10 +50,10 @@
50 50 $(OBJCOPY) -O binary $< $@ 2>/dev/null
51 51  
52 52 # Rule to build generic library C files
53   -$(obj)%.o: $(SRCTREE)/lib/%.c
  53 +$(addprefix $(obj),$(notdir $(EXT_COBJ_FILES-y))): $(obj)%.o: $(SRCTREE)/lib/%.c
54 54 $(CC) -g $(CFLAGS) -c -o $@ $<
55 55  
56 56 # Rule to build architecture-specific library assembly files
57   -$(obj)%.o: $(SRCTREE)/arch/$(ARCH)/lib/%.S
  57 +$(addprefix $(obj),$(notdir $(EXT_SOBJ_FILES-y))): $(obj)%.o: $(SRCTREE)/arch/$(ARCH)/lib/%.S
58 58 $(CC) -g $(CFLAGS) -c -o $@ $<
post/lib_powerpc/fpu/Makefile
... ... @@ -18,7 +18,7 @@
18 18 CFLAGS := $(shell echo $(CFLAGS) | sed s/-msoft-float//)
19 19 CFLAGS += -mhard-float -fkeep-inline-functions
20 20  
21   -$(obj)%.o: %.c
  21 +$(addprefix $(obj),$(obj-y)): $(obj)%.o: %.c
22 22 $(CC) $(ALL_CFLAGS) -o $@.fp $< -c
23 23 $(OBJCOPY) -R .gnu.attributes $@.fp $@
24 24 rm -f $@.fp
scripts/Makefile.build
... ... @@ -67,6 +67,37 @@
67 67  
68 68 #########################################################################
69 69  
  70 +# Allow boards to use custom optimize flags on a per dir/file basis
  71 +ALL_AFLAGS = $(AFLAGS) $(AFLAGS_$(BCURDIR)/$(@F)) $(AFLAGS_$(BCURDIR))
  72 +ALL_CFLAGS = $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR))
  73 +EXTRA_CPPFLAGS = $(CPPFLAGS_$(BCURDIR)/$(@F)) $(CPPFLAGS_$(BCURDIR))
  74 +ALL_CFLAGS += $(EXTRA_CPPFLAGS)
  75 +
  76 +# The _DEP version uses the $< file target (for dependency generation)
  77 +# See rules.mk
  78 +EXTRA_CPPFLAGS_DEP = $(CPPFLAGS_$(BCURDIR)/$(addsuffix .o,$(basename $<))) \
  79 + $(CPPFLAGS_$(BCURDIR))
  80 +$(obj)%.s: %.S
  81 + $(CPP) $(ALL_AFLAGS) -o $@ $<
  82 +$(obj)%.o: %.S
  83 + $(CC) $(ALL_AFLAGS) -o $@ $< -c
  84 +$(obj)%.o: %.c
  85 +ifneq ($(CHECKSRC),0)
  86 + $(CHECK) $(CHECKFLAGS) $(ALL_CFLAGS) $<
  87 +endif
  88 + $(CC) $(ALL_CFLAGS) -o $@ $< -c
  89 +$(obj)%.i: %.c
  90 + $(CPP) $(ALL_CFLAGS) -o $@ $< -c
  91 +$(obj)%.s: %.c
  92 + $(CC) $(ALL_CFLAGS) -o $@ $< -c -S
  93 +
  94 +# If the list of objects to link is empty, just create an empty built-in.o
  95 +cmd_link_o_target = $(if $(strip $1),\
  96 + $(LD) $(LDFLAGS) -r -o $@ $1,\
  97 + rm -f $@; $(AR) rcs $@ )
  98 +
  99 +#########################################################################
  100 +
70 101 # defines $(obj).depend target
71 102  
72 103 include $(TOPDIR)/rules.mk