1XEN_ROOT = $(CURDIR)/../../..
2include $(XEN_ROOT)/tools/libfsimage/Rules.mk
3
4MAJOR = 1.0
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 = libfsimage.so libfsimage.so.$(MAJOR) libfsimage.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) libfsimage.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)
28	ln -sf libfsimage.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)/libfsimage.so.$(MAJOR)
29	ln -sf libfsimage.so.$(MAJOR) $(DESTDIR)$(libdir)/libfsimage.so
30	$(INSTALL_DATA) fsimage.h $(DESTDIR)$(includedir)
31	$(INSTALL_DATA) fsimage_plugin.h $(DESTDIR)$(includedir)
32	$(INSTALL_DATA) fsimage_grub.h $(DESTDIR)$(includedir)
33
34.PHONY: uninstall
35uninstall:
36	rm -f $(DESTDIR)$(includedir)/fsimage_grub.h
37	rm -f $(DESTDIR)$(includedir)/fsimage_plugin.h
38	rm -f $(DESTDIR)$(includedir)/fsimage.h
39	rm -f $(DESTDIR)$(libdir)/libfsimage.so
40	rm -f $(DESTDIR)$(libdir)/libfsimage.so.$(MAJOR)
41	rm -f $(DESTDIR)$(libdir)/libfsimage.so.$(MAJOR).$(MINOR)
42
43clean distclean::
44	rm -f $(LIB)
45
46libfsimage.so: libfsimage.so.$(MAJOR)
47	ln -sf $< $@
48libfsimage.so.$(MAJOR): libfsimage.so.$(MAJOR).$(MINOR)
49	ln -sf $< $@
50
51libfsimage.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
52	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libfsimage.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(PTHREAD_LIBS) $(APPEND_LDFLAGS)
53
54-include $(DEPS_INCLUDE)
55
56