1XEN_ROOT = $(CURDIR)/../../..
2include $(XEN_ROOT)/tools/libfsimage/Rules.mk
3
4MAJOR = 4.14
5MINOR = 0
6
7LDFLAGS-$(CONFIG_SunOS) = -Wl,-M -Wl,mapfile-SunOS
8LDFLAGS-$(CONFIG_Linux) = -Wl,mapfile-GNU
9LDFLAGS += $(LDFLAGS-y)
10
11CFLAGS += $(PTHREAD_CFLAGS)
12LDFLAGS += $(PTHREAD_LDFLAGS)
13
14LIB_SRCS-y = fsimage.c fsimage_plugin.c fsimage_grub.c
15
16PIC_OBJS := $(patsubst %.c,%.opic,$(LIB_SRCS-y))
17
18LIB = libxenfsimage.so libxenfsimage.so.$(MAJOR) libxenfsimage.so.$(MAJOR).$(MINOR)
19
20.PHONY: all
21all: $(LIB)
22
23.PHONY: install
24install: all
25	$(INSTALL_DIR) $(DESTDIR)$(libdir)
26	$(INSTALL_DIR) $(DESTDIR)$(includedir)
27	$(INSTALL_PROG) libxenfsimage.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)
28	ln -sf libxenfsimage.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)/libxenfsimage.so.$(MAJOR)
29	ln -sf libxenfsimage.so.$(MAJOR) $(DESTDIR)$(libdir)/libxenfsimage.so
30	$(INSTALL_DATA) xenfsimage.h $(DESTDIR)$(includedir)
31	$(INSTALL_DATA) xenfsimage_plugin.h $(DESTDIR)$(includedir)
32	$(INSTALL_DATA) xenfsimage_grub.h $(DESTDIR)$(includedir)
33
34.PHONY: uninstall
35uninstall:
36	rm -f $(DESTDIR)$(includedir)/xenfsimage_grub.h
37	rm -f $(DESTDIR)$(includedir)/xenfsimage_plugin.h
38	rm -f $(DESTDIR)$(includedir)/xenfsimage.h
39	rm -f $(DESTDIR)$(libdir)/libxenfsimage.so
40	rm -f $(DESTDIR)$(libdir)/libxenfsimage.so.$(MAJOR)
41	rm -f $(DESTDIR)$(libdir)/libxenfsimage.so.$(MAJOR).$(MINOR)
42
43clean distclean::
44	rm -f $(LIB)
45
46libxenfsimage.so: libxenfsimage.so.$(MAJOR)
47	ln -sf $< $@
48libxenfsimage.so.$(MAJOR): libxenfsimage.so.$(MAJOR).$(MINOR)
49	ln -sf $< $@
50
51libxenfsimage.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
52	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenfsimage.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(PTHREAD_LIBS) $(APPEND_LDFLAGS)
53
54-include $(DEPS_INCLUDE)
55
56