[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/4] tests/cpu-policy: Rework Makefile


  • To: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Tue, 22 Jun 2021 19:21:23 +0100
  • Authentication-results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Jan Beulich <JBeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
  • Delivery-date: Tue, 22 Jun 2021 18:21:47 +0000
  • Ironport-hdrordr: A9a23:3mOxfK4tkSdTt2hrAAPXwXWBI+orL9Y04lQ7vn2ZFiYlF/Bwxv re/sjziyWE6wr5AEtQ6uxpOMG7MAjhHO1OkPss1NaZLU3bUQ6TRvAH0WKM+UyeJ8STzJ8l6U 4kSdkPNDSSNyk8sS+Z2njHLz9I+rDum83F6om+rwYLPGdXguNbnnZE422gYzdLrXx9dOYE/e 2nl7d6TlSbCAwqR/X+IkNAc/nIptXNmp6jSwUBHQQb5A6Hii7twKLmEjCDty1uFQ9n8PMHyy zoggb57qKsv7WQ0RnHzVLe6JxQhZ/I1sZDPsqRkcIYQw+c0zpAJb4RA4FqjgpF+t1H22xaze UkZC1QY/ib3kmhJV1dZyGdhDUIngxetUMKgmXo9EcL6faJMA7STfAx1L6xpSGpu3bI9esMpp 6i0w+ixu1qJAKFkyLn69fSURZ20kKyvHo5iOYWy2dSSI0EddZq3M8iFW5uYdY99RjBmcAa+S hVfY3hzecTdUnfY2HSv2FpztDpVnMvHg2eSkxHvsCOyTBZkH1w0kNdnaUk7zI93YN4T4MB6/ XPM6xumr0LRsgKbbhlDONERcesEGTCTR/FLWrXK1X6E6MMPW7LtvfMkfcIDSGRCdI1Jb4J6d n8uX9jxCUPknPVeIKzNcdwg1jwqU2GLH7QI+9lltFEhoE=
  • Ironport-sdr: OGBFqrArpyeROX0zZptHVTRLumLtvycqbI69jAu+cwGqyeLCt4BxrCiuEv1N4fOU7FfvNMSkSW uHj3JGzH4+A+cfXakgdxfYjuFLrMKtI3svo6IopvkNnskwqK6wE2VyNrO4qlRoDY6f3gg5un1c BIwknrx/utyqJ12m6EKPWSfu+EI7SNu5EzOEtLe03rzMyellzY3TGc/dbducKIPWMZFiWEYyla EQak3yGLq3vFabJFNka7EV1SS9RKcnzTlqZoNlegZj5gvKaFgT1XE8QjbkfS819QFHd0b06P3P 6Tg=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

In particular, fill in the install/uninstall rules so this test can be
packaged to be automated sensibly.

Rework TARGET-y to be TARGETS, drop redundant -f's for $(RM), drop the
unconditional -O3 and use the default instead, and drop CFLAGS from the link
line but honour APPEND_LDFLAGS.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Ian Jackson <iwj@xxxxxxxxxxxxxx>
CC: Wei Liu <wl@xxxxxxx>
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
CC: Juergen Gross <jgross@xxxxxxxx>

v2:
 * Drop -f's
 * Use %.o rather than *.o for Make level wildcards
---
 tools/tests/cpu-policy/Makefile | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/tools/tests/cpu-policy/Makefile b/tools/tests/cpu-policy/Makefile
index 70ff154da6..161732ad16 100644
--- a/tools/tests/cpu-policy/Makefile
+++ b/tools/tests/cpu-policy/Makefile
@@ -1,21 +1,19 @@
 XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-TARGET-y := test-cpu-policy
+TARGETS :=
 
 # For brevity, these tests make extensive use of designated initialisers in
 # anonymous unions, but GCCs older than 4.6 can't cope.  Ignore the test in
 # this case.
-ifneq ($(clang),y)
-TARGET-$(call cc-ver,$(CC),lt,0x040600) :=
-endif
-
-ifeq ($(TARGET-y),)
+ifneq ($(gcc)$(call cc-ver,$(CC),lt,0x040600),yy)
+TARGETS += test-cpu-policy
+else
 $(warning Test harness not built, use newer compiler than "$(CC)" (version 
$(shell $(CC) -dumpversion)))
 endif
 
 .PHONY: all
-all: $(TARGET-y)
+all: $(TARGETS)
 
 .PHONY: run
 run: $(TARGET-y)
@@ -23,23 +21,32 @@ run: $(TARGET-y)
 
 .PHONY: clean
 clean:
-       $(RM) -f -- *.o .*.d .*.d2 test-cpu-policy
+       $(RM) -- *.o $(TARGETS) $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
-       $(RM) -f -- *~
+       $(RM) -- *~
 
 .PHONY: install
 install: all
+       $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
+       $(if $(TARGETS),$(INSTALL_PROG) $(TARGETS) $(DESTDIR)$(LIBEXEC_BIN))
 
 .PHONY: uninstall
+uninstall:
+       $(RM) -- $(addprefix $(DESTDIR)$(LIBEXEC_BIN)/,$(TARGETS))
 
-CFLAGS += -Werror $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -O3
+CFLAGS += -Werror -D__XEN_TOOLS__
+CFLAGS += $(CFLAGS_xeninclude)
 CFLAGS += $(APPEND_CFLAGS)
 
-vpath %.c ../../../xen/lib/x86
+LDFLAGS += $(APPEND_LDFLAGS)
+
+vpath %.c $(XEN_ROOT)/xen/lib/x86
+
+%.o: Makefile
 
 test-cpu-policy: test-cpu-policy.o msr.o cpuid.o policy.o
-       $(CC) $(CFLAGS) $^ -o $@
+       $(CC) $^ -o $@ $(LDFLAGS)
 
 -include $(DEPS_INCLUDE)
-- 
2.11.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.