tests/resource: Rework Makefile
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 15 Jun 2021 14:22:11 +0000 (15:22 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 9 Jul 2021 15:38:27 +0000 (16:38 +0100)
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, drop redundant -f's for $(RM),
and use $(TARGET) when appropriate.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
tools/tests/resource/Makefile

index 4bef4829666b904b281b33a337ce71f8a3e651c9..1c3aee4ff74e25cf5f8c6d00a1e4d933acd297c4 100644 (file)
@@ -12,17 +12,20 @@ run: $(TARGET)
 
 .PHONY: clean
 clean:
-       $(RM) -f -- *.o $(TARGET) $(DEPS_RM)
+       $(RM) -- *.o $(TARGET) $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
-       $(RM) -f -- *~
+       $(RM) -- *~
 
 .PHONY: install
 install: all
+       $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
+       $(INSTALL_PROG) $(TARGET) $(DESTDIR)$(LIBEXEC_BIN)
 
 .PHONY: uninstall
 uninstall:
+       $(RM) -- $(DESTDIR)$(LIBEXEC_BIN)/$(TARGET)
 
 CFLAGS += -Werror
 CFLAGS += $(CFLAGS_xeninclude)
@@ -34,7 +37,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)