Files
xen/tools/libfsimage/common/Makefile
T
Anthony PERARD 4aa436df4b tools/libfsimage: Cleanup makefiles
Remove the need for "fs-*" targets by creating a "common.mk" which
have flags that are common to libfsimage/common/ and the other
libfsimages/*/ directories.

In common.mk, make $(PIC_OBJS) a recursively expanded variable so it
doesn't matter where $(LIB_SRCS-y) is defined, and remove the extra
$(PIC_OBJS) from libfsimage/common/Makefile.

Use a $(TARGETS) variable to list things to be built. And $(TARGETS)
can be use in the clean target in common.mk.

iso9660/:
    Remove the explicit dependency between fsys_iso9660.c and
    iso9660.h, this is handled automaticaly by the .*.d dependency files,
    and iso9660.h already exist.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
2022-08-15 08:55:21 +02:00

51 lines
1.7 KiB
Makefile

XEN_ROOT = $(CURDIR)/../../..
include $(XEN_ROOT)/tools/libfsimage/common.mk
MAJOR := $(shell $(XEN_ROOT)/version.sh $(XEN_ROOT)/xen/Makefile)
MINOR = 0
LDFLAGS-$(CONFIG_SunOS) = -Wl,-M -Wl,mapfile-SunOS
LDFLAGS-$(CONFIG_Linux) = -Wl,mapfile-GNU
LDFLAGS += $(LDFLAGS-y)
CFLAGS += $(PTHREAD_CFLAGS)
LDFLAGS += $(PTHREAD_LDFLAGS)
LIB_SRCS-y = fsimage.c fsimage_plugin.c fsimage_grub.c
TARGETS = libxenfsimage.so libxenfsimage.so.$(MAJOR) libxenfsimage.so.$(MAJOR).$(MINOR)
.PHONY: all
all: $(TARGETS)
.PHONY: install
install: all
$(INSTALL_DIR) $(DESTDIR)$(libdir)
$(INSTALL_DIR) $(DESTDIR)$(includedir)
$(INSTALL_PROG) libxenfsimage.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)
ln -sf libxenfsimage.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)/libxenfsimage.so.$(MAJOR)
ln -sf libxenfsimage.so.$(MAJOR) $(DESTDIR)$(libdir)/libxenfsimage.so
$(INSTALL_DATA) xenfsimage.h $(DESTDIR)$(includedir)
$(INSTALL_DATA) xenfsimage_plugin.h $(DESTDIR)$(includedir)
$(INSTALL_DATA) xenfsimage_grub.h $(DESTDIR)$(includedir)
.PHONY: uninstall
uninstall:
rm -f $(DESTDIR)$(includedir)/xenfsimage_grub.h
rm -f $(DESTDIR)$(includedir)/xenfsimage_plugin.h
rm -f $(DESTDIR)$(includedir)/xenfsimage.h
rm -f $(DESTDIR)$(libdir)/libxenfsimage.so
rm -f $(DESTDIR)$(libdir)/libxenfsimage.so.$(MAJOR)
rm -f $(DESTDIR)$(libdir)/libxenfsimage.so.$(MAJOR).$(MINOR)
libxenfsimage.so: libxenfsimage.so.$(MAJOR)
ln -sf $< $@
libxenfsimage.so.$(MAJOR): libxenfsimage.so.$(MAJOR).$(MINOR)
ln -sf $< $@
libxenfsimage.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenfsimage.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(PTHREAD_LIBS) $(APPEND_LDFLAGS)
-include $(DEPS_INCLUDE)