Alexandre Julliard : makedep: Generate rules for test binaries.
Alexandre Julliard
julliard at winehq.org
Tue Dec 31 11:11:43 CST 2013
Module: wine
Branch: master
Commit: 8bf0f5fe6dc8de6986ed5eef40654d0d0ecdfb17
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8bf0f5fe6dc8de6986ed5eef40654d0d0ecdfb17
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Dec 30 20:19:33 2013 +0100
makedep: Generate rules for test binaries.
---
Make.rules.in | 19 +--------------
configure | 15 +-----------
configure.ac | 15 +-----------
tools/makedep.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++---
4 files changed, 68 insertions(+), 50 deletions(-)
diff --git a/Make.rules.in b/Make.rules.in
index 0a40ff4..52fdf9c 100644
--- a/Make.rules.in
+++ b/Make.rules.in
@@ -19,12 +19,9 @@ RCFLAGS = --nostdinc $(PORCFLAGS) $(TARGETFLAGS) $(DEFS) $(EXTRARCFLAGS)
IDL_GEN_C_SRCS = $(IDL_C_SRCS:.idl=_c.c) $(IDL_I_SRCS:.idl=_i.c) \
$(IDL_P_SRCS:.idl=_p.c) $(IDL_S_SRCS:.idl=_s.c)
-CLEAN_TARGETS = $(TESTMODULE) $(TESTMODULE_STRIPPED) $(CROSSTESTMODULE)
-
OBJS = $(C_SRCS:.c=.o) $(BISON_SRCS:.y=.tab.o) $(LEX_SRCS:.l=.yy.o) $(IDL_GEN_C_SRCS:.c=.o) $(OBJC_SRCS:.m=.o) \
$(IDL_R_SRCS:.idl=_r.res) $(IDL_TLB_RES) $(RC_SRCS:.rc=.res) $(MC_SRCS:.mc=.res) $(EXTRA_OBJS)
-CROSSOBJS = $(OBJS:.o=.cross.o)
ALLCROSSCFLAGS = $(DEFS) -DWINE_CROSSTEST $(CPPFLAGS) $(CFLAGS)
# Rules for dependencies
@@ -34,20 +31,6 @@ depend: dummy
.PHONY: depend
-# Rules for tests
-
-$(TESTMODULE) $(TESTMODULE:%=%.so): $(OBJS)
- $(WINEGCC) $(APPMODE) $(OBJS) -o $@ $(IMPORTS:%=-l%) $(LDFLAGS) $(LIBS)
-
-$(TESTMODULE_STRIPPED): $(OBJS)
- $(WINEGCC) -s -Wb,-F,$(TESTMODULE) $(APPMODE) $(OBJS) -o $@ $(IMPORTS:%=-l%) $(LDFLAGS) $(LIBS)
-
-$(CROSSTESTMODULE): $(CROSSOBJS)
- $(CROSSWINEGCC) $(CROSSOBJS) -o $@ $(IMPORTS:%=-l%) $(LDFLAGS) $(LIBS)
-
-$(WINETEST_RES): $(TESTMODULE_STRIPPED)
- echo "$(TESTMODULE) TESTRES \"$(TESTMODULE_STRIPPED)\"" | $(WRC) $(RCFLAGS) -o $@
-
# Rules for man pages
all: $(MANPAGES:.man.in=.man)
@@ -55,7 +38,7 @@ all: $(MANPAGES:.man.in=.man)
# Rules for cleaning
clean::
- $(RM) $(CLEAN_FILES) $(CLEAN_TARGETS) $(PROGRAMS)
+ $(RM) $(CLEAN_FILES) $(PROGRAMS)
.PHONY: clean
diff --git a/configure b/configure
index 91bb070..5b2f013 100755
--- a/configure
+++ b/configure
@@ -16577,25 +16577,14 @@ DLLFLAGS = $DLLFLAGS
MAKE_TEST_RULES="
DLLFLAGS = $DLLFLAGS
-TESTMODULE = \$(TESTDLL:%.dll=%)_test.exe
-TESTMODULE_STRIPPED = \$(TESTDLL:%.dll=%)_test-stripped.exe$DLLEXT
-WINETEST_RES = \$(top_builddir)/programs/winetest/\$(TESTDLL:%.dll=%)_test.res
-RUNTESTFLAGS = -q -P wine -T \$(top_builddir) -M \$(TESTDLL) -p \$(TESTMODULE)$DLLEXT
+RUNTESTFLAGS = -q -P wine
EXTRA_OBJS = testlist.o
-
-all: \$(TESTMODULE)$DLLEXT \$(WINETEST_RES)
-
-\$(C_SRCS:.c=.ok): \$(TESTMODULE)$DLLEXT \$(TESTDLL:%=../%$DLLEXT)
"
if test -n "$CROSSTARGET"
then
as_fn_append MAKE_TEST_RULES "
MAKEDEPFLAGS = -xo -xcross.o
-CROSSTESTMODULE = \$(TESTDLL:%.dll=%)_crosstest.exe
-
-crosstest: \$(CROSSTESTMODULE)
-.PHONY: crosstest
"
fi
@@ -17409,8 +17398,6 @@ zh_TW"
-wine_fn_ignore_file "*.exe"
-test -n "$DLLEXT" && wine_fn_ignore_file "*$DLLEXT"
wine_fn_ignore_file ".gitignore"
wine_fn_ignore_file "Makefile"
wine_fn_ignore_file "TAGS"
diff --git a/configure.ac b/configure.ac
index 9d1948c..74950e3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2635,24 +2635,13 @@ dnl Test rules
AC_SUBST(MAKE_TEST_RULES,"
DLLFLAGS = $DLLFLAGS
-TESTMODULE = \$(TESTDLL:%.dll=%)_test.exe
-TESTMODULE_STRIPPED = \$(TESTDLL:%.dll=%)_test-stripped.exe$DLLEXT
-WINETEST_RES = \$(top_builddir)/programs/winetest/\$(TESTDLL:%.dll=%)_test.res
-RUNTESTFLAGS = -q -P wine -T \$(top_builddir) -M \$(TESTDLL) -p \$(TESTMODULE)$DLLEXT
+RUNTESTFLAGS = -q -P wine
EXTRA_OBJS = testlist.o
-
-all: \$(TESTMODULE)$DLLEXT \$(WINETEST_RES)
-
-\$(C_SRCS:.c=.ok): \$(TESTMODULE)$DLLEXT \$(TESTDLL:%=../%$DLLEXT)
")
if test -n "$CROSSTARGET"
then
AS_VAR_APPEND([MAKE_TEST_RULES],"
MAKEDEPFLAGS = -xo -xcross.o
-CROSSTESTMODULE = \$(TESTDLL:%.dll=%)_crosstest.exe
-
-crosstest: \$(CROSSTESTMODULE)
-.PHONY: crosstest
")
fi
@@ -3455,8 +3444,6 @@ dnl End of auto-generated output commands
dnl Main ignore file
-WINE_IGNORE_FILE("*.exe")
-test -n "$DLLEXT" && WINE_IGNORE_FILE("*$DLLEXT")
WINE_IGNORE_FILE(".gitignore")
WINE_IGNORE_FILE("Makefile")
WINE_IGNORE_FILE("TAGS")
diff --git a/tools/makedep.c b/tools/makedep.c
index ee24bba..a9b4d6b 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -1367,7 +1367,6 @@ static struct strarray output_sources(void)
struct incl_file *source;
int i;
const char *dllext = ".so";
- int is_test = find_src_file( "testlist.o" ) != NULL;
struct strarray object_files = empty_strarray;
struct strarray crossobj_files = empty_strarray;
struct strarray res_files = empty_strarray;
@@ -1385,6 +1384,7 @@ static struct strarray output_sources(void)
struct strarray delayimports = get_expanded_make_var_array( "DELAYIMPORTS" );
char *module = get_expanded_make_variable( "MODULE" );
char *exeext = get_expanded_make_variable( "EXEEXT" );
+ char *testdll = get_expanded_make_variable( "TESTDLL" );
char *appmode = get_expanded_make_variable( "APPMODE" );
char *staticlib = get_expanded_make_variable( "STATICLIB" );
char *crosstarget = get_expanded_make_variable( "CROSSTARGET" );
@@ -1602,11 +1602,12 @@ static struct strarray output_sources(void)
output_filename( "$(ALLCROSSCFLAGS)" );
output( "\n" );
}
- if (is_test && !strcmp( ext, "c" ) && !(source->flags & FLAG_GENERATED))
+ if (testdll && !strcmp( ext, "c" ) && !(source->flags & FLAG_GENERATED))
{
strarray_add( &test_files, source->name );
output( "%s.ok:\n", obj );
- output( "\t$(RUNTEST) $(RUNTESTFLAGS) %s && touch $@\n", obj );
+ output( "\t$(RUNTEST) $(RUNTESTFLAGS) -T %s -M %s -p %s%s %s && touch $@\n", top_obj_dir,
+ testdll, replace_extension( testdll, ".dll", "_test.exe" ), dllext, obj );
}
for (i = 0; i < object_extensions.count; i++)
output( "%s.%s ", obj, object_extensions.str[i] );
@@ -1773,13 +1774,73 @@ static struct strarray output_sources(void)
}
}
- if (is_test)
+ if (testdll)
{
struct strarray ok_files = strarray_replace_extension( &test_files, ".c", ".ok" );
+ char *testmodule = replace_extension( testdll, ".dll", "_test.exe" );
+ char *stripped = replace_extension( testdll, ".dll", "_test-stripped.exe" );
+ struct strarray all_libs = empty_strarray;
+
+ for (i = 0; i < imports.count; i++) strarray_add( &all_libs, strmake( "-l%s", imports.str[i] ));
+ strarray_addall( &all_libs, get_expanded_make_var_array( "LIBS" ));
+
+ strarray_add( &all_targets, strmake( "%s%s", testmodule, dllext ));
+ strarray_add( &clean_files, strmake( "%s%s", stripped, dllext ));
+ output( "%s%s:\n", testmodule, dllext );
+ output( "\t$(WINEGCC) -o $@" );
+ if (appmode) output_filename( appmode );
+ output_filenames( object_files );
+ output_filenames( res_files );
+ output_filenames( all_libs );
+ output_filename( "$(LDFLAGS)" );
+ output( "\n" );
+ output( "%s%s:\n", stripped, dllext );
+ output( "\t$(WINEGCC) -s -o $@ -Wb,-F,%s", testmodule );
+ if (appmode) output_filename( appmode );
+ output_filenames( object_files );
+ output_filenames( res_files );
+ output_filenames( all_libs );
+ output_filename( "$(LDFLAGS)" );
+ output( "\n" );
+ output( "%s%s %s%s:", testmodule, dllext, stripped, dllext );
+ output_filenames( object_files );
+ output_filenames( res_files );
+ output( "\n" );
+
+ if (top_obj_dir)
+ {
+ char *testres = replace_extension( testdll, ".dll", "_test.res" );
+ output( "all: %s/programs/winetest/%s\n", top_obj_dir, testres );
+ output( "%s/programs/winetest/%s: %s%s\n", top_obj_dir, testres, stripped, dllext );
+ output( "\techo \"%s TESTRES \\\"%s%s\\\"\" | $(WRC) $(RCFLAGS) -o $@\n",
+ testmodule, stripped, dllext );
+ }
+
+ if (crosstarget)
+ {
+ char *crosstest = replace_extension( testdll, ".dll", "_crosstest.exe" );
+
+ strarray_add( &clean_files, crosstest );
+ output( "crosstest: %s\n", crosstest );
+ output( "%s:", crosstest );
+ output_filenames( crossobj_files );
+ output_filenames( res_files );
+ output( "\n" );
+ output( "\t$(CROSSWINEGCC) -o $@" );
+ output_filenames( crossobj_files );
+ output_filenames( res_files );
+ output_filenames( all_libs );
+ output_filename( "$(LDFLAGS)" );
+ output( "\n" );
+ strarray_add( &phony_targets, "crosstest" );
+ }
+
output( "testlist.c: $(MAKECTESTS) %s\n", src_dir ? strmake("%s/Makefile.in", src_dir ) : "Makefile.in" );
output( "\t$(MAKECTESTS) -o $@" );
output_filenames( test_files );
output( "\n" );
+ output_filenames( ok_files );
+ output( ": %s%s ../%s%s\n", testmodule, dllext, testdll, dllext );
output( "check test:" );
output_filenames( ok_files );
output( "\n" );
More information about the wine-cvs
mailing list