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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
CONFIG_SHELL := /bin/sh
HOSTCC := gcc
src := kconfig
srctree := .
obj ?= kconfig
include $(src)/Makefile
#HOSTCFLAGS+=-Dinline="" -include foo.h
-include $(obj)/.depend
$(obj)/.depend: $(wildcard *.h *.c)
$(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) -MM *.c > $@ 2>/dev/null || :
ifeq ($(MAKECMDGOALS),xconfig)
hostprogs-y := qconf
endif
ifeq ($(MAKECMDGOALS),gconfig)
hostprogs-y := gconf
endif
ifeq ($(MAKECMDGOALS),menuconfig)
hostprogs-y := mconf
endif
ifeq ($(MAKECMDGOALS),config)
hostprogs-y := conf
endif
ifeq ($(MAKECMDGOALS),nconfig)
hostprogs-y := nconf
endif
__hostprogs := $(sort $(hostprogs-y) $(hostprogs-m))
# C code
# Executables compiled from a single .c file
host-csingle := $(foreach m,$(__hostprogs), \
$(if $($(m)-objs)$($(m)-cxxobjs),,$(m)))
# C executables linked based on several .o files
host-cmulti := $(foreach m,$(__hostprogs),\
$(if $($(m)-cxxobjs),,$(if $($(m)-objs),$(m))))
# Object (.o) files compiled from .c files
host-cobjs := $(sort $(foreach m,$(__hostprogs),$($(m)-objs)))
# C++ code
# C++ executables compiled from at least one .cc file
# and zero or more .c files
host-cxxmulti := $(foreach m,$(__hostprogs),$(if $($(m)-cxxobjs),$(m)))
# C++ Object (.o) files compiled from .cc files
host-cxxobjs := $(sort $(foreach m,$(host-cxxmulti),$($(m)-cxxobjs)))
# output directory for programs/.o files
# hostprogs-y := tools/build may have been specified.
# Retrieve also directory of .o files from prog-objs or prog-cxxobjs notation
host-objdirs := $(dir $(__hostprogs) $(host-cobjs) $(host-cxxobjs))
host-objdirs := $(strip $(sort $(filter-out ./,$(host-objdirs))))
__hostprogs := $(addprefix $(obj)/,$(__hostprogs))
host-csingle := $(addprefix $(obj)/,$(host-csingle))
host-cmulti := $(addprefix $(obj)/,$(host-cmulti))
host-cobjs := $(addprefix $(obj)/,$(host-cobjs))
host-cxxmulti := $(addprefix $(obj)/,$(host-cxxmulti))
host-cxxobjs := $(addprefix $(obj)/,$(host-cxxobjs))
host-objdirs := $(addprefix $(obj)/,$(host-objdirs))
HOST_EXTRACFLAGS += -I$(obj) -DCONFIG_=\"\"
$(host-csingle): %: %.c
$(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $< -o $@
$(host-cmulti): %: $(host-cobjs) $(host-cshlib)
$(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $(addprefix $(obj)/,$($(@F)-objs)) $(HOSTLOADLIBES_$(@F)) -o $@
$(host-cxxmulti): %: $(host-cxxobjs) $(host-cobjs) $(host-cshlib)
$(HOSTCXX) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCXXFLAGS_$@) $(addprefix $(obj)/,$($(@F)-objs) $($(@F)-cxxobjs)) $(HOSTLOADLIBES_$(@F)) -o $@
$(obj)/%.o: %.c
$(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$(@F)) -c $< -o $@
$(obj)/%.o: $(obj)/%.c
$(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$(@F)) -c $< -o $@
$(obj)/%.o: %.cc
$(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCXXFLAGS_$(@F)) -c $< -o $@
$(obj)/%:: $(src)/%_shipped
$(Q)cat $< > $@
clean:
$(Q)rm -f $(addprefix $(obj)/,$(clean-files))
distclean: clean
$(Q)rm -f $(addprefix $(obj)/,$(lxdialog) $(conf-objs) $(mconf-objs) $(kxgettext-objs) \
$(hostprogs-y) $(qconf-cxxobjs) $(qconf-objs) $(gconf-objs) $(nconf-objs) \
mconf .depend)
FORCE:
.PHONY: FORCE clean distclean
|