makedep: Generate rules for test binaries.

This commit is contained in:
Alexandre Julliard 2013-12-30 20:19:33 +01:00
parent 908dada662
commit 8bf0f5fe6d
4 changed files with 68 additions and 50 deletions

View File

@ -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

15
configure vendored
View File

@ -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"

View File

@ -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")

View File

@ -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" );