Commit 656de6b819c7a5b830de5a5e374133b631820dbc
Committed by
Tom Rini
1 parent
cbce795e5e
Exists in
master
and in
49 other branches
kbuild: refactor Makefile and spl/Makefile more
This commit refactors rules of directory descending and defines u-boot-dirs and u-boot-all-dirs. (We will need u-boot-all-dirs when using scripts/Makefile.clean) Additionally, rename LIBS-y to libs-y. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Showing 2 changed files with 141 additions and 137 deletions Side-by-side Diff
Makefile
... | ... | @@ -561,18 +561,8 @@ |
561 | 561 | cpp_flags := $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(UBOOTINCLUDE) $(NOSTDINC_FLAGS) |
562 | 562 | c_flags := $(KBUILD_CFLAGS) $(cpp_flags) |
563 | 563 | |
564 | -# The "tools" are needed early, so put this first | |
565 | -# Don't include stuff already done in $(LIBS) | |
566 | -# The "examples" conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC | |
567 | -# is "yes"), so compile examples after U-Boot is compiled. | |
568 | -SUBDIR_TOOLS = tools | |
569 | -SUBDIRS = $(SUBDIR_TOOLS) | |
564 | +.PHONY : $(VERSION_FILE) $(TIMESTAMP_FILE) | |
570 | 565 | |
571 | -.PHONY : $(SUBDIRS) $(VERSION_FILE) $(TIMESTAMP_FILE) | |
572 | - | |
573 | -SUBDIR_EXAMPLES-y := examples | |
574 | -SUBDIRS += $(SUBDIR_EXAMPLES-y) | |
575 | - | |
576 | 566 | ######################################################################### |
577 | 567 | # U-Boot objects....order is important (i.e. start must be first) |
578 | 568 | |
579 | 569 | |
580 | 570 | |
581 | 571 | |
582 | 572 | |
583 | 573 | |
584 | 574 | |
585 | 575 | |
586 | 576 | |
587 | 577 | |
... | ... | @@ -580,71 +570,77 @@ |
580 | 570 | head-$(CONFIG_4xx) += arch/powerpc/cpu/ppc4xx/resetvec.o |
581 | 571 | head-$(CONFIG_MPC85xx) += arch/powerpc/cpu/mpc85xx/resetvec.o |
582 | 572 | |
583 | -OBJS := $(head-y) | |
584 | - | |
585 | 573 | HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(srctree)/board/$(VENDOR)/common/Makefile),y,n) |
586 | 574 | |
587 | -LIBS-y += lib/ | |
588 | -LIBS-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/ | |
589 | -LIBS-y += $(CPUDIR)/ | |
575 | +libs-y += lib/ | |
576 | +libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/ | |
577 | +libs-y += $(CPUDIR)/ | |
590 | 578 | ifdef SOC |
591 | -LIBS-y += $(CPUDIR)/$(SOC)/ | |
579 | +libs-y += $(CPUDIR)/$(SOC)/ | |
592 | 580 | endif |
593 | -LIBS-$(CONFIG_IXP4XX_NPE) += drivers/net/npe/ | |
594 | -LIBS-$(CONFIG_OF_EMBED) += dts/ | |
595 | -LIBS-y += arch/$(ARCH)/lib/ | |
596 | -LIBS-y += fs/ | |
597 | -LIBS-y += net/ | |
598 | -LIBS-y += disk/ | |
599 | -LIBS-y += drivers/ | |
600 | -LIBS-y += drivers/dma/ | |
601 | -LIBS-y += drivers/gpio/ | |
602 | -LIBS-y += drivers/i2c/ | |
603 | -LIBS-y += drivers/input/ | |
604 | -LIBS-y += drivers/mmc/ | |
605 | -LIBS-y += drivers/mtd/ | |
606 | -LIBS-$(CONFIG_CMD_NAND) += drivers/mtd/nand/ | |
607 | -LIBS-y += drivers/mtd/onenand/ | |
608 | -LIBS-$(CONFIG_CMD_UBI) += drivers/mtd/ubi/ | |
609 | -LIBS-y += drivers/mtd/spi/ | |
610 | -LIBS-y += drivers/net/ | |
611 | -LIBS-y += drivers/net/phy/ | |
612 | -LIBS-y += drivers/pci/ | |
613 | -LIBS-y += drivers/power/ \ | |
581 | +libs-$(CONFIG_IXP4XX_NPE) += drivers/net/npe/ | |
582 | +libs-$(CONFIG_OF_EMBED) += dts/ | |
583 | +libs-y += arch/$(ARCH)/lib/ | |
584 | +libs-y += fs/ | |
585 | +libs-y += net/ | |
586 | +libs-y += disk/ | |
587 | +libs-y += drivers/ | |
588 | +libs-y += drivers/dma/ | |
589 | +libs-y += drivers/gpio/ | |
590 | +libs-y += drivers/i2c/ | |
591 | +libs-y += drivers/input/ | |
592 | +libs-y += drivers/mmc/ | |
593 | +libs-y += drivers/mtd/ | |
594 | +libs-$(CONFIG_CMD_NAND) += drivers/mtd/nand/ | |
595 | +libs-y += drivers/mtd/onenand/ | |
596 | +libs-$(CONFIG_CMD_UBI) += drivers/mtd/ubi/ | |
597 | +libs-y += drivers/mtd/spi/ | |
598 | +libs-y += drivers/net/ | |
599 | +libs-y += drivers/net/phy/ | |
600 | +libs-y += drivers/pci/ | |
601 | +libs-y += drivers/power/ \ | |
614 | 602 | drivers/power/fuel_gauge/ \ |
615 | 603 | drivers/power/mfd/ \ |
616 | 604 | drivers/power/pmic/ \ |
617 | 605 | drivers/power/battery/ |
618 | -LIBS-y += drivers/spi/ | |
619 | -LIBS-$(CONFIG_FMAN_ENET) += drivers/net/fm/ | |
620 | -LIBS-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/ | |
621 | -LIBS-y += drivers/serial/ | |
622 | -LIBS-y += drivers/usb/eth/ | |
623 | -LIBS-y += drivers/usb/gadget/ | |
624 | -LIBS-y += drivers/usb/host/ | |
625 | -LIBS-y += drivers/usb/musb/ | |
626 | -LIBS-y += drivers/usb/musb-new/ | |
627 | -LIBS-y += drivers/usb/phy/ | |
628 | -LIBS-y += drivers/usb/ulpi/ | |
629 | -LIBS-y += common/ | |
630 | -LIBS-y += lib/libfdt/ | |
631 | -LIBS-$(CONFIG_API) += api/ | |
632 | -LIBS-$(CONFIG_HAS_POST) += post/ | |
633 | -LIBS-y += test/ | |
606 | +libs-y += drivers/spi/ | |
607 | +libs-$(CONFIG_FMAN_ENET) += drivers/net/fm/ | |
608 | +libs-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/ | |
609 | +libs-y += drivers/serial/ | |
610 | +libs-y += drivers/usb/eth/ | |
611 | +libs-y += drivers/usb/gadget/ | |
612 | +libs-y += drivers/usb/host/ | |
613 | +libs-y += drivers/usb/musb/ | |
614 | +libs-y += drivers/usb/musb-new/ | |
615 | +libs-y += drivers/usb/phy/ | |
616 | +libs-y += drivers/usb/ulpi/ | |
617 | +libs-y += common/ | |
618 | +libs-y += lib/libfdt/ | |
619 | +libs-$(CONFIG_API) += api/ | |
620 | +libs-$(CONFIG_HAS_POST) += post/ | |
621 | +libs-y += test/ | |
634 | 622 | |
635 | 623 | ifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35 mxs vf610)) |
636 | -LIBS-y += arch/$(ARCH)/imx-common/ | |
624 | +libs-y += arch/$(ARCH)/imx-common/ | |
637 | 625 | endif |
638 | 626 | |
639 | -LIBS-$(CONFIG_ARM) += arch/arm/cpu/ | |
640 | -LIBS-$(CONFIG_PPC) += arch/powerpc/cpu/ | |
627 | +libs-$(CONFIG_ARM) += arch/arm/cpu/ | |
628 | +libs-$(CONFIG_PPC) += arch/powerpc/cpu/ | |
641 | 629 | |
642 | -LIBS-y += board/$(BOARDDIR)/ | |
630 | +libs-y += board/$(BOARDDIR)/ | |
643 | 631 | |
644 | -LIBS-y := $(patsubst %/, %/built-in.o, $(LIBS-y)) | |
645 | -LIBS := $(sort $(LIBS-y)) | |
646 | -.PHONY : $(LIBS) | |
632 | +libs-y := $(sort $(libs-y)) | |
647 | 633 | |
634 | +u-boot-dirs := $(patsubst %/,%,$(filter %/, $(libs-y))) tools examples | |
635 | + | |
636 | +u-boot-alldirs := $(sort $(u-boot-dirs) $(patsubst %/,%,$(filter %/, $(libs-)))) | |
637 | + | |
638 | +libs-y := $(patsubst %/, %/built-in.o, $(libs-y)) | |
639 | + | |
640 | +u-boot-init := $(head-y) | |
641 | +u-boot-main := $(libs-y) | |
642 | + | |
643 | + | |
648 | 644 | # Add GCC lib |
649 | 645 | ifdef USE_PRIVATE_LIBGCC |
650 | 646 | ifeq ("$(USE_PRIVATE_LIBGCC)", "yes") |
... | ... | @@ -727,7 +723,7 @@ |
727 | 723 | LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE) |
728 | 724 | endif |
729 | 725 | |
730 | -all: $(ALL-y) $(SUBDIR_EXAMPLES-y) | |
726 | +all: $(ALL-y) | |
731 | 727 | |
732 | 728 | u-boot.dtb: checkdtc u-boot |
733 | 729 | $(MAKE) $(build)=dts binary |
... | ... | @@ -774,7 +770,7 @@ |
774 | 770 | sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \ |
775 | 771 | -d $< $@ |
776 | 772 | |
777 | -u-boot.imx: u-boot.bin depend | |
773 | +u-boot.imx: u-boot.bin | |
778 | 774 | $(MAKE) $(build)=arch/arm/imx-common $(objtree)/u-boot.imx |
779 | 775 | |
780 | 776 | u-boot.kwb: u-boot.bin |
781 | 777 | |
782 | 778 | |
... | ... | @@ -893,17 +889,17 @@ |
893 | 889 | ifeq ($(CONFIG_SANDBOX),y) |
894 | 890 | GEN_UBOOT = \ |
895 | 891 | $(CC) $(SYMS) -T u-boot.lds \ |
896 | - -Wl,--start-group $(LIBS) -Wl,--end-group \ | |
892 | + -Wl,--start-group $(u-boot-main) -Wl,--end-group \ | |
897 | 893 | $(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot.map -o u-boot |
898 | 894 | else |
899 | 895 | GEN_UBOOT = \ |
900 | 896 | $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) \ |
901 | - $(OBJS) \ | |
902 | - --start-group $(LIBS) --end-group $(PLATFORM_LIBS) \ | |
897 | + $(u-boot-init) \ | |
898 | + --start-group $(u-boot-main) --end-group $(PLATFORM_LIBS) \ | |
903 | 899 | -Map u-boot.map -o u-boot |
904 | 900 | endif |
905 | 901 | |
906 | -u-boot: depend $(SUBDIR_TOOLS) $(OBJS) $(LIBS) u-boot.lds | |
902 | +u-boot: $(u-boot-init) $(u-boot-main) u-boot.lds | |
907 | 903 | $(GEN_UBOOT) |
908 | 904 | ifeq ($(CONFIG_KALLSYMS),y) |
909 | 905 | smap=`$(call SYSTEM_MAP,u-boot) | \ |
910 | 906 | |
911 | 907 | |
912 | 908 | |
913 | 909 | |
... | ... | @@ -913,17 +909,28 @@ |
913 | 909 | $(GEN_UBOOT) common/system_map.o |
914 | 910 | endif |
915 | 911 | |
916 | -$(OBJS): | |
917 | - @: | |
912 | +# The actual objects are generated when descending, | |
913 | +# make sure no implicit rule kicks in | |
914 | +$(sort $(u-boot-init) $(u-boot-main)): $(u-boot-dirs) ; | |
918 | 915 | |
919 | -$(LIBS): depend $(SUBDIR_TOOLS) scripts_basic | |
920 | - $(Q)$(MAKE) $(build)=$(patsubst %/,%,$(dir $@)) | |
916 | +# Handle descending into subdirectories listed in $(vmlinux-dirs) | |
917 | +# Preset locale variables to speed up the build process. Limit locale | |
918 | +# tweaks to this spot to avoid wrong language settings when running | |
919 | +# make menuconfig etc. | |
920 | +# Error messages still appears in the original language | |
921 | 921 | |
922 | -$(SUBDIRS): scripts_basic $(TIMESTAMP_FILE) $(VERSION_FILE) | |
923 | - $(Q)$(MAKE) $(build)=$@ | |
922 | +PHONY += $(u-boot-dirs) | |
923 | +$(u-boot-dirs): depend scripts_basic | |
924 | + $(Q)$(MAKE) $(build)=$@ | |
924 | 925 | |
925 | -$(SUBDIR_EXAMPLES-y): u-boot | |
926 | +tools: $(TIMESTAMP_FILE) $(VERSION_FILE) | |
927 | +# The "tools" are needed early | |
928 | +$(filter-out tools, $(u-boot-dirs)): tools | |
929 | +# The "examples" conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC | |
930 | +# is "yes"), so compile examples after U-Boot is compiled. | |
931 | +examples: $(filter-out examples, $(u-boot-dirs)) | |
926 | 932 | |
933 | + | |
927 | 934 | # |
928 | 935 | # Auto-generate the autoconf.mk file (which is included by all makefiles) |
929 | 936 | # |
930 | 937 | |
... | ... | @@ -956,10 +963,10 @@ |
956 | 963 | u-boot-nand.bin: nand_spl u-boot.bin |
957 | 964 | cat nand_spl/u-boot-spl-16k.bin u-boot.bin > u-boot-nand.bin |
958 | 965 | |
959 | -spl/u-boot-spl.bin: $(SUBDIR_TOOLS) depend scripts_basic | |
966 | +spl/u-boot-spl.bin: tools depend scripts_basic | |
960 | 967 | $(MAKE) obj=spl -f $(srctree)/spl/Makefile all |
961 | 968 | |
962 | -tpl/u-boot-tpl.bin: $(SUBDIR_TOOLS) depend scripts_basic | |
969 | +tpl/u-boot-tpl.bin: tools depend scripts_basic | |
963 | 970 | $(MAKE) obj=tpl -f $(srctree)/spl/Makefile all CONFIG_TPL_BUILD=y |
964 | 971 | |
965 | 972 | # Explicitly make _depend in subdirs containing multiple targets to prevent |
... | ... | @@ -968,9 +975,7 @@ |
968 | 975 | include/generated/generic-asm-offsets.h \ |
969 | 976 | include/generated/asm-offsets.h |
970 | 977 | |
971 | -TAG_SUBDIRS = $(SUBDIRS) | |
972 | -TAG_SUBDIRS += $(dir $(LIBS)) | |
973 | -TAG_SUBDIRS += include | |
978 | +TAG_SUBDIRS := $(u-boot-dirs) include | |
974 | 979 | |
975 | 980 | FIND := find |
976 | 981 | FINDFLAGS := -L |
... | ... | @@ -1155,7 +1160,7 @@ |
1155 | 1160 | @find $(OBJTREE) -type f \( -name '*.srec' \ |
1156 | 1161 | -o -name '*.bin' -o -name u-boot.img \) \ |
1157 | 1162 | -print0 | xargs -0 rm -f |
1158 | - @rm -f $(OBJS) *.bak ctags etags TAGS \ | |
1163 | + @rm -f *.bak ctags etags TAGS \ | |
1159 | 1164 | cscope.* *.*~ |
1160 | 1165 | @rm -f u-boot u-boot.map u-boot.hex $(ALL-y) |
1161 | 1166 | @rm -f u-boot.kwb |
spl/Makefile
... | ... | @@ -79,68 +79,66 @@ |
79 | 79 | head-$(CONFIG_4xx) += $(START_PATH)/resetvec.o |
80 | 80 | head-$(CONFIG_MPC85xx) += $(START_PATH)/resetvec.o |
81 | 81 | |
82 | -LIBS-y += arch/$(ARCH)/lib/ | |
82 | +libs-y += arch/$(ARCH)/lib/ | |
83 | 83 | |
84 | -LIBS-y += $(CPUDIR)/ | |
84 | +libs-y += $(CPUDIR)/ | |
85 | 85 | |
86 | 86 | ifdef SOC |
87 | -LIBS-y += $(CPUDIR)/$(SOC)/ | |
87 | +libs-y += $(CPUDIR)/$(SOC)/ | |
88 | 88 | endif |
89 | -LIBS-y += board/$(BOARDDIR)/ | |
90 | -LIBS-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/ | |
89 | +libs-y += board/$(BOARDDIR)/ | |
90 | +libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/ | |
91 | 91 | |
92 | -LIBS-$(CONFIG_SPL_FRAMEWORK) += common/spl/ | |
93 | -LIBS-$(CONFIG_SPL_LIBCOMMON_SUPPORT) += common/ | |
94 | -LIBS-$(CONFIG_SPL_LIBDISK_SUPPORT) += disk/ | |
95 | -LIBS-$(CONFIG_SPL_I2C_SUPPORT) += drivers/i2c/ | |
96 | -LIBS-$(CONFIG_SPL_GPIO_SUPPORT) += drivers/gpio/ | |
97 | -LIBS-$(CONFIG_SPL_MMC_SUPPORT) += drivers/mmc/ | |
98 | -LIBS-$(CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT) += drivers/ddr/fsl/ | |
99 | -LIBS-$(CONFIG_SPL_SERIAL_SUPPORT) += drivers/serial/ | |
100 | -LIBS-$(CONFIG_SPL_SPI_FLASH_SUPPORT) += drivers/mtd/spi/ | |
101 | -LIBS-$(CONFIG_SPL_SPI_SUPPORT) += drivers/spi/ | |
102 | -LIBS-y += fs/ | |
103 | -LIBS-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/ | |
104 | -LIBS-$(CONFIG_SPL_POWER_SUPPORT) += drivers/power/ \ | |
105 | - drivers/power/pmic/ | |
106 | -LIBS-$(if $(CONFIG_CMD_NAND),$(CONFIG_SPL_NAND_SUPPORT)) += drivers/mtd/nand/ | |
107 | -LIBS-$(CONFIG_SPL_DRIVERS_MISC_SUPPORT) += drivers/misc/ | |
108 | -LIBS-$(CONFIG_SPL_ONENAND_SUPPORT) += drivers/mtd/onenand/ | |
109 | -LIBS-$(CONFIG_SPL_DMA_SUPPORT) += drivers/dma/ | |
110 | -LIBS-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/ | |
111 | -LIBS-$(CONFIG_SPL_NET_SUPPORT) += net/ | |
112 | -LIBS-$(CONFIG_SPL_ETH_SUPPORT) += drivers/net/ | |
113 | -LIBS-$(CONFIG_SPL_ETH_SUPPORT) += drivers/net/phy/ | |
114 | -LIBS-$(CONFIG_SPL_USBETH_SUPPORT) += drivers/net/phy/ | |
115 | -LIBS-$(CONFIG_SPL_MUSB_NEW_SUPPORT) += drivers/usb/musb-new/ | |
116 | -LIBS-$(CONFIG_SPL_USBETH_SUPPORT) += drivers/usb/gadget/ | |
117 | -LIBS-$(CONFIG_SPL_WATCHDOG_SUPPORT) += drivers/watchdog/ | |
118 | -LIBS-$(CONFIG_SPL_USB_HOST_SUPPORT) += drivers/usb/host/ | |
119 | -LIBS-$(CONFIG_OMAP_USB_PHY) += drivers/usb/phy/ | |
120 | -LIBS-$(CONFIG_SPL_SATA_SUPPORT) += drivers/block/ | |
92 | +libs-$(CONFIG_SPL_FRAMEWORK) += common/spl/ | |
93 | +libs-$(CONFIG_SPL_LIBCOMMON_SUPPORT) += common/ | |
94 | +libs-$(CONFIG_SPL_LIBDISK_SUPPORT) += disk/ | |
95 | +libs-$(CONFIG_SPL_I2C_SUPPORT) += drivers/i2c/ | |
96 | +libs-$(CONFIG_SPL_GPIO_SUPPORT) += drivers/gpio/ | |
97 | +libs-$(CONFIG_SPL_MMC_SUPPORT) += drivers/mmc/ | |
98 | +libs-$(CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT) += drivers/ddr/fsl/ | |
99 | +libs-$(CONFIG_SPL_SERIAL_SUPPORT) += drivers/serial/ | |
100 | +libs-$(CONFIG_SPL_SPI_FLASH_SUPPORT) += drivers/mtd/spi/ | |
101 | +libs-$(CONFIG_SPL_SPI_SUPPORT) += drivers/spi/ | |
102 | +libs-y += fs/ | |
103 | +libs-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/ | |
104 | +libs-$(CONFIG_SPL_POWER_SUPPORT) += drivers/power/ drivers/power/pmic/ | |
105 | +libs-$(if $(CONFIG_CMD_NAND),$(CONFIG_SPL_NAND_SUPPORT)) += drivers/mtd/nand/ | |
106 | +libs-$(CONFIG_SPL_DRIVERS_MISC_SUPPORT) += drivers/misc/ | |
107 | +libs-$(CONFIG_SPL_ONENAND_SUPPORT) += drivers/mtd/onenand/ | |
108 | +libs-$(CONFIG_SPL_DMA_SUPPORT) += drivers/dma/ | |
109 | +libs-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/ | |
110 | +libs-$(CONFIG_SPL_NET_SUPPORT) += net/ | |
111 | +libs-$(CONFIG_SPL_ETH_SUPPORT) += drivers/net/ | |
112 | +libs-$(CONFIG_SPL_ETH_SUPPORT) += drivers/net/phy/ | |
113 | +libs-$(CONFIG_SPL_USBETH_SUPPORT) += drivers/net/phy/ | |
114 | +libs-$(CONFIG_SPL_MUSB_NEW_SUPPORT) += drivers/usb/musb-new/ | |
115 | +libs-$(CONFIG_SPL_USBETH_SUPPORT) += drivers/usb/gadget/ | |
116 | +libs-$(CONFIG_SPL_WATCHDOG_SUPPORT) += drivers/watchdog/ | |
117 | +libs-$(CONFIG_SPL_USB_HOST_SUPPORT) += drivers/usb/host/ | |
118 | +libs-$(CONFIG_OMAP_USB_PHY) += drivers/usb/phy/ | |
119 | +libs-$(CONFIG_SPL_SATA_SUPPORT) += drivers/block/ | |
121 | 120 | |
122 | 121 | ifneq (,$(CONFIG_MX23)$(CONFIG_MX35)$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35)) |
123 | -LIBS-y += arch/$(ARCH)/imx-common/ | |
122 | +libs-y += arch/$(ARCH)/imx-common/ | |
124 | 123 | endif |
125 | 124 | |
126 | -LIBS-$(CONFIG_ARM) += arch/arm/cpu/ | |
127 | -LIBS-$(CONFIG_PPC) += arch/powerpc/cpu/ | |
125 | +libs-$(CONFIG_ARM) += arch/arm/cpu/ | |
126 | +libs-$(CONFIG_PPC) += arch/powerpc/cpu/ | |
128 | 127 | |
129 | -LIBS-y := $(patsubst %/, %/built-in.o, $(LIBS-y)) | |
128 | +head-y := $(addprefix $(obj)/,$(head-y)) | |
129 | +libs-y := $(addprefix $(obj)/,$(libs-y)) | |
130 | +u-boot-spl-dirs := $(patsubst %/,%,$(filter %/, $(libs-y))) | |
130 | 131 | |
132 | +libs-y := $(patsubst %/, %/built-in.o, $(libs-y)) | |
133 | + | |
131 | 134 | # Add GCC lib |
132 | 135 | ifeq ("$(USE_PRIVATE_LIBGCC)", "yes") |
133 | 136 | PLATFORM_LIBS := $(SPLTREE)/arch/$(ARCH)/lib/lib.a |
134 | 137 | endif |
135 | 138 | |
136 | -LIBS-y := $(sort $(LIBS-y)) | |
139 | +u-boot-spl-init := $(head-y) | |
140 | +u-boot-spl-main := $(libs-y) | |
137 | 141 | |
138 | -__START := $(head-y) | |
139 | -__LIBS := $(LIBS-y) | |
140 | - | |
141 | -START := $(addprefix $(obj)/,$(head-y)) | |
142 | -LIBS := $(addprefix $(obj)/,$(LIBS-y)) | |
143 | - | |
144 | 142 | # Linker Script |
145 | 143 | ifdef CONFIG_SPL_LDSCRIPT |
146 | 144 | # need to strip off double quotes |
147 | 145 | |
148 | 146 | |
149 | 147 | |
... | ... | @@ -209,19 +207,20 @@ |
209 | 207 | LDFLAGS_$(SPL_BIN) += -Ttext $(CONFIG_SPL_TEXT_BASE) |
210 | 208 | endif |
211 | 209 | |
212 | -GEN_UBOOT = \ | |
213 | - cd $(obj) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) $(__START) \ | |
214 | - --start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \ | |
215 | - -Map $(SPL_BIN).map -o $(SPL_BIN) | |
210 | +quiet_cmd_u-boot-spl = LD $@ | |
211 | + cmd_u-boot-spl = cd $(obj) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) \ | |
212 | + $(patsubst $(obj)/%,%,$(u-boot-spl-init)) --start-group \ | |
213 | + $(patsubst $(obj)/%,%,$(u-boot-spl-main)) --end-group \ | |
214 | + $(PLATFORM_LIBS) -Map $(SPL_BIN).map -o $(SPL_BIN) | |
216 | 215 | |
217 | -$(obj)/$(SPL_BIN): $(START) $(LIBS) $(obj)/u-boot-spl.lds | |
218 | - $(GEN_UBOOT) | |
216 | +$(obj)/$(SPL_BIN): $(u-boot-spl-init) $(u-boot-spl-main) $(obj)/u-boot-spl.lds | |
217 | + $(call cmd,u-boot-spl) | |
219 | 218 | |
220 | -$(START): | |
221 | - @: | |
219 | +$(sort $(u-boot-spl-init) $(u-boot-spl-main)): $(u-boot-spl-dirs) ; | |
222 | 220 | |
223 | -$(LIBS): | |
224 | - $(Q)$(MAKE) $(build)=$(patsubst %/,%,$(dir $@)) | |
221 | +PHONY += $(u-boot-spl-dirs) | |
222 | +$(u-boot-spl-dirs): | |
223 | + $(Q)$(MAKE) $(build)=$@ | |
225 | 224 | |
226 | 225 | # FIX ME |
227 | 226 | cpp_flags := $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(UBOOTINCLUDE) $(NOSTDINC_FLAGS) |