Masahiro Yamada | ce28d7a | 2013-10-17 17:34:47 +0900 | [diff] [blame] | 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 | |
Masahiro Yamada | ce28d7a | 2013-10-17 17:34:47 +0900 | [diff] [blame] | 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 | |
Masahiro Yamada | ac7e735 | 2013-10-17 20:38:51 +0900 | [diff] [blame] | 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 | |
Masahiro Yamada | 3fdf5c8 | 2013-11-11 14:35:49 +0900 | [diff] [blame^] | 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)) |
Masahiro Yamada | ce28d7a | 2013-10-17 17:34:47 +0900 | [diff] [blame] | 26 | |
Masahiro Yamada | 3fdf5c8 | 2013-11-11 14:35:49 +0900 | [diff] [blame^] | 27 | LGOBJS := $(addprefix $(obj),$(sort $(lib-y))) |
Masahiro Yamada | ce28d7a | 2013-10-17 17:34:47 +0900 | [diff] [blame] | 28 | |
| 29 | all: $(LIB) $(addprefix $(obj),$(extra-y)) |
| 30 | |
| 31 | $(LIB): $(obj).depend $(OBJS) |
| 32 | $(call cmd_link_o_target, $(OBJS)) |
| 33 | |
| 34 | ifneq ($(strip $(lib-y)),) |
| 35 | all: $(LIBGCC) |
| 36 | |
| 37 | $(LIBGCC): $(obj).depend $(LGOBJS) |
| 38 | $(call cmd_link_o_target, $(LGOBJS)) |
| 39 | endif |
| 40 | |
Masahiro Yamada | ac7e735 | 2013-10-17 20:38:51 +0900 | [diff] [blame] | 41 | ifneq ($(subdir-obj-y),) |
| 42 | # Descending |
| 43 | $(subdir-obj-y): $(subdir-y) |
| 44 | |
| 45 | $(subdir-y): FORCE |
| 46 | $(MAKE) -C $@ -f $(TOPDIR)/scripts/Makefile.build |
| 47 | endif |
| 48 | |
Masahiro Yamada | ce28d7a | 2013-10-17 17:34:47 +0900 | [diff] [blame] | 49 | ######################################################################### |
| 50 | |
| 51 | # defines $(obj).depend target |
| 52 | |
| 53 | include $(TOPDIR)/rules.mk |
| 54 | |
| 55 | sinclude $(obj).depend |
| 56 | |
| 57 | ######################################################################### |
Masahiro Yamada | ac7e735 | 2013-10-17 20:38:51 +0900 | [diff] [blame] | 58 | |
| 59 | .PHONY: FORCE |