blob: 2ef7341f37f8213b1abe51112c1449f0b835ba72 [file] [log] [blame]
Masahiro Yamadace28d7a2013-10-17 17:34:47 +09001# 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# Backward compatible: obj-y is preferable
14COBJS := $(sort $(COBJS) $(COBJS-y))
15SOBJS := $(sort $(SOBJS) $(SOBJS-y))
16
17# Going forward use the following
18obj-y := $(sort $(obj-y))
19extra-y := $(sort $(extra-y))
20lib-y := $(sort $(lib-y))
21
Masahiro Yamadaac7e7352013-10-17 20:38:51 +090022subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y)))
23obj-y := $(patsubst %/, %/built-in.o, $(obj-y))
24subdir-obj-y := $(filter %/built-in.o, $(obj-y))
25subdir-obj-y := $(addprefix $(obj),$(subdir-obj-y))
26
Masahiro Yamadace28d7a2013-10-17 17:34:47 +090027SRCS += $(COBJS:.o=.c) $(SOBJS:.o=.S) \
28 $(wildcard $(obj-y:.o=.c) $(obj-y:.o=.S) $(lib-y:.o=.c) $(lib-y:.o=.S) $(extra-y:.o=.c) $(extra-y:.o=.S))
29OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS) $(obj-y))
30
31LGOBJS := $(addprefix $(obj),$(sort $(GLSOBJS) $(GLCOBJS)) $(lib-y))
32
33all: $(LIB) $(addprefix $(obj),$(extra-y))
34
35$(LIB): $(obj).depend $(OBJS)
36 $(call cmd_link_o_target, $(OBJS))
37
38ifneq ($(strip $(lib-y)),)
39all: $(LIBGCC)
40
41$(LIBGCC): $(obj).depend $(LGOBJS)
42 $(call cmd_link_o_target, $(LGOBJS))
43endif
44
Masahiro Yamadaac7e7352013-10-17 20:38:51 +090045ifneq ($(subdir-obj-y),)
46# Descending
47$(subdir-obj-y): $(subdir-y)
48
49$(subdir-y): FORCE
50 $(MAKE) -C $@ -f $(TOPDIR)/scripts/Makefile.build
51endif
52
Masahiro Yamadace28d7a2013-10-17 17:34:47 +090053#########################################################################
54
55# defines $(obj).depend target
56
57include $(TOPDIR)/rules.mk
58
59sinclude $(obj).depend
60
61#########################################################################
Masahiro Yamadaac7e7352013-10-17 20:38:51 +090062
63.PHONY: FORCE