-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.build
43 lines (28 loc) · 964 Bytes
/
Makefile.build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
-include include/config/auto.conf
src := $(obj)
kbuild-dir := $(if $(filter /%,$(src)),$(src),$(TOPDIR)/$(src))
PHONY := __build
__build:
obj-y :=
subdir-y :=
include $(kbuild-dir)/Makefile
__subdir-y := $(patsubst %/, %, $(filter %/, $(obj-y)))
subdir-y += $(strip $(__subdir-y))
subdir-y := $(addprefix $(obj)/,$(subdir-y))
subdir_objs := $(foreach f, $(subdir-y), $(f)/built-in.o)
cur_objs := $(filter-out %/, $(obj-y))
cur_objs := $(addprefix $(obj)/,$(cur_objs))
PHONY += $(subdir-y)
__build: $(subdir-y) $(obj)/built-in.o
$(subdir-y):
@make -f $(TOPDIR)/Makefile.build obj=$@
$(obj)/built-in.o: $(cur_objs) $(subdir_objs)
@echo "LD $@"
@$(LD) -r -o $@ $^
%.o: %.c
@echo "CC $@"
@$(CC) $(COPS) -I$(TOPDIR)/include/ -I$(TOPDIR)/include/gos -I$(GOS_CORE_DIR)/include -I$(TOPDIR)/include/generic $(DEBUG) -c $< -o $@
%_s.o: %.S
@echo "CC $@"
@$(CC) $(COPS) -I$(TOPDIR)/include/ -I$(TOPDIR)/include/gos $(DEBUG) -c $< -o $@
.PHONY: $(PHONY)