Files
xen/tools/xs-clients/Makefile
T
Andrew Cooper 5d8c784783 tools/xs-clients: Fix make clean rule
Prior to the split, "the clients" used tools/xenstored/Makefile.common whose
clean rule includes *.o whereas after the split, the removal of *.o was lost
by virtule of not including Makefile.common any more.

This is the bug behind the following build error:

  make[2]: Entering directory '/local/xen.git/tools/xs-clients'
  gcc     xenstore_client.o    (snip)
  /usr/bin/ld: xenstore_client.o: relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
  /usr/bin/ld: failed to set dynamic section sizes: bad value
  collect2: error: ld returned 1 exit status
  make[2]: *** [Makefile:35: xenstore] Error 1

which was caused by `make clean` not properly cleaning the tree as I was
swapping between various build containers.

Switch to a plain single-colon clean rule.

Fixes: 5c293058b1 ("tools/xenstore: move xenstored sources into dedicated directory")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
2024-07-04 11:32:55 +01:00

70 lines
1.8 KiB
Makefile

XEN_ROOT=$(CURDIR)/../..
include $(XEN_ROOT)/tools/Rules.mk
CFLAGS += -include $(XEN_ROOT)/tools/config.h
CFLAGS += $(CFLAGS_libxenctrl)
CFLAGS += $(CFLAGS_libxenguest)
CFLAGS += $(CFLAGS_libxentoolcore)
CFLAGS += $(CFLAGS_libxenstore)
xenstore: LDLIBS += $(LDLIBS_libxenstore)
xenstore: LDLIBS += $(LDLIBS_libxentoolcore)
xenstore: LDLIBS += $(SOCKET_LIBS)
xenstore-control: LDLIBS += $(LDLIBS_libxenstore)
xenstore-control: LDLIBS += $(LDLIBS_libxenctrl)
xenstore-control: LDLIBS += $(LDLIBS_libxenguest)
xenstore-control: LDLIBS += $(LDLIBS_libxentoolcore)
xenstore-control: LDLIBS += $(SOCKET_LIBS)
CLIENTS := xenstore-exists xenstore-list xenstore-read xenstore-rm xenstore-chmod
CLIENTS += xenstore-write xenstore-ls xenstore-watch
TARGETS := xenstore $(CLIENTS) xenstore-control
.PHONY: all
all: $(TARGETS)
.PHONY: clients
clients: xenstore $(CLIENTS) xenstore-control
$(CLIENTS): xenstore
ln -f xenstore $@
xenstore: xenstore_client.o
$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@ $(APPEND_LDFLAGS)
xenstore-control: xenstore_control.o
$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@ $(APPEND_LDFLAGS)
.PHONY: clean
clean:
$(RM) *.o $(TARGETS) $(DEPS_RM)
.PHONY: distclean
distclean: clean
.PHONY: TAGS
TAGS:
etags `find . -name '*.[ch]'`
.PHONY: install
install: all
$(INSTALL_DIR) $(DESTDIR)$(bindir)
$(INSTALL_PROG) xenstore-control $(DESTDIR)$(bindir)
$(INSTALL_PROG) xenstore $(DESTDIR)$(bindir)
set -e ; for c in $(CLIENTS) ; do \
ln -f $(DESTDIR)$(bindir)/xenstore $(DESTDIR)$(bindir)/$${c} ; \
done
.PHONY: uninstall
uninstall:
rm -f $(addprefix $(DESTDIR)$(bindir)/, $(CLIENTS))
rm -f $(DESTDIR)$(bindir)/xenstore
rm -f $(DESTDIR)$(bindir)/xenstore-control
if [ -d $(DESTDIR)$(includedir)/xenstore-compat ]; then \
rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/xenstore-compat; \
fi
-include $(DEPS_INCLUDE)