Merge branch 'refs/heads/t/makefile_conventions'
authorAndre Noll <maan@tuebingen.mpg.de>
Wed, 19 Apr 2017 17:13:20 +0000 (19:13 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Wed, 19 Apr 2017 17:16:25 +0000 (19:16 +0200)
A bunch of changes which strive to make the paraslash build system
more standard.

Cooking for three months.

* refs/heads/t/makefile_conventions:
  build: Add target "check" as a synonym for "test".
  build: Rename target "tarball" to "dist".
  build: Do not strip installed executables by default.
  build: Support $(DESTDIR).
  build: Rename clean targets.

INSTALL
Makefile.in
Makefile.real
NEWS.md
autogen.sh
configure.ac
t/makefile.test

diff --git a/INSTALL b/INSTALL
index 85b4fab1ff04219e136ea00fe6cfb2d1a5ea97ab..547036b104d03759d79626e6ac3b686b165b88c0 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -16,10 +16,8 @@ Installing paraslash from git
 
 Example for cross-compiling
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
-       export CROSS_COMPILE='armv6j-hardfloat-linux-gnueabi-'
+       export CC='armv6j-hardfloat-linux-gnueabi-gcc'
        export PATH="/usr/cross/arm/bin:$PATH"
-       export CC=${CROSS_COMPILE}gcc
-
        export LDFLAGS='
                -L/usr/sysroot/arm/lib
                -L/usr/sysroot/arm/usr/lib
@@ -29,7 +27,7 @@ Example for cross-compiling
        autoconf
        autoheader
        ./configure --host=arm-linux-gnueabi --prefix /usr/sysroot/arm/usr/local
-       make CROSS_COMPILE=$CROSS_COMPILE
+       make
 
 For details see the user manual:
 
index 3c51029bcb16234f2e6f19552c2769d6e50c3f54..6e84b6fd291b5111f2c0aef473b7d05f10950f5f 100644 (file)
@@ -8,7 +8,6 @@ datarootdir := @datarootdir@
 PACKAGE_TARNAME := @PACKAGE_TARNAME@
 PACKAGE_VERSION := @PACKAGE_VERSION@
 
-INSTALL := @INSTALL@
 M4 := @M4@
 GENGETOPT := @GENGETOPT@
 HELP2MAN := @HELP2MAN@
index 8a8cd4342554f18cc05ca70c3f31a830e2a17e79..5e4dbe68c0308bf1b385c84e94d808d4f740b625 100644 (file)
@@ -9,7 +9,6 @@ endif
 
 vardir := /var/paraslash
 mandir := $(datarootdir)/man/man1
-STRIP := $(CROSS_COMPILE)strip
 MKDIR_P := mkdir -p
 prefixed_executables := $(addprefix para_, $(executables))
 
@@ -63,10 +62,11 @@ tarball_pfx := $(PACKAGE_TARNAME)-$(GIT_VERSION)
 tarball_delete := $(addprefix $(tarball_pfx)/, web .gitignore)
 tarball := $(tarball_pfx).tar.bz2
 
-.PHONY: all clean clean2 distclean maintainer-clean install man tarball
 all: $(prefixed_executables) $(man_pages)
+.PHONY: all mostlyclean clean distclean maintainer-clean install \
+       install-strip man dist tarball
+
 man: $(man_pages)
-tarball: $(tarball)
 
 include $(m4_ggo_dir)/makefile
 include $(test_dir)/makefile.test
@@ -335,31 +335,36 @@ $(prefixed_executables):
        @[ -z "$(Q)" ] || echo 'LD $@'
        $(Q) $(CC) $^ -o $@ $(LDFLAGS)
 
-clean:
-       @[ -z "$(Q)" ] || echo 'CLEAN'
+mostlyclean:
+       @[ -z "$(Q)" ] || echo 'MOSTLYCLEAN'
        $(Q) rm -f para_*
        $(Q) rm -rf $(object_dir)
-
-clean2: clean
-       @[ -z "$(Q)" ] || echo 'CLEAN2'
+clean: mostlyclean
+       @[ -z "$(Q)" ] || echo 'CLEAN'
        $(Q) rm -rf $(build_dir)
-distclean: clean2 test-clean
+distclean: clean
        @[ -z "$(Q)" ] || echo 'DISTCLEAN'
        $(Q) rm -f Makefile autoscan.log config.status config.log
-       $(Q) rm -f GPATH GRTAGS GSYMS GTAGS
-
+       $(Q) rm -f config.h configure config.h.in
 maintainer-clean: distclean
        @[ -z "$(Q)" ] || echo 'MAINTAINER-CLEAN'
-       $(Q) rm -f *.tar.bz2 config.h configure config.h.in
+       $(Q) rm -f *.tar.bz2
+       $(Q) rm -f GPATH GRTAGS GSYMS GTAGS
+
+INSTALL ?= install
+INSTALL_PROGRAM ?= $(INSTALL)
+INSTALL_DATA ?= $(INSTALL) -m 644
+ifneq ($(findstring strip, $(MAKECMDGOALS)),)
+       strip_option := -s
+endif
 
-install: all man
-       $(MKDIR_P) $(bindir) $(mandir)
-       $(INSTALL) -s --strip-program $(STRIP) -m 755 \
-               $(prefixed_executables) $(bindir)
-       $(INSTALL) -m 644 $(man_pages) $(mandir)
-       $(MKDIR_P) $(vardir) >/dev/null 2>&1 || true # not fatal, so don't complain
+install install-strip: all man
+       $(MKDIR_P) $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)
+       $(INSTALL) $(strip_option) $(prefixed_executables) $(DESTDIR)$(bindir)
+       $(INSTALL_DATA) $(man_pages) $(DESTDIR)$(mandir)
+       $(MKDIR_P) $(DESTDIR)$(vardir) >/dev/null 2>&1 || true # not fatal, so don't complain
 
-$(tarball):
+$(tarball) dist tarball:
        $(Q) rm -rf $(tarball) $(tarball_pfx)
        $(Q) git archive --format=tar --prefix=$(tarball_pfx)/ HEAD \
                | tar --delete $(tarball_delete) > $(tarball_pfx).tar
diff --git a/NEWS.md b/NEWS.md
index 6184335efc75d61deec713ca43d559ce9b2f0a24..ae0c14b5d57c72e046e13d7fd0c129adf6fe46fb 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
@@ -17,6 +17,14 @@ NEWS
   by aes_ctr128 three years ago but the RC4 code had been kept for
   backwards compatibility.
 - On Linux, abstract unix domain sockets are used unconditionally.
+- The "install" target no longer strips executables, the new
+  install-strip target can be used to get the old behaviour.
+- The clean targets have been renamed: clean2 is gone, and the new
+  mostlyclean removes only the executables and object files.
+- New target: check (identical to test).
+- The DESTDIR make variable is honored to prepend a path to the
+  installation directory. This feature is orthogonal to the --prefix
+  option to configure.
 
 Downloads:
 [tarball](./releases/paraslash-git.tar.bz2),
index d432adbb64aa08a74e4dab7bd21360ebb2ef4227..708602e7e04c073ff510be8584235fe198ac128e 100755 (executable)
@@ -24,5 +24,5 @@ autoheader
 echo configuring...
 ./configure $@ > /dev/null
 echo compiling...
-make clean2 > /dev/null 2>&1
+make clean > /dev/null 2>&1
 make -j $n > /dev/null
index afed0a7997fe147440d4bad66197ab2c494289e7..eed441d639a115b6d78d5f9b4934eaff2d4fc107 100644 (file)
@@ -63,10 +63,6 @@ AC_PATH_PROG([HELP2MAN], [help2man])
 test -z "$HELP2MAN" && AC_MSG_ERROR(
        [help2man is required to build this package])
 
-AC_PATH_PROG([INSTALL], [install])
-test -z "$INSTALL" && AC_MSG_ERROR(
-       [The install program is required to build this package])
-
 AC_PROG_CC
 AC_PROG_CPP
 
index 15bb6859b1c2e668245bf0663bc57d7593710f83..a71963c9bbda192f047f144e970d92dcfd764a77 100644 (file)
@@ -18,6 +18,7 @@ endif
 
 tests := $(sort $(wildcard $(test_dir)/t[0-9][0-9][0-9][0-9]-*.sh))
 
+check: $(tests)
 test: $(tests)
 
 $(tests): all
@@ -30,4 +31,4 @@ test-clean:
        $(RM) -r $(results_dir)
        $(RM) -r $(trash_dir)
 
-.PHONY: $(tests) test-help
+.PHONY: $(tests) test-help test-clean test check