30e4b6
commit 2ac579f9c25388a7734948d77b03e4dd10f35334
30e4b6
Author: DJ Delorie <dj@redhat.com>
30e4b6
Date:   Mon Sep 30 16:04:52 2019 -0400
30e4b6
30e4b6
    Add run-one-test convenience target and makefile help text
30e4b6
    
30e4b6
    Adds "make test" for re-running just one test.  Also adds
30e4b6
    "make help" for help with our Makefile targets, and adds a
30e4b6
    mini-help when you just run "make".
30e4b6
    
30e4b6
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>
30e4b6
30e4b6
diff --git a/Makefile b/Makefile
30e4b6
index 6d73241bbc811c13..6518f62ee0676b0d 100644
30e4b6
--- a/Makefile
30e4b6
+++ b/Makefile
30e4b6
@@ -26,8 +26,17 @@ include Makeconfig
30e4b6
 
30e4b6
 
30e4b6
 # This is the default target; it makes everything except the tests.
30e4b6
-.PHONY: all
30e4b6
-all: lib others
30e4b6
+.PHONY: all help minihelp
30e4b6
+all: minihelp lib others
30e4b6
+
30e4b6
+help:
30e4b6
+	@sed '0,/^help-starts-here$$/d' Makefile.help
30e4b6
+
30e4b6
+minihelp:
30e4b6
+	@echo
30e4b6
+	@echo type \"make help\" for help with common glibc makefile targets
30e4b6
+	@echo
30e4b6
+
30e4b6
 
30e4b6
 ifneq ($(AUTOCONF),no)
30e4b6
 
30e4b6
@@ -503,3 +512,12 @@ FORCE:
30e4b6
 
30e4b6
 iconvdata/% localedata/% po/%: FORCE
30e4b6
 	$(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
30e4b6
+
30e4b6
+# Convenience target to rerun one test, from the top of the build tree
30e4b6
+# Example: make test t=wcsmbs/test-wcsnlen
30e4b6
+.PHONY: test
30e4b6
+test :
30e4b6
+	@-rm -f $(objpfx)$t.out
30e4b6
+	$(MAKE) subdir=$(dir $t) -C $(dir $t) ..=../ $(objpfx)$t.out
30e4b6
+	@cat $(objpfx)$t.test-result
30e4b6
+	@cat $(objpfx)$t.out
30e4b6
diff --git a/Makefile.help b/Makefile.help
30e4b6
new file mode 100644
30e4b6
index 0000000000000000..3b043bce013cc2b4
30e4b6
--- /dev/null
30e4b6
+++ b/Makefile.help
30e4b6
@@ -0,0 +1,42 @@
30e4b6
+# Copyright (C) 2019 Free Software Foundation, Inc.
30e4b6
+# This file is part of the GNU C Library.
30e4b6
+
30e4b6
+# The GNU C Library is free software; you can redistribute it and/or
30e4b6
+# modify it under the terms of the GNU Lesser General Public
30e4b6
+# License as published by the Free Software Foundation; either
30e4b6
+# version 2.1 of the License, or (at your option) any later version.
30e4b6
+
30e4b6
+# The GNU C Library is distributed in the hope that it will be useful,
30e4b6
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
30e4b6
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
30e4b6
+# Lesser General Public License for more details.
30e4b6
+
30e4b6
+# You should have received a copy of the GNU Lesser General Public
30e4b6
+# License along with the GNU C Library; if not, see
30e4b6
+# <https://www.gnu.org/licenses/>.
30e4b6
+
30e4b6
+This is the file that gets printed when the user runs "make help",
30e4b6
+starting just after the "help-starts-here" line.
30e4b6
+
30e4b6
+help-starts-here
30e4b6
+
30e4b6
+all
30e4b6
+	The usual default; builds everything but doesn't run the
30e4b6
+	tests.
30e4b6
+
30e4b6
+check (or tests)
30e4b6
+	Runs the standard set of tests.
30e4b6
+
30e4b6
+test
30e4b6
+	Runs one test.  Use like this:
30e4b6
+		make test t=wcsmbs/test-wcsnlen
30e4b6
+	Note that this will rebuild the test if needed, but will not
30e4b6
+	rebuild what "make all" would have rebuilt.
30e4b6
+
30e4b6
+--
30e4b6
+Other useful hints:
30e4b6
+
30e4b6
+builddir$ rm testroot.pristine/install.stamp
30e4b6
+	Forces the testroot to be reinstalled the next time you run
30e4b6
+	the testsuite (or just rm -rf testroot.pristine)
30e4b6
+