]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - scripts/Makefile.build
Makefile.host.tmp: add a new script to refactor tools
[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 subdir-y :=
11 obj-dirs :=
12
13 include Makefile
14
15 # Do not include host rules unless needed
16 ifneq ($(hostprogs-y)$(hostprogs-m),)
17 include $(SRCTREE)/scripts/Makefile.host.tmp
18 endif
19
20 # Going forward use the following
21 obj-y := $(sort $(obj-y))
22 extra-y := $(sort $(extra-y))
23 always := $(sort $(always))
24 lib-y := $(sort $(lib-y))
25
26 subdir-y        += $(patsubst %/,%,$(filter %/, $(obj-y)))
27 obj-y           := $(patsubst %/, %/built-in.o, $(obj-y))
28 subdir-obj-y    := $(filter %/built-in.o, $(obj-y))
29 subdir-obj-y    := $(addprefix $(obj),$(subdir-obj-y))
30
31 SRCS    += $(wildcard $(obj-y:.o=.c) $(obj-y:.o=.S) $(lib-y:.o=.c) \
32         $(lib-y:.o=.S) $(extra-y:.o=.c) $(extra-y:.o=.S))
33 OBJS    := $(addprefix $(obj),$(obj-y))
34
35 # $(obj-dirs) is a list of directories that contain object files
36
37 obj-dirs += $(dir $(OBJS))
38
39 # Create directories for object files if directory does not exist
40 # Needed when obj-y := dir/file.o syntax is used
41 _dummy := $(foreach d,$(obj-dirs), $(shell [ -d $(d) ] || mkdir -p $(d)))
42
43 LGOBJS := $(addprefix $(obj),$(sort $(lib-y)))
44
45 all: $(LIB) $(addprefix $(obj),$(extra-y) $(always)) $(subdir-y)
46
47 $(LIB): $(obj).depend $(OBJS)
48         $(call cmd_link_o_target, $(OBJS))
49
50 ifneq ($(strip $(lib-y)),)
51 all: $(LIBGCC)
52
53 $(LIBGCC): $(obj).depend $(LGOBJS)
54         $(call cmd_link_o_target, $(LGOBJS))
55 endif
56
57 ifneq ($(subdir-obj-y),)
58 # Descending
59 $(subdir-obj-y): $(subdir-y)
60 endif
61
62 ifneq ($(subdir-y),)
63 $(subdir-y): FORCE
64         $(MAKE) -C $@ -f $(TOPDIR)/scripts/Makefile.build
65 endif
66
67 #########################################################################
68
69 # defines $(obj).depend target
70
71 include $(TOPDIR)/rules.mk
72
73 sinclude $(obj).depend
74
75 #########################################################################
76
77 .PHONY: FORCE