diff --git a/Makefile b/Makefile index 457f9036a..170282190 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,3 @@ -# Please edit Makefile.in rather than Makefile, which is overwritten by ../configure. PREFIX=/usr/local INSTALLDIR=$(PREFIX)/bin @@ -17,11 +16,11 @@ check: go test -v install: build - cp mlr $(INSTALLDIR) + cp mlr $(DESTDIR)/$(INSTALLDIR) make -C man install fmt: - go fmt ./... + -go fmt ./... # For developers before pushing to GitHub. # diff --git a/configure b/configure index 371f9903b..e6e7dbb73 100755 --- a/configure +++ b/configure @@ -2,26 +2,46 @@ usage() { echo "Usage: $0 [--prefix {prefix directory}], e.g. /usr/local" 2>&1 + echo " or $0 [--prefix={prefix directory}], e.g. /usr/local" 2>&1 exit 1 } prefix="/usr/local" + if [ $# -eq 0 ]; then echo "Using $prefix" -elif [ $# -ne 2 ]; then +elif [ $# -gt 2 ]; then usage else - if [ "$1" != "--prefix" ]; then - usage - fi - # Test for read access, not write access, since people can ./configure, make, - # and make check outside of sudo and then make install inside sudo. - prefix="$2" - if [ ! -d "$prefix" ]; then - echo "$0: could not find prefix directory \"$prefix\"" - exit 1 - fi + while [ $# -gt 0 ]; do + case "$1" in + -p=* | --prefix=*) + prefix="${1#*=}" + ;; + -p | --prefix) + prefix="$2" + shift + ;; + *) + printf "Error: unknown option: $1\n" + usage + esac + shift + done +fi + +# Test for read access, not write access, since people can ./configure, make, +# and make check outside of sudo and then make install inside sudo. +if [ ! -d "$prefix" ]; then + echo "$0: could not find prefix directory \"$prefix\"" + exit 1 fi sed -I .prefix-backup 's@^PREFIX.*@PREFIX='$prefix'@' Makefile +rm Makefile.prefix-backup +echo Updated Makefile + sed -I .prefix-backup 's@^PREFIX.*@PREFIX='$prefix'@' man/Makefile +rm man/Makefile.prefix-backup +echo Updated man/Makefile + diff --git a/man/Makefile b/man/Makefile index c2d9d99f3..bfa8270c4 100644 --- a/man/Makefile +++ b/man/Makefile @@ -1,5 +1,3 @@ -# Please edit Makefile.in rather than Makefile, which is overwritten by ../configure. -# # Respective MANPATH entries would include /usr/local/share/man or $HOME/man. # This should be run after make in the ../c directory but before make in the ../docs directory, # since ../go/mlr is used to autogenerate ./manpage.txt which is used in ../docs. @@ -12,7 +10,7 @@ INSTALLDIR=$(PREFIX)/share/man/man1 # needing only to be copied to its install dir. # Copying to man1/mlr1 is so that you can then put the Miller dir in your # $MANPATH and do "man mlr". -build: .always +build: echo mkman start ./mkman.rb > mlr.1 ./mkman.rb | groff -man -Tascii | col -b | expand -8 > manpage.txt @@ -22,10 +20,8 @@ build: .always cp mlr.1 ./man1 install: - mkdir -p $(INSTALLDIR) - cp mlr.1 $(INSTALLDIR)/mlr.1 - + mkdir -p $(DESTDIR)/$(INSTALLDIR) + cp mlr.1 $(DESTDIR)/$(INSTALLDIR)/mlr.1 # ---------------------------------------------------------------- -.always: - true +.PHONY: build install diff --git a/todo.txt b/todo.txt index 1990bb9f9..389eee4f3 100644 --- a/todo.txt +++ b/todo.txt @@ -3,20 +3,16 @@ PUNCHDOWN LIST * plan: o release prep - k ./configure experiment - k miller.spec experiment - k 'make release_tarball' - o update build.mi#dev steps o man & docs use (export PATH ...) base/mlr + o local phi/mh -> ~/g/j/m; m6 redirect to rtd -- ? + o DESTDIR doc ... + https://www.gnu.org/prep/standards/html_node/DESTDIR.html o miller/mlr ... try skitt: - cmd/layout -- ? - go install github.com/johnkerl/miller/cmd/mlr - go build {what goes here?} + o make an open issue for the maybe-rename -- ? o conda etc - get a conda link for rmd - - distcheck: gtar --transform 's,^./,miller-6.0.0/,' --exclude ./.git -czf /tmp/miller-6.0.0.tgz . - > also exclude: data, docs, experiments, per, python, vim - > on macos, 'brew install gnu-tar' will install 'gtar' o blockers: - fractional-strptime - cmp-matrices