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# 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 22subdir-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 27SRCS += $(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 45ifneq ($(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 53######################################################################### 54 55# defines $(obj).depend target 56 57include $(TOPDIR)/rules.mk 58 59sinclude $(obj).depend 60 61######################################################################### 62 63.PHONY: FORCE 64