mirror of
https://github.com/gnustep/tools-make.git
synced 2025-04-23 22:33:28 +00:00
simplify template makefile options
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@32301 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
3bd4384ca5
commit
c5ed0d0658
4 changed files with 31 additions and 40 deletions
|
@ -1,3 +1,10 @@
|
|||
2011-01-22 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* gnustep-tests.in:
|
||||
* GNUmakefile.in:
|
||||
* README:
|
||||
Simplify template makefile options.
|
||||
|
||||
2011-01-22 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* TestFramework/example9.m:
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
include $(GNUSTEP_MAKEFILES)/common.make
|
||||
-include ../GNUmakefile.super
|
||||
|
||||
TEST_TOOL_NAME = @TESTNAME@
|
||||
TEST_TOOL_NAME = @TESTNAMES@
|
||||
|
||||
ADDITIONAL_OBJCFLAGS += @FAILFAST@ -I@INCLUDEDIR@ -Wall
|
||||
ADDITIONAL_OBJCFLAGS += @TESTFLAGS@ -Wall
|
||||
|
||||
ifeq ($(gcov),yes)
|
||||
ADDITIONAL_OBJCFLAGS += -ftest-coverage -fprofile-arcs
|
||||
|
@ -14,11 +14,9 @@ ADDITIONAL_LDFLAGS += -ftest-coverage -fprofile-arcs
|
|||
ADDITIONAL_TOOL_LIBS+=-lgcov
|
||||
endif
|
||||
|
||||
@TESTNAME@_OBJC_FILES = @FILENAME@
|
||||
@TESTRULES@
|
||||
|
||||
-include GNUmakefile.preamble
|
||||
include $(GNUSTEP_MAKEFILES)/test-tool.make
|
||||
-include GNUmakefile.postamble
|
||||
|
||||
test:
|
||||
./$(GNUSTEP_OBJ_DIR_NAME)/@TESTNAME@
|
||||
|
|
|
@ -224,37 +224,28 @@ Where tests must make use of external resources or ensure that other tests
|
|||
have already been run before they are run, you can make use of the gnustep
|
||||
make package facilities to control dependencies etc.
|
||||
|
||||
Normally each test is built and run by generating a makefile in the directory
|
||||
containing the test. This makefile uses the standard conventions of including
|
||||
Normally the tests in a directory are built run usng a makefile generated in
|
||||
the directory. This makefile uses the standard conventions of including
|
||||
GNUmakefile.preamble before test-tool.make and including GNUmakefile.postamble
|
||||
after test-tool.make, which gives you a high degree of control over how the
|
||||
tests in the directory are built.
|
||||
|
||||
In addition to the preamble/postamble mechanism, the file ../GNUmakefile.super
|
||||
is included at the start of the generated makefile (if it exists). This allows
|
||||
all the tests in a suite to use a common makefile fragment which can (for
|
||||
instance) build common resources before any tests are run.
|
||||
all the tests in a suite to use a common makefile fragment to provide
|
||||
information for all the testsuite.
|
||||
|
||||
For total control, the framework checks to see if a 'GNUmakefile.template' file
|
||||
exists in the directory, and if it does it uses that file as the template to
|
||||
build the tests rather than using its own make file. This template makefile
|
||||
should use @TESTNAME@ where it wants the name of the test to be built/run,
|
||||
@INCLUDEDIR@ where it wants the name of the include directory for test
|
||||
framework headers, @FILENAME@ where it wants the name of the source file,
|
||||
and @FAILFAST@ where it wants the '-DFAILFAST=1' to be substituted (if
|
||||
gnustep-test was invoked with the --failfast option).
|
||||
The GNUmakefile.template script should build the test named @TESTNAME@ when
|
||||
it is invoked without a target, but it should also implement a 'test' target
|
||||
to run the most recently built test and a 'clean' target to clean up after
|
||||
all tests.
|
||||
|
||||
You may also specify a GNUmakefile.tests in a project level directory (ie one
|
||||
containing subdirectories of tests), and that makefile will be executed when
|
||||
you run tests on the project.
|
||||
|
||||
NB. When you supply custom makefile fragments which build helper programs etc,
|
||||
please remember to add an 'after-clean::' target in the makefile to clean up
|
||||
your custom files when gnustep-tests is run with the --clean option.
|
||||
For total control, the framework checks to see if a 'GNUmakefile.tests' file
|
||||
exists in the directory, and if it does it uses that file as a template to
|
||||
create the GNUmakefile rather than using its own make file.
|
||||
This template makefile may use @TESTNAMES@ where it wants a list of the
|
||||
tests to be run, and @TESTRULES@ where it wants the rules to build the
|
||||
tests to be included.
|
||||
It should also use @GSTESTFLAGS@ where it wants additions flags to tell
|
||||
the compiler about the test framework to be substituted.
|
||||
The GNUmakefile.tests script should build all the tests when it is
|
||||
invoked without a target, and it should also have a 'clean' target to
|
||||
clean up after all tests.
|
||||
|
||||
|
||||
Ignoring directories
|
||||
|
|
|
@ -226,6 +226,7 @@ build_and_run ()
|
|||
|
||||
# Run the test.
|
||||
|
||||
RUN_CMD="./obj/$TESTNAME"
|
||||
if test x"$TEMPLATE" = x
|
||||
then
|
||||
# The very simple case, we just need to compile a single file
|
||||
|
@ -234,20 +235,19 @@ build_and_run ()
|
|||
mkdir ./obj
|
||||
BUILD_CMD="$CC -o ./obj/$TESTNAME $TESTFILE $GSTESTFLAGS $GSTESTLIBS"
|
||||
CLEAN_CMD=echo
|
||||
RUN_CMD="./obj/$TESTNAME"
|
||||
else
|
||||
BUILD_CMD="$MAKE_CMD $MAKEFLAGS debug=yes"
|
||||
CLEAN_CMD="$MAKE_CMD clean"
|
||||
RUN_CMD="$MAKE_CMD -s test"
|
||||
# Create the GNUmakefile by filling in the name of the test,
|
||||
# the name of the file, the include directory, and the failfast
|
||||
# option if needed.
|
||||
rm -f GNUmakefile
|
||||
TESTRULES="${TESTNAME}_OBJC_FILES=$TESTFILE"
|
||||
if test "$GSTESTMODE" = "failfast"
|
||||
then
|
||||
sed -e "s/@TESTNAME@/$TESTNAME/;s/@FILENAME@/$TESTFILE/;s/@FAILFAST@/-DFAILFAST=1/;s^@INCLUDEDIR@^$GSTESTTOP^" < "$TEMPLATE" > GNUmakefile
|
||||
sed -e "s/@TESTNAMES@/$TESTNAME/;s/@TESTRULES@/$TESTRULES/;s^@TESTFLAGS@^-I$GSTESTTOP -DFAILFAST=1^" < "$TEMPLATE" > GNUmakefile
|
||||
else
|
||||
sed -e "s/@TESTNAME@/$TESTNAME/;s/@FILENAME@/$TESTFILE/;s/@FAILFAST@//;s^@INCLUDEDIR@^$GSTESTTOP^" < "$TEMPLATE" > GNUmakefile
|
||||
sed -e "s/@TESTNAMES@/$TESTNAME/;s/@TESTRULES@/$TESTRULES/;s^@TESTFLAGS@^-I$GSTESTTOP^" < "$TEMPLATE" > GNUmakefile
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -416,14 +416,9 @@ do
|
|||
fi
|
||||
fi
|
||||
|
||||
# Check for a custom makefile template, if it exists use it.
|
||||
# Custom.mk is deprecated ... for backward compatibility only.
|
||||
if test -r GNUmakefile.template
|
||||
if test -r GNUmakefile.tests
|
||||
then
|
||||
TEMPLATE=GNUmakefile.template
|
||||
elif test -r Custom.mk
|
||||
then
|
||||
TEMPLATE=Custom.mk
|
||||
TEMPLATE=GNUmakefile.tests
|
||||
elif test -r GNUmakefile.preamble
|
||||
then
|
||||
TEMPLATE=$GSTESTTOP/GNUmakefile.in
|
||||
|
|
Loading…
Reference in a new issue