xref: /openbmc/u-boot/scripts/Makefile.build (revision 1b2226e0ceebf01e192715b77b96dbe9e9f75a4b)
1# our default target
2.PHONY: all
3all:
4
5include $(TOPDIR)/config.mk
6
7LIB := $(obj)built-in.o
8LIBGCC = $(obj)libgcc.o
9SRCS :=
10
11include Makefile
12
13# Going forward use the following
14obj-y := $(sort $(obj-y))
15extra-y := $(sort $(extra-y))
16lib-y := $(sort $(lib-y))
17
18subdir-y 	:= $(patsubst %/,%,$(filter %/, $(obj-y)))
19obj-y		:= $(patsubst %/, %/built-in.o, $(obj-y))
20subdir-obj-y	:= $(filter %/built-in.o, $(obj-y))
21subdir-obj-y	:= $(addprefix $(obj),$(subdir-obj-y))
22
23SRCS	+= $(wildcard $(obj-y:.o=.c) $(obj-y:.o=.S) $(lib-y:.o=.c) \
24	$(lib-y:.o=.S) $(extra-y:.o=.c) $(extra-y:.o=.S))
25OBJS	:= $(addprefix $(obj),$(obj-y))
26
27LGOBJS := $(addprefix $(obj),$(sort $(lib-y)))
28
29all: $(LIB) $(addprefix $(obj),$(extra-y))
30
31$(LIB):	$(obj).depend $(OBJS)
32	$(call cmd_link_o_target, $(OBJS))
33
34ifneq ($(strip $(lib-y)),)
35all: $(LIBGCC)
36
37$(LIBGCC): $(obj).depend $(LGOBJS)
38	$(call cmd_link_o_target, $(LGOBJS))
39endif
40
41ifneq ($(subdir-obj-y),)
42# Descending
43$(subdir-obj-y): $(subdir-y)
44
45$(subdir-y): FORCE
46	$(MAKE) -C $@ -f $(TOPDIR)/scripts/Makefile.build
47endif
48
49#########################################################################
50
51# defines $(obj).depend target
52
53include $(TOPDIR)/rules.mk
54
55sinclude $(obj).depend
56
57#########################################################################
58
59.PHONY: FORCE
60