1# xen/tools/kconfig
2
3# default rule to do nothing
4all:
5
6# Xen doesn't have a silent build flag
7quiet := silent_
8Q := @
9kecho := :
10
11# eventually you'll want to do out of tree builds
12srctree := $(XEN_ROOT)/xen
13objtree := $(srctree)
14src := tools/kconfig
15obj := $(src)
16KBUILD_SRC :=
17
18# handle functions (most of these lifted from different Linux makefiles
19dot-target = $(dir $@).$(notdir $@)
20depfile = $(subst $(comma),,$(dot-target).d)
21basetarget = $(basename $(notdir $@))
22cmd = $(cmd_$(1))
23if_changed = $(cmd_$(1))
24if_changed_dep = $(cmd_$(1))
25
26define multi_depend
27$(foreach m, $(notdir $1), \
28	$(eval $(obj)/$m: \
29	$(addprefix $(obj)/, $(foreach s, $3, $($(m:%$(strip $2)=%$(s)))))))
30endef
31
32# Set our default defconfig file
33KBUILD_DEFCONFIG := $(ARCH)_defconfig
34
35# provide our shell
36CONFIG_SHELL := $(SHELL)
37
38# provide the host compiler
39HOSTCC ?= gcc
40HOSTCXX ?= g++
41
42# force target
43PHONY += FORCE
44
45FORCE:
46
47# include the original Makefile and Makefile.host from Linux
48include $(src)/Makefile
49include $(src)/Makefile.host
50
51# clean up rule
52clean-deps = $(foreach f,$(host-cobjs) $(host-cxxobjs),$(dir $f).$(notdir $f).d)
53clean-shipped = $(patsubst %_shipped,%,$(wildcard $(obj)/*_shipped))
54
55clean:
56	rm -rf $(clean-files)
57	rm -rf $(clean-deps)
58	rm -rf $(host-csingle) $(host-cmulti) $(host-cxxmulti) $(host-cobjs) $(host-cxxobjs)
59	rm -rf $(clean-shipped)
60
61$(obj)/zconf%: $(src)/zconf%_shipped
62	@cp -f $< $@
63