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
18INIT_XENSTORE_DOMAIN_OBJS = init-xenstore-domain.o init-dom-json.o
19$(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
20$(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += $(CFLAGS_libxenguest)
21$(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += $(CFLAGS_libxenctrl)
22$(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += $(CFLAGS_libxenstore)
23$(INIT_XENSTORE_DOMAIN_OBJS): CFLAGS += $(CFLAGS_libxenlight)
24
25.PHONY: all
26all: $(PROGS)
27
28xen-init-dom0: $(XEN_INIT_DOM0_OBJS)
29	$(CC) $(LDFLAGS) -o $@ $(XEN_INIT_DOM0_OBJS) $(LDLIBS_libxentoollog) $(LDLIBS_libxenstore) $(LDLIBS_libxenlight) $(APPEND_LDFLAGS)
30
31$(INIT_XENSTORE_DOMAIN_OBJS): _paths.h
32
33init-xenstore-domain: $(INIT_XENSTORE_DOMAIN_OBJS)
34	$(CC) $(LDFLAGS) -o $@ $(INIT_XENSTORE_DOMAIN_OBJS) $(LDLIBS_libxentoollog) $(LDLIBS_libxenstore) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenlight) $(APPEND_LDFLAGS)
35
36.PHONY: install
37install: all
38	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
39	$(INSTALL_PROG) xen-init-dom0 $(DESTDIR)$(LIBEXEC_BIN)
40ifeq ($(CONFIG_Linux),y)
41	$(INSTALL_PROG) init-xenstore-domain $(DESTDIR)$(LIBEXEC_BIN)
42endif
43
44.PHONY: uninstall
45uninstall:
46ifeq ($(CONFIG_Linux),y)
47	rm -f $(DESTDIR)$(LIBEXEC_BIN)/init-xenstore-domain
48endif
49	rm -f $(DESTDIR)$(LIBEXEC_BIN)/xen-init-dom0
50
51.PHONY: clean
52clean:
53	$(RM) -f *.o $(PROGS) $(DEPS_RM) _paths.h
54
55distclean: clean
56
57genpath-target = $(call buildmakevars2header,_paths.h)
58$(eval $(genpath-target))
59