Blame view
scripts/Makefile.build
3.34 KB
ce28d7ac6 Makefile: prepare... |
1 2 3 |
# our default target .PHONY: all all: |
9e4140329 kbuild: change ou... |
4 5 6 7 8 9 10 11 12 |
ifeq ($(CONFIG_TPL_BUILD),y) src := $(patsubst tpl/%,%,$(obj)) else ifeq ($(CONFIG_SPL_BUILD),y) src := $(patsubst spl/%,%,$(obj)) else src := $(obj) endif endif |
bf4b3de10 kbuild: Use Kbuil... |
13 |
include $(srctree)/scripts/Kbuild.include |
9e4140329 kbuild: change ou... |
14 |
include $(srctree)/config.mk |
ce28d7ac6 Makefile: prepare... |
15 |
|
4a20df395 examples: Use scr... |
16 |
# variable LIB is used in examples/standalone/Makefile |
9e4140329 kbuild: change ou... |
17 18 |
__LIB := $(obj)/built-in.o LIBGCC = $(obj)/libgcc.o |
ce28d7ac6 Makefile: prepare... |
19 |
SRCS := |
ad71fa997 Makefile.host.tmp... |
20 21 |
subdir-y := obj-dirs := |
ce28d7ac6 Makefile: prepare... |
22 |
|
9e4140329 kbuild: change ou... |
23 24 |
kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) include $(kbuild-dir)/Makefile |
ce28d7ac6 Makefile: prepare... |
25 |
|
ad71fa997 Makefile.host.tmp... |
26 27 28 29 |
# Do not include host rules unless needed ifneq ($(hostprogs-y)$(hostprogs-m),) include $(SRCTREE)/scripts/Makefile.host.tmp endif |
ce28d7ac6 Makefile: prepare... |
30 31 32 |
# Going forward use the following obj-y := $(sort $(obj-y)) extra-y := $(sort $(extra-y)) |
ad71fa997 Makefile.host.tmp... |
33 |
always := $(sort $(always)) |
ce28d7ac6 Makefile: prepare... |
34 |
lib-y := $(sort $(lib-y)) |
ad71fa997 Makefile.host.tmp... |
35 |
subdir-y += $(patsubst %/,%,$(filter %/, $(obj-y))) |
ac7e73532 Makefile: support... |
36 37 |
obj-y := $(patsubst %/, %/built-in.o, $(obj-y)) subdir-obj-y := $(filter %/built-in.o, $(obj-y)) |
9e4140329 kbuild: change ou... |
38 39 40 41 |
subdir-obj-y := $(addprefix $(obj)/,$(subdir-obj-y)) SRCS += $(obj-y:.o=.c) $(obj-y:.o=.S) $(lib-y:.o=.c) \ $(lib-y:.o=.S) $(extra-y:.o=.c) $(extra-y:.o=.S) |
ac7e73532 Makefile: support... |
42 |
|
9e4140329 kbuild: change ou... |
43 44 45 46 |
SRCS := $(addprefix $(if $(KBUILD_SRC),$(srctree)/$(src)/,$(src)/),$(SRCS)) SRCS := $(wildcard $(SRCS)) OBJS := $(addprefix $(obj)/,$(obj-y)) |
ce28d7ac6 Makefile: prepare... |
47 |
|
e5c5301f1 Makefile: make di... |
48 |
# $(obj-dirs) is a list of directories that contain object files |
ad71fa997 Makefile.host.tmp... |
49 50 |
obj-dirs += $(dir $(OBJS)) |
e5c5301f1 Makefile: make di... |
51 |
|
9e4140329 kbuild: change ou... |
52 |
_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) |
e5c5301f1 Makefile: make di... |
53 54 55 |
# Create directories for object files if directory does not exist # Needed when obj-y := dir/file.o syntax is used _dummy := $(foreach d,$(obj-dirs), $(shell [ -d $(d) ] || mkdir -p $(d))) |
9e4140329 kbuild: change ou... |
56 |
LGOBJS := $(addprefix $(obj)/,$(sort $(lib-y))) |
ce28d7ac6 Makefile: prepare... |
57 |
|
9e4140329 kbuild: change ou... |
58 |
all: $(__LIB) $(addprefix $(obj)/,$(extra-y) $(always)) $(subdir-y) |
ce28d7ac6 Makefile: prepare... |
59 |
|
9e4140329 kbuild: change ou... |
60 |
$(__LIB): $(obj)/.depend $(OBJS) |
ce28d7ac6 Makefile: prepare... |
61 62 63 64 |
$(call cmd_link_o_target, $(OBJS)) ifneq ($(strip $(lib-y)),) all: $(LIBGCC) |
9e4140329 kbuild: change ou... |
65 |
$(LIBGCC): $(obj)/.depend $(LGOBJS) |
ce28d7ac6 Makefile: prepare... |
66 67 |
$(call cmd_link_o_target, $(LGOBJS)) endif |
ac7e73532 Makefile: support... |
68 69 70 |
ifneq ($(subdir-obj-y),) # Descending $(subdir-obj-y): $(subdir-y) |
ad71fa997 Makefile.host.tmp... |
71 |
endif |
ac7e73532 Makefile: support... |
72 |
|
ad71fa997 Makefile.host.tmp... |
73 |
ifneq ($(subdir-y),) |
ac7e73532 Makefile: support... |
74 |
$(subdir-y): FORCE |
9e4140329 kbuild: change ou... |
75 |
$(MAKE) $(build)=$(obj)/$@ |
ac7e73532 Makefile: support... |
76 |
endif |
ce28d7ac6 Makefile: prepare... |
77 |
######################################################################### |
5651ccffa Makfile: move suf... |
78 79 80 81 82 83 84 85 86 87 |
# Allow boards to use custom optimize flags on a per dir/file basis ALL_AFLAGS = $(AFLAGS) $(AFLAGS_$(BCURDIR)/$(@F)) $(AFLAGS_$(BCURDIR)) ALL_CFLAGS = $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) EXTRA_CPPFLAGS = $(CPPFLAGS_$(BCURDIR)/$(@F)) $(CPPFLAGS_$(BCURDIR)) ALL_CFLAGS += $(EXTRA_CPPFLAGS) # The _DEP version uses the $< file target (for dependency generation) # See rules.mk EXTRA_CPPFLAGS_DEP = $(CPPFLAGS_$(BCURDIR)/$(addsuffix .o,$(basename $<))) \ $(CPPFLAGS_$(BCURDIR)) |
9e4140329 kbuild: change ou... |
88 |
$(obj)/%.s: $(src)/%.S |
5651ccffa Makfile: move suf... |
89 |
$(CPP) $(ALL_AFLAGS) -o $@ $< |
9e4140329 kbuild: change ou... |
90 |
$(obj)/%.o: $(src)/%.S |
5651ccffa Makfile: move suf... |
91 |
$(CC) $(ALL_AFLAGS) -o $@ $< -c |
9e4140329 kbuild: change ou... |
92 |
$(obj)/%.o: $(src)/%.c |
5651ccffa Makfile: move suf... |
93 94 95 96 |
ifneq ($(CHECKSRC),0) $(CHECK) $(CHECKFLAGS) $(ALL_CFLAGS) $< endif $(CC) $(ALL_CFLAGS) -o $@ $< -c |
9e4140329 kbuild: change ou... |
97 |
$(obj)/%.i: $(src)/%.c |
5651ccffa Makfile: move suf... |
98 |
$(CPP) $(ALL_CFLAGS) -o $@ $< -c |
9e4140329 kbuild: change ou... |
99 |
$(obj)/%.s: $(src)/%.c |
5651ccffa Makfile: move suf... |
100 101 102 103 104 105 106 107 |
$(CC) $(ALL_CFLAGS) -o $@ $< -c -S # If the list of objects to link is empty, just create an empty built-in.o cmd_link_o_target = $(if $(strip $1),\ $(LD) $(LDFLAGS) -r -o $@ $1,\ rm -f $@; $(AR) rcs $@ ) ######################################################################### |
9e4140329 kbuild: change ou... |
108 |
# defines $(obj)/.depend target |
ce28d7ac6 Makefile: prepare... |
109 110 |
include $(TOPDIR)/rules.mk |
9e4140329 kbuild: change ou... |
111 |
sinclude $(obj)/.depend |
ce28d7ac6 Makefile: prepare... |
112 113 |
######################################################################### |
ac7e73532 Makefile: support... |
114 115 |
.PHONY: FORCE |