1#
2# tools/helpers/Makefile
3#
4
5XEN_ROOT = $(CURDIR)/../..
6include $(XEN_ROOT)/tools/Rules.mk
7
8PROGS += xen-init-dom0
9ifeq ($(CONFIG_Linux),y)
10PROGS += init-xenstore-domain
11endif
12
13XEN_INIT_DOM0_OBJS = xen-init-dom0.o init-dom-json.o
14$(XEN_INIT_DOM0_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
15$(XEN_INIT_DOM0_OBJS): CFLAGS += $(CFLAGS_libxenstore)
16$(XEN_INIT_DOM0_OBJS): CFLAGS += $(CFLAGS_libxenlight)
17$(XEN_INIT_DOM0_OBJS): CFLAGS += $(CFLAGS_libxenctrl)
18
19INIT_XENSTORE_DOMAIN_OBJS = init-xenstore-domain.o init-dom-json.o
20$(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
21$(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += $(CFLAGS_libxenguest)
22$(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += $(CFLAGS_libxenctrl)
23$(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += $(CFLAGS_libxenstore)
24$(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += $(CFLAGS_libxenlight)
25
26.PHONY: all
27all: $(PROGS)
28
29xen-init-dom0: $(XEN_INIT_DOM0_OBJS)
30	$(CC) $(LDFLAGS) -o $@ $(XEN_INIT_DOM0_OBJS) $(LDLIBS_libxenctrl) $(LDLIBS_libxentoollog) $(LDLIBS_libxenstore) $(LDLIBS_libxenlight) $(APPEND_LDFLAGS)
31
32$(INIT_XENSTORE_DOMAIN_OBJS): _paths.h
33
34init-xenstore-domain: $(INIT_XENSTORE_DOMAIN_OBJS)
35	$(CC) $(LDFLAGS) -o $@ $(INIT_XENSTORE_DOMAIN_OBJS) $(LDLIBS_libxentoollog) $(LDLIBS_libxenstore) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenlight) $(APPEND_LDFLAGS)
36
37.PHONY: install
38install: all
39	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
40	$(INSTALL_PROG) xen-init-dom0 $(DESTDIR)$(LIBEXEC_BIN)
41ifeq ($(CONFIG_Linux),y)
42	$(INSTALL_PROG) init-xenstore-domain $(DESTDIR)$(LIBEXEC_BIN)
43endif
44
45.PHONY: uninstall
46uninstall:
47ifeq ($(CONFIG_Linux),y)
48	rm -f $(DESTDIR)$(LIBEXEC_BIN)/init-xenstore-domain
49endif
50	rm -f $(DESTDIR)$(LIBEXEC_BIN)/xen-init-dom0
51
52.PHONY: clean
53clean:
54	$(RM) -f *.o $(PROGS) $(DEPS_RM) _paths.h
55
56distclean: clean
57
58genpath-target = $(call buildmakevars2header,_paths.h)
59$(eval $(genpath-target))
60