xref: /openbmc/u-boot/post/Makefile (revision 3765b3e7)
1#
2# (C) Copyright 2002-2006
3# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4#
5# SPDX-License-Identifier:	GPL-2.0+
6#
7
8include $(TOPDIR)/config.mk
9include $(OBJTREE)/include/autoconf.mk
10
11LIB				= libpost.o
12GPLIB-$(CONFIG_HAS_POST)	+= libgenpost.o
13COBJS-$(CONFIG_HAS_POST)	+= post.o
14COBJS-$(CONFIG_POST_STD_LIST)	+= tests.o
15
16SPLIB-$(CONFIG_HAS_POST) = drivers/libpostdrivers.o
17SPLIB-$(CONFIG_HAS_POST) += $(shell if [ -d lib_$(ARCH) ]; then echo \
18			    "lib_$(ARCH)/libpost$(ARCH).o"; fi)
19SPLIB-$(CONFIG_HAS_POST) += $(shell if [ -d lib_$(ARCH)/fpu ]; then echo \
20			    "lib_$(ARCH)/fpu/libpost$(ARCH)fpu.o"; fi)
21SPLIB-$(CONFIG_HAS_POST) += $(shell if [ -d cpu/$(CPU) ]; then echo \
22			    "cpu/$(CPU)/libpost$(CPU).o"; fi)
23SPLIB-$(CONFIG_HAS_POST) += $(shell if [ -d board/$(BOARD) ]; then echo \
24			    "board/$(BOARD)/libpost$(BOARD).o"; fi)
25
26GPLIB	:= $(addprefix $(obj),$(GPLIB-y))
27SPLIB	:= $(addprefix $(obj),$(SPLIB-y))
28COBJS	:= $(COBJS-y)
29SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
30OBJS	:= $(addprefix $(obj),$(COBJS))
31LIB	:= $(obj)$(LIB)
32
33all:	$(LIB)
34
35postdeps:
36	@for lib in $(SPLIB-y) ; do \
37		$(MAKE) -C `dirname $$lib` all ; \
38	done
39
40# generic POST library
41$(GPLIB): $(obj).depend $(OBJS)
42	$(call cmd_link_o_target, $(OBJS))
43
44# specific POST libraries
45$(SPLIB): $(obj).depend postdeps
46	$(MAKE) -C $(dir $(subst $(obj),,$@))
47
48# the POST lib archive
49$(LIB): $(GPLIB) $(SPLIB)
50	$(call cmd_link_o_target, $^)
51
52#########################################################################
53
54# defines $(obj).depend target
55include $(SRCTREE)/rules.mk
56
57sinclude $(obj).depend
58
59#########################################################################
60