Message ID | 20220624160422.53457-12-anthony.perard@citrix.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Toolstack build system improvement, toward non-recursive makefiles | expand |
> On 24 Jun 2022, at 17:04, Anthony PERARD <anthony.perard@citrix.com> wrote: > > Remove "build" targets. > > Use "$(TARGETS)" to list binary to be built. > > Cleanup "clean" rule. > > Also drop conditional install of $(BIN) and $(LIBBIN) as those two > variables are now always populated. > > Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Hi Antony, Would it make sense to use := instead of =, for BIN, SBIN, LIBBIN, SCRIPTS? > --- > > Notes: > v2: > - fix typo in title > - drop conditional install of $(BIN) and $(LIBBIN) > > tools/xentrace/Makefile | 19 +++++++------------ > 1 file changed, 7 insertions(+), 12 deletions(-) > > diff --git a/tools/xentrace/Makefile b/tools/xentrace/Makefile > index 9fb7fc96e7..0995fa9203 100644 > --- a/tools/xentrace/Makefile > +++ b/tools/xentrace/Makefile > @@ -14,36 +14,31 @@ SBIN = xentrace xentrace_setsize > LIBBIN = xenctx > SCRIPTS = xentrace_format > > -.PHONY: all > -all: build > +TARGETS := $(BIN) $(SBIN) $(LIBBIN) > > -.PHONY: build > -build: $(BIN) $(SBIN) $(LIBBIN) > +.PHONY: all > +all: $(TARGETS) > > .PHONY: install > -install: build > +install: all > $(INSTALL_DIR) $(DESTDIR)$(bindir) > $(INSTALL_DIR) $(DESTDIR)$(sbindir) > - [ -z "$(LIBBIN)" ] || $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN) > -ifneq ($(BIN),) > + $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN) > $(INSTALL_PROG) $(BIN) $(DESTDIR)$(bindir) > -endif > $(INSTALL_PROG) $(SBIN) $(DESTDIR)$(sbindir) > $(INSTALL_PYTHON_PROG) $(SCRIPTS) $(DESTDIR)$(bindir) > - [ -z "$(LIBBIN)" ] || $(INSTALL_PROG) $(LIBBIN) $(DESTDIR)$(LIBEXEC_BIN) > + $(INSTALL_PROG) $(LIBBIN) $(DESTDIR)$(LIBEXEC_BIN) > > .PHONY: uninstall > uninstall: > rm -f $(addprefix $(DESTDIR)$(LIBEXEC_BIN)/, $(LIBBIN)) > rm -f $(addprefix $(DESTDIR)$(bindir)/, $(SCRIPTS)) > rm -f $(addprefix $(DESTDIR)$(sbindir)/, $(SBIN)) > -ifneq ($(BIN),) > rm -f $(addprefix $(DESTDIR)$(bindir)/, $(BIN)) > -endif Why here don’t we use $(RM) ?
On Fri, Jul 22, 2022 at 01:30:53PM +0000, Luca Fancellu wrote: > > On 24 Jun 2022, at 17:04, Anthony PERARD <anthony.perard@citrix.com> wrote: > > .PHONY: uninstall > > uninstall: > > rm -f $(addprefix $(DESTDIR)$(LIBEXEC_BIN)/, $(LIBBIN)) > > rm -f $(addprefix $(DESTDIR)$(bindir)/, $(SCRIPTS)) > > rm -f $(addprefix $(DESTDIR)$(sbindir)/, $(SBIN)) > > -ifneq ($(BIN),) > > rm -f $(addprefix $(DESTDIR)$(bindir)/, $(BIN)) > > -endif > > Why here don’t we use $(RM) ? Well, I don't think it matters which is used between $(RM) and rm -f, beside consistency maybe. So I don't think introducing changes on those line would be useful. (Also, it seems that the use of $(RM) for "uninstall" targets are exceptional so far.)
diff --git a/tools/xentrace/Makefile b/tools/xentrace/Makefile index 9fb7fc96e7..0995fa9203 100644 --- a/tools/xentrace/Makefile +++ b/tools/xentrace/Makefile @@ -14,36 +14,31 @@ SBIN = xentrace xentrace_setsize LIBBIN = xenctx SCRIPTS = xentrace_format -.PHONY: all -all: build +TARGETS := $(BIN) $(SBIN) $(LIBBIN) -.PHONY: build -build: $(BIN) $(SBIN) $(LIBBIN) +.PHONY: all +all: $(TARGETS) .PHONY: install -install: build +install: all $(INSTALL_DIR) $(DESTDIR)$(bindir) $(INSTALL_DIR) $(DESTDIR)$(sbindir) - [ -z "$(LIBBIN)" ] || $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN) -ifneq ($(BIN),) + $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN) $(INSTALL_PROG) $(BIN) $(DESTDIR)$(bindir) -endif $(INSTALL_PROG) $(SBIN) $(DESTDIR)$(sbindir) $(INSTALL_PYTHON_PROG) $(SCRIPTS) $(DESTDIR)$(bindir) - [ -z "$(LIBBIN)" ] || $(INSTALL_PROG) $(LIBBIN) $(DESTDIR)$(LIBEXEC_BIN) + $(INSTALL_PROG) $(LIBBIN) $(DESTDIR)$(LIBEXEC_BIN) .PHONY: uninstall uninstall: rm -f $(addprefix $(DESTDIR)$(LIBEXEC_BIN)/, $(LIBBIN)) rm -f $(addprefix $(DESTDIR)$(bindir)/, $(SCRIPTS)) rm -f $(addprefix $(DESTDIR)$(sbindir)/, $(SBIN)) -ifneq ($(BIN),) rm -f $(addprefix $(DESTDIR)$(bindir)/, $(BIN)) -endif .PHONY: clean clean: - $(RM) *.a *.so *.o *.rpm $(BIN) $(SBIN) $(LIBBIN) $(DEPS_RM) + $(RM) *.o $(TARGETS) $(DEPS_RM) .PHONY: distclean distclean: clean
Remove "build" targets. Use "$(TARGETS)" to list binary to be built. Cleanup "clean" rule. Also drop conditional install of $(BIN) and $(LIBBIN) as those two variables are now always populated. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> --- Notes: v2: - fix typo in title - drop conditional install of $(BIN) and $(LIBBIN) tools/xentrace/Makefile | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-)