]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - scripts/Makefile.build
Merge branch 'master' of git://git.denx.de/u-boot-mips
[karo-tx-uboot.git] / scripts / Makefile.build
1 # our default target
2 .PHONY: all
3 all:
4
5 include $(TOPDIR)/config.mk
6
7 LIB := $(obj)built-in.o
8 LIBGCC = $(obj)libgcc.o
9 SRCS :=
10
11 include Makefile
12
13 # Going forward use the following
14 obj-y := $(sort $(obj-y))
15 extra-y := $(sort $(extra-y))
16 lib-y := $(sort $(lib-y))
17
18 subdir-y        := $(patsubst %/,%,$(filter %/, $(obj-y)))
19 obj-y           := $(patsubst %/, %/built-in.o, $(obj-y))
20 subdir-obj-y    := $(filter %/built-in.o, $(obj-y))
21 subdir-obj-y    := $(addprefix $(obj),$(subdir-obj-y))
22
23 SRCS    += $(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))
25 OBJS    := $(addprefix $(obj),$(obj-y))
26
27 # $(obj-dirs) is a list of directories that contain object files
28 obj-dirs := $(dir $(OBJS))
29
30 # Create directories for object files if directory does not exist
31 # Needed when obj-y := dir/file.o syntax is used
32 _dummy := $(foreach d,$(obj-dirs), $(shell [ -d $(d) ] || mkdir -p $(d)))
33
34 LGOBJS := $(addprefix $(obj),$(sort $(lib-y)))
35
36 all: $(LIB) $(addprefix $(obj),$(extra-y))
37
38 $(LIB): $(obj).depend $(OBJS)
39         $(call cmd_link_o_target, $(OBJS))
40
41 ifneq ($(strip $(lib-y)),)
42 all: $(LIBGCC)
43
44 $(LIBGCC): $(obj).depend $(LGOBJS)
45         $(call cmd_link_o_target, $(LGOBJS))
46 endif
47
48 ifneq ($(subdir-obj-y),)
49 # Descending
50 $(subdir-obj-y): $(subdir-y)
51
52 $(subdir-y): FORCE
53         $(MAKE) -C $@ -f $(TOPDIR)/scripts/Makefile.build
54 endif
55
56 #########################################################################
57
58 # defines $(obj).depend target
59
60 include $(TOPDIR)/rules.mk
61
62 sinclude $(obj).depend
63
64 #########################################################################
65
66 .PHONY: FORCE