diff mbox series

[3/5] tests/resource: Rework Makefile

Message ID 20210615161905.9831-4-andrew.cooper3@citrix.com (mailing list archive)
State Superseded
Headers show
Series tools/tests: More cleanup for automation improvements | expand

Commit Message

Andrew Cooper June 15, 2021, 4:19 p.m. UTC
In particular, fill in the install/uninstall rules so this test can be
packaged to be automated sensibly.

Make all object files depend on the Makefile, and us $(TARGET) when
appropriate.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Ian Jackson <iwj@xenproject.org>
CC: Wei Liu <wl@xen.org>
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Juergen Gross <jgross@suse.com>
---
 tools/tests/resource/Makefile | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Andrew Cooper June 15, 2021, 4:49 p.m. UTC | #1
On 15/06/2021 17:19, Andrew Cooper wrote:
> In particular, fill in the install/uninstall rules so this test can be
> packaged to be automated sensibly.
>
> Make all object files depend on the Makefile, and us $(TARGET) when
> appropriate.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> CC: Ian Jackson <iwj@xenproject.org>
> CC: Wei Liu <wl@xen.org>
> CC: Jan Beulich <JBeulich@suse.com>
> CC: Roger Pau Monné <roger.pau@citrix.com>
> CC: Juergen Gross <jgross@suse.com>
> ---
>  tools/tests/resource/Makefile | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/tools/tests/resource/Makefile b/tools/tests/resource/Makefile
> index da5e2a4f9b..b22eb6fc21 100644
> --- a/tools/tests/resource/Makefile
> +++ b/tools/tests/resource/Makefile
> @@ -16,9 +16,12 @@ distclean: clean
>  
>  .PHONY: install
>  install: all
> +	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
> +	$(INSTALL_PROG) $(TARGET) $(DESTDIR)$(LIBEXEC_BIN)
>  
>  .PHONY: uninstall
>  uninstall:
> +	$(RM) -f -- $(DESTDIR)$(LIBEXEC_BIN)/$(TARGET)

I've finally figured out where $(RM) comes from.  Its a GNU Make
default, and has ` -f` included.

I've altered this and later patches in the series to take this into account.

~Andrew
diff mbox series

Patch

diff --git a/tools/tests/resource/Makefile b/tools/tests/resource/Makefile
index da5e2a4f9b..b22eb6fc21 100644
--- a/tools/tests/resource/Makefile
+++ b/tools/tests/resource/Makefile
@@ -16,9 +16,12 @@  distclean: clean
 
 .PHONY: install
 install: all
+	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
+	$(INSTALL_PROG) $(TARGET) $(DESTDIR)$(LIBEXEC_BIN)
 
 .PHONY: uninstall
 uninstall:
+	$(RM) -f -- $(DESTDIR)$(LIBEXEC_BIN)/$(TARGET)
 
 CFLAGS += -Werror
 CFLAGS += $(CFLAGS_xeninclude)
@@ -30,7 +33,9 @@  LDFLAGS += $(LDLIBS_libxenctrl)
 LDFLAGS += $(LDLIBS_libxenforeignmemory)
 LDFLAGS += $(APPEND_LDFLAGS)
 
-test-resource: test-resource.o
+*.o: Makefile
+
+$(TARGET): test-resource.o
 	$(CC) -o $@ $< $(LDFLAGS)
 
 -include $(DEPS_INCLUDE)