summaryrefslogtreecommitdiffstats
path: root/post/Makefile
diff options
context:
space:
mode:
authorYuri Tikhonov <yur@emcraft.com>2008-03-31 10:51:37 +0200
committerWolfgang Denk <wd@denx.de>2008-04-22 14:40:19 +0200
commit2d2b994a30bb100774dc747ae9865b7f95285a88 (patch)
treeab0325bd8261b84fa1101b0a47c058fd5fbb215d /post/Makefile
parent0a51e9248e2d27e0a02ef1e740c576ce90a39ee1 (diff)
downloadtalos-obmc-uboot-2d2b994a30bb100774dc747ae9865b7f95285a88.tar.gz
talos-obmc-uboot-2d2b994a30bb100774dc747ae9865b7f95285a88.zip
POST: move CONFIG_POST to Makefiles
Introduce the new logical option CONFIG_HAS_POST which is set when the platform has CONFIG_POST set. Use CONFIG_HAS_POST in the post/ Makefiles to determine should the POST libs be compiled for the selected target platform, or not. To avoid breaking u-boot linking process, the empty post/libpost.a file is created for platforms which do not have POSTs. Signed-off-by: Yuri Tikhonov <yur@emcraft.com> Signed-off-by: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'post/Makefile')
-rw-r--r--post/Makefile47
1 files changed, 43 insertions, 4 deletions
diff --git a/post/Makefile b/post/Makefile
index f32af95162..02b51544c2 100644
--- a/post/Makefile
+++ b/post/Makefile
@@ -21,11 +21,50 @@
# MA 02111-1307 USA
#
+include $(TOPDIR)/include/autoconf.mk
-SUBDIRS = drivers cpu lib_$(ARCH) board/$(BOARDDIR)
+LIB = libpost.a
+GPLIB-$(CONFIG_HAS_POST) += libgenpost.a
+COBJS-$(CONFIG_HAS_POST) += post.o tests.o
-LIB = libpost.a
+SPLIB-$(CONFIG_HAS_POST) = drivers/libpostdrivers.a
+SPLIB-$(CONFIG_HAS_POST) += $(shell if [ -d lib_$(ARCH) ]; then echo \
+ "lib_$(ARCH)/libpost$(ARCH).a"; fi)
+SPLIB-$(CONFIG_HAS_POST) += $(shell if [ -d lib_$(ARCH)/fpu ]; then echo \
+ "lib_$(ARCH)/fpu/libpost$(ARCH)fpu.a"; fi)
+SPLIB-$(CONFIG_HAS_POST) += $(shell if [ -d cpu/$(CPU) ]; then echo \
+ "cpu/$(CPU)/libpost$(CPU).a"; fi)
+SPLIB-$(CONFIG_HAS_POST) += $(shell if [ -d board/$(BOARD) ]; then echo \
+ "board/$(BOARD)/libpost$(BOARD).a"; fi)
-COBJS = post.o tests.o
+GPLIB := $(GPLIB-y)
+SPLIB := $(SPLIB-y)
+COBJS := $(COBJS-y)
+SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS := $(addprefix $(obj),$(COBJS))
+LIB := $(obj)$(LIB)
-include $(TOPDIR)/post/rules.mk
+all: $(LIB)
+
+# generic POST library
+$(GPLIB): $(obj).depend $(OBJS)
+ $(AR) $(ARFLAGS) $@ $(OBJS)
+
+# specific POST libraries
+$(SPLIB): $(obj).depend
+ $(MAKE) -C $(dir $(subst $(obj),,$@))
+
+# the POST lib archive
+$(LIB): $(GPLIB) $(SPLIB)
+ (echo create $(LIB); for lib in $(GPLIB) $(SPLIB) ; \
+ do echo addlib $$lib; done; echo save) \
+ | $(AR) -M
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
OpenPOWER on IntegriCloud