From f82c82a8cab027a0a57c71f6302bea22b4128460 Mon Sep 17 00:00:00 2001 From: Phil Pennock Date: Wed, 17 Jul 2013 04:16:25 -0400 Subject: [PATCH] Makefile fixes: 0.85.1 recut was unusable. When transitioning to git, I failed to test the build from a fresh tarball extraction, so did not notice that the new SCRIPTSRC vs SCRIPTDIST distinction made install impossible, because requisite source files for regenerating a target were not available. Simplest fix is also the most portable: strip out all targets intended for distributors. The segregated sections of the makefile have paid off, it's a simple sed command to strip out. So renamed "Makefile" to "makefile" for the git repo, but the distributed version is a Makefile with the distributor targets all ripped out, so that make(1) doesn't think it has to rebuild the sources we distribute. Additionally: when using install(1) to install to a directory, finish the target path with "/./" so that if .../bin/ does not exist we don't install the script as a file named "bin". "/." is sufficient for my install(1), but probably most portable to ensure target ends with a / if we want directory semantics for how install(1) decides what to do. --- Makefile => makefile | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) rename Makefile => makefile (83%) diff --git a/Makefile b/makefile similarity index 83% rename from Makefile rename to makefile index 1c4c644..a146c3e 100644 --- a/Makefile +++ b/makefile @@ -32,13 +32,13 @@ all: $(SCRIPTNAME) install: all install-bin install-man install-bin: $(SCRIPTNAME) - $(INSTALLPROG) -m $(BINPERM) $(INSTALLARGS) $(SCRIPTNAME) $(INSTALLROOT)$(PREFIX)/$(BINDIR) + $(INSTALLPROG) -m $(BINPERM) $(INSTALLARGS) $(SCRIPTNAME) $(INSTALLROOT)$(PREFIX)/$(BINDIR)/./ # making the man-page is dependent upon files not distributed, so they're # regenerated, so we don't list it as a dependency here -- instead we # assume that the maintainer created it for us (as a tarball depenency) install-man: - $(INSTALLPROG) -m $(MANPERM) $(INSTALLARGS) $(MANPAGE) $(INSTALLROOT)$(PREFIX)/$(MANDIR)/$(MANSECTDIR) + $(INSTALLPROG) -m $(MANPERM) $(INSTALLARGS) $(MANPAGE) $(INSTALLROOT)$(PREFIX)/$(MANDIR)/$(MANSECTDIR)/./ bin $(SCRIPTNAME): $(SCRIPTDIST) $(SED) <"$(SCRIPTDIST)" >"$(SCRIPTNAME)" "1s:/.*:$(PERL5BIN):" @@ -52,6 +52,14 @@ clean: dist: tarball pgpsig +# The presence of SCRIPTSRV and git rules breaks install from outside the git +# repository; we fix it by just ripping out the distributors section from the +# tarball Makefile. So "makefile" in git and for use when making a release. +# "Makefile" for distribution. BSD make prefers "makefile" to "Makefile", so +# we can still use distributor targets when both are present. +Makefile: makefile + sed '/Targets after here are for distributors/,$$d' < makefile > Makefile + $(SCRIPTDIST): $(SCRIPTSRC) versionfile perl -MFile::Slurp -p < $(SCRIPTSRC) > $(SCRIPTDIST) -e ' \ BEGIN { $$newver = read_file("versionfile"); chomp $$newver; }; \ @@ -82,4 +90,4 @@ datefile versionfile: .git/HEAD TZ='' git show -s --format=%ci HEAD | cut -d ' ' -f 1 > datefile distclean: clean - $(RM) -f "./$(MANPAGE)" ./ChangeLog ./versionfile ./datefile ./$(SCRIPTDIST) + $(RM) -f "./$(MANPAGE)" ./ChangeLog ./versionfile ./datefile ./$(SCRIPTDIST) ./Makefile