Commit c6262a14 authored by Alexandre Julliard's avatar Alexandre Julliard

makefiles: Generate the common rules for tests from configure.

parent 237ed76e
......@@ -8,7 +8,6 @@
*.so
*/*/tests/testlist.c
/Make.rules
/Maketest.rules
/TAGS
/autom4te.cache
/config.cache
......
......@@ -18,16 +18,12 @@ DEFS = -D__WINESRC__ $(EXTRADEFS)
ALLCFLAGS = $(INCLUDES) $(DEFS) $(DLLFLAGS) $(EXTRACFLAGS) $(CPPFLAGS) $(CFLAGS) $(MODCFLAGS)
IDLFLAGS = $(INCLUDES) $(DEFS) $(EXTRAIDLFLAGS)
RCFLAGS = --nostdinc $(PORCFLAGS) $(TARGETFLAGS) $(INCLUDES) $(DEFS) $(EXTRARCFLAGS)
RUNTESTFLAGS = -q -P wine -T $(top_builddir) $(TESTDLL:%=-M %) $(TESTMODULE:%=-p %@DLLEXT@)
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)
IDL_GEN_HEADERS = $(IDL_H_SRCS:.idl=.h) $(IDL_C_SRCS:.idl=.h) $(IDL_I_SRCS:.idl=.h) \
$(IDL_P_SRCS:.idl=.h) $(IDL_S_SRCS:.idl=.h)
TESTMODULE_STRIPPED = $(TESTMODULE:%.exe=%-stripped.exe@DLLEXT@)
CROSSTESTMODULE = $(TESTMODULE:%_test.exe=%_crosstest.exe)
CLEAN_FILES = *.o *.a *.so *.mo *.res *.fake *.ok *.tab.[ch] *.yy.c
CLEAN_TARGETS = $(MODULE) $(IMPORTLIB:%=lib%.@IMPLIBEXT@) $(IDL_GEN_C_SRCS) $(IDL_GEN_HEADERS) \
$(IDL_TLB_SRCS:.idl=.tlb) $(IDL_P_SRCS:.idl=_p.c dlldata.c) \
......@@ -177,8 +173,6 @@ testlist.c: Makefile.in $(MAKECTESTS)
testlist.o testlist.cross.o: testlist.c $(top_srcdir)/include/wine/test.h
$(C_SRCS:.c=.ok): $(TESTMODULE:%=%@DLLEXT@) $(TESTDLL:%=../%@DLLEXT@)
testclean::
$(RM) *.ok
......
......@@ -29,10 +29,7 @@ LIBS = @LIBS@
BISON = @BISON@
FLEX = @FLEX@
EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@
DLLEXT = @DLLEXT@
DLLPREFIX = @DLLPREFIX@
FAKEEXT = $(DLLEXT:.so=.fake)
TOOLSEXT = @TOOLSEXT@
IMPLIBEXT = @IMPLIBEXT@
DLLTOOL = @DLLTOOL@
......
# Global rules for building dll unit tests -*-Makefile-*-
#
# Each individual makefile should define the following variables:
# TESTDLL : the dll to test
# C_SRCS : list of C test programs
# EXTRADEFS : extra symbol definitions, like -DWINELIB (optional)
#
# plus all variables required by the global Make.rules.in
#
DLLFLAGS = @DLLFLAGS@
TESTMODULE = $(TESTDLL:%.dll=%)_test.exe
WINETEST_RES = $(top_builddir)/programs/winetest/$(TESTDLL:%.dll=%)_test.res
EXTRA_OBJS = testlist.o
MAKEDEPFLAGS = -xo -xcross.o
all: $(TESTMODULE)$(DLLEXT) $(WINETEST_RES)
check test: $(C_SRCS:.c=.ok)
crosstest: @CROSSTEST_DISABLE@ $(TESTDLL:%.dll=%)_crosstest.exe
.PHONY: check test crosstest
@MAKE_RULES@
......@@ -453,7 +453,7 @@ $ac_dir/uninstall::
\$(RM) \$(DESTDIR)\$(dlldir)/lib$ac_implib.$STATIC_IMPLIBEXT"
fi
if test "x$CROSSTEST_DISABLE" = x
if test -n "$CROSSTARGET"
then
wine_fn_append_rule \
"__builddeps__: $ac_file.cross.a
......@@ -476,7 +476,7 @@ $ac_dir/uninstall::
\$(RM) \$(DESTDIR)\$(dlldir)/lib$ac_implib.$IMPLIBEXT
install install-dev:: $ac_dir/install-dev
__uninstall__: $ac_dir/uninstall"
if test "x$CROSSTEST_DISABLE" = x
if test -n "$CROSSTARGET"
then
wine_fn_append_rule \
"__builddeps__: $ac_file.cross.a
......@@ -492,7 +492,7 @@ dlls/lib$ac_implib.$IMPLIBEXT: $ac_file.$IMPLIBEXT
\$(RM) \$[@] && \$(LN_S) $ac_name/lib$ac_implib.$IMPLIBEXT \$[@]
clean::
\$(RM) dlls/lib$ac_implib.$IMPLIBEXT"
if test "x$CROSSTEST_DISABLE" = x
if test -n "$CROSSTARGET"
then
wine_fn_append_rule \
"__builddeps__: dlls/lib$ac_implib.cross.a
......@@ -577,14 +577,14 @@ wine_fn_config_test ()
ac_flags=$[3]
ac_clean=
test "x$CROSSTEST_DISABLE" = x && ac_clean=`expr $ac_dir/${ac_name} : "\\(.*\\)_test"`_crosstest.exe
test -n "$CROSSTARGET" && ac_clean=`expr $ac_dir/${ac_name} : "\\(.*\\)_test"`_crosstest.exe
test -n "$DLLEXT" || ac_clean=$ac_dir/${ac_name}.exe
ac_clean="$ac_clean $ac_dir/testlist.c"
AS_VAR_IF([enable_tests],[no],[wine_fn_disabled_rules $ac_clean; return])
wine_fn_append_file ALL_TEST_RESOURCES $ac_name.res
wine_fn_all_rules Maketest.rules
wine_fn_all_rules Make.rules.in
wine_fn_clean_rules $ac_clean
wine_fn_append_rule \
......@@ -597,7 +597,7 @@ $ac_dir/test: dummy
testclean::
\$(RM) $ac_dir/*.ok"
if test "x$CROSSTEST_DISABLE" = x
if test -n "$CROSSTARGET"
then
wine_fn_append_rule \
"crosstest: $ac_dir/crosstest
......@@ -653,7 +653,7 @@ distclean::
wine_fn_append_rule "$ac_linkdir/Makefile $ac_linkdir/depend: $ac_links"
}
if test "x$CROSSTEST_DISABLE" != x
if test -z "$CROSSTARGET"
then
wine_fn_append_rule \
"crosstest:
......
......@@ -627,6 +627,7 @@ LIBOBJS
PORCFLAGS
LINGUAS
ALL_TEST_RESOURCES
MAKE_TEST_RULES
MAKE_PROG_RULES
MAKE_DLL_RULES
MAKE_IMPLIB_RULES
......@@ -686,9 +687,8 @@ X_PRE_LIBS
X_CFLAGS
XMKMF
LIBPTHREAD
CROSSTARGET
CROSSCC
CROSSTEST_DISABLE
CROSSTARGET
PRELINK
CARBONLIB
QUICKTIMELIB
......@@ -714,7 +714,6 @@ LDRPATH_INSTALL
IMPLIBEXT
DLLFLAGS
DLLPREFIX
DLLEXT
dlldir
CPP
OPENGL_LIBS
......@@ -801,8 +800,7 @@ PACKAGE_TARNAME
PACKAGE_NAME
PATH_SEPARATOR
SHELL'
ac_subst_files='MAKE_RULES
MAKE_TEST_RULES'
ac_subst_files='MAKE_RULES'
ac_user_opts='
enable_option_checking
enable_win16
......@@ -6978,8 +6976,6 @@ done
dlldir="\${libdir}/wine"
DLLEXT=""
DLLPREFIX=""
DLLFLAGS="-D_REENTRANT"
......@@ -6991,6 +6987,7 @@ LDRPATH_INSTALL=""
LDRPATH_LOCAL=""
LIBEXT="so"
DLLEXT=".so"
STATIC_IMPLIBEXT="def.a"
# Extract the first word of "ldd", so it can be a program name with args.
set dummy ldd; ac_word=$2
......@@ -7236,6 +7233,7 @@ else
fi
LIBEXT="dll"
DLLEXT=""
IMPLIBEXT="a"
STATIC_IMPLIBEXT="a"
enable_iphlpapi=${enable_iphlpapi:-no}
......@@ -7281,7 +7279,6 @@ clean::
;;
darwin*|macosx*)
DLLEXT=".so"
LIBEXT="dylib"
DLLFLAGS="$DLLFLAGS -fPIC"
LIBWINE_LDFLAGS="-multiply_defined suppress"
......@@ -7493,7 +7490,6 @@ wine_info.plist: wine_info.plist.in \$(top_builddir)/include/config.h
linux-android*)
DLLFLAGS="$DLLFLAGS -fPIC"
DLLEXT=".so"
DLLPREFIX="lib"
LDEXECFLAGS=""
dlldir="\${libdir}"
......@@ -7664,7 +7660,6 @@ wine-installed: main.o Makefile.in
*)
DLLFLAGS="$DLLFLAGS -fPIC"
DLLEXT=".so"
LDEXECFLAGS=""
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can build a GNU style ELF dll" >&5
$as_echo_n "checking whether we can build a GNU style ELF dll... " >&6; }
......@@ -8028,7 +8023,7 @@ esac
enable_wineqtdecoder=${enable_wineqtdecoder:-no}
enable_winemac_drv=${enable_winemac_drv:-no}
CROSSTEST_DISABLE=\#
CROSSTARGET=""
if test "$cross_compiling" = "no" -a "x$enable_tests" != xno -a "$LIBEXT" != "dll"
then
......@@ -8106,20 +8101,13 @@ if ac_fn_c_try_compile "$LINENO"; then :
$as_echo "yes" >&6; }
set x $CROSSCC
shift
target=""
while test $# -ge 1
do
case "$1" in
*-gcc) target=`expr "$1" : '\(.*\)-gcc'` ;;
*-gcc) CROSSTARGET=`expr "$1" : '\(.*\)-gcc'` ;;
esac
shift
done
if test -n "$target"
then
CROSSTEST_DISABLE=""
CROSSTARGET="$target"
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
......@@ -16057,7 +16045,7 @@ $as_echo_n "creating Makefile rules..." >&6
MAKE_IMPLIB_RULES="DLLFLAGS = $DLLFLAGS
"
if test "x$CROSSTEST_DISABLE" = x
if test -n "$CROSSTARGET"
then
as_fn_append MAKE_IMPLIB_RULES "MAKEDEPFLAGS = -xo -xcross.o
all: \$(STATICLIB:.a=.cross.a)
......@@ -16090,6 +16078,34 @@ all: $deps
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
EXTRA_OBJS = testlist.o
all: \$(TESTMODULE)$DLLEXT \$(WINETEST_RES)
\$(C_SRCS:.c=.ok): \$(TESTMODULE)$DLLEXT \$(TESTDLL:%=../%$DLLEXT)
check test: \$(C_SRCS:.c=.ok)
.PHONY: check test crosstest
"
if test -n "$CROSSTARGET"
then
as_fn_append MAKE_TEST_RULES "
MAKEDEPFLAGS = -xo -xcross.o
CROSSTESTMODULE = \$(TESTDLL:%.dll=%)_crosstest.exe
crosstest: \$(CROSSTESTMODULE)
"
fi
wine_rules_file=conf$$rules.make
rm -f $wine_rules_file
ALL_POT_FILES=""
......@@ -16352,7 +16368,7 @@ $ac_dir/uninstall::
\$(RM) \$(DESTDIR)\$(dlldir)/lib$ac_implib.$STATIC_IMPLIBEXT"
fi
if test "x$CROSSTEST_DISABLE" = x
if test -n "$CROSSTARGET"
then
wine_fn_append_rule \
"__builddeps__: $ac_file.cross.a
......@@ -16375,7 +16391,7 @@ $ac_dir/uninstall::
\$(RM) \$(DESTDIR)\$(dlldir)/lib$ac_implib.$IMPLIBEXT
install install-dev:: $ac_dir/install-dev
__uninstall__: $ac_dir/uninstall"
if test "x$CROSSTEST_DISABLE" = x
if test -n "$CROSSTARGET"
then
wine_fn_append_rule \
"__builddeps__: $ac_file.cross.a
......@@ -16391,7 +16407,7 @@ dlls/lib$ac_implib.$IMPLIBEXT: $ac_file.$IMPLIBEXT
\$(RM) \$@ && \$(LN_S) $ac_name/lib$ac_implib.$IMPLIBEXT \$@
clean::
\$(RM) dlls/lib$ac_implib.$IMPLIBEXT"
if test "x$CROSSTEST_DISABLE" = x
if test -n "$CROSSTARGET"
then
wine_fn_append_rule \
"__builddeps__: dlls/lib$ac_implib.cross.a
......@@ -16478,7 +16494,7 @@ wine_fn_config_test ()
ac_flags=$3
ac_clean=
test "x$CROSSTEST_DISABLE" = x && ac_clean=`expr $ac_dir/${ac_name} : "\\(.*\\)_test"`_crosstest.exe
test -n "$CROSSTARGET" && ac_clean=`expr $ac_dir/${ac_name} : "\\(.*\\)_test"`_crosstest.exe
test -n "$DLLEXT" || ac_clean=$ac_dir/${ac_name}.exe
ac_clean="$ac_clean $ac_dir/testlist.c"
......@@ -16487,7 +16503,7 @@ wine_fn_config_test ()
fi
wine_fn_append_file ALL_TEST_RESOURCES $ac_name.res
wine_fn_all_rules Maketest.rules
wine_fn_all_rules Make.rules.in
wine_fn_clean_rules $ac_clean
wine_fn_append_rule \
......@@ -16500,7 +16516,7 @@ $ac_dir/test: dummy
testclean::
\$(RM) $ac_dir/*.ok"
if test "x$CROSSTEST_DISABLE" = x
if test -n "$CROSSTARGET"
then
wine_fn_append_rule \
"crosstest: $ac_dir/crosstest
......@@ -16558,7 +16574,7 @@ distclean::
wine_fn_append_rule "$ac_linkdir/Makefile $ac_linkdir/depend: $ac_links"
}
if test "x$CROSSTEST_DISABLE" != x
if test -z "$CROSSTARGET"
then
wine_fn_append_rule \
"crosstest:
......@@ -16626,10 +16642,6 @@ wine_fn_config_makerules Make.rules
MAKE_RULES=Make.rules
ac_config_files="$ac_config_files Make.rules"
wine_fn_config_makerules Maketest.rules Make.rules
MAKE_TEST_RULES=Maketest.rules
ac_config_files="$ac_config_files Maketest.rules"
wine_fn_config_dll acledit enable_acledit
wine_fn_config_dll aclui enable_aclui implib
......@@ -18196,7 +18208,6 @@ do
"dlls/wineps.drv/data") CONFIG_COMMANDS="$CONFIG_COMMANDS dlls/wineps.drv/data" ;;
"include/wine") CONFIG_COMMANDS="$CONFIG_COMMANDS include/wine" ;;
"Make.rules") CONFIG_FILES="$CONFIG_FILES Make.rules" ;;
"Maketest.rules") CONFIG_FILES="$CONFIG_FILES Maketest.rules" ;;
"Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile" ;;
"Make.tmp") CONFIG_FILES="$CONFIG_FILES Make.tmp:Make.vars.in:Makefile.in" ;;
......
......@@ -667,13 +667,13 @@ AC_CHECK_HEADERS([libprocstat.h],,,
dnl **** Check for working dll ****
AC_SUBST(dlldir,"\${libdir}/wine")
AC_SUBST(DLLEXT,"")
AC_SUBST(DLLPREFIX,"")
AC_SUBST(DLLFLAGS,"-D_REENTRANT")
AC_SUBST(IMPLIBEXT,"def")
AC_SUBST(LDRPATH_INSTALL,"")
AC_SUBST(LDRPATH_LOCAL,"")
LIBEXT="so"
DLLEXT=".so"
STATIC_IMPLIBEXT="def.a"
WINE_PATH_SONAME_TOOLS
......@@ -694,6 +694,7 @@ case $host_os in
cygwin*|mingw32*)
AC_CHECK_TOOL(DLLTOOL,dlltool,false)
LIBEXT="dll"
DLLEXT=""
IMPLIBEXT="a"
STATIC_IMPLIBEXT="a"
dnl Disable modules that can't be used on Windows
......@@ -740,7 +741,6 @@ clean::
;;
darwin*|macosx*)
DLLEXT=".so"
LIBEXT="dylib"
DLLFLAGS="$DLLFLAGS -fPIC"
LIBWINE_LDFLAGS="-multiply_defined suppress"
......@@ -884,7 +884,6 @@ wine_info.plist: wine_info.plist.in \$(top_builddir)/include/config.h
linux-android*)
DLLFLAGS="$DLLFLAGS -fPIC"
DLLEXT=".so"
DLLPREFIX="lib"
LDEXECFLAGS=""
dlldir="\${libdir}"
......@@ -934,7 +933,6 @@ wine-installed: main.o Makefile.in
*)
DLLFLAGS="$DLLFLAGS -fPIC"
DLLEXT=".so"
LDEXECFLAGS=""
AC_CACHE_CHECK([whether we can build a GNU style ELF dll], ac_cv_c_dll_gnuelf,
[WINE_TRY_SHLIB_FLAGS([-fPIC -shared -Wl,-Bsymbolic],
......@@ -1030,7 +1028,7 @@ enable_wineqtdecoder=${enable_wineqtdecoder:-no}
enable_winemac_drv=${enable_winemac_drv:-no}
dnl Check for cross compiler to build test programs
AC_SUBST([CROSSTEST_DISABLE],[\#])
AC_SUBST(CROSSTARGET,"")
if test "$cross_compiling" = "no" -a "x$enable_tests" != xno -a "$LIBEXT" != "dll"
then
WINE_CHECK_MINGW_PROG(CROSSCC,gcc,false)
......@@ -1043,19 +1041,13 @@ then
[AC_MSG_RESULT([yes])
set x $CROSSCC
shift
target=""
while test $# -ge 1
do
case "$1" in
*-gcc) target=`expr "$1" : '\(.*\)-gcc'` ;;
*-gcc) CROSSTARGET=`expr "$1" : '\(.*\)-gcc'` ;;
esac
shift
done
if test -n "$target"
then
CROSSTEST_DISABLE=""
AC_SUBST(CROSSTARGET,"$target")
fi],
done],
[AC_MSG_RESULT([no])])
CC="$ac_save_CC"
fi
......@@ -2601,7 +2593,7 @@ dnl Import library rules
AC_SUBST(MAKE_IMPLIB_RULES,"DLLFLAGS = $DLLFLAGS
")
if test "x$CROSSTEST_DISABLE" = x
if test -n "$CROSSTARGET"
then
AS_VAR_APPEND([MAKE_IMPLIB_RULES],"MAKEDEPFLAGS = -xo -xcross.o
all: \$(STATICLIB:.a=.cross.a)
......@@ -2632,6 +2624,34 @@ DLLFLAGS = $DLLFLAGS
all: $deps
")
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
EXTRA_OBJS = testlist.o
all: \$(TESTMODULE)$DLLEXT \$(WINETEST_RES)
\$(C_SRCS:.c=.ok): \$(TESTMODULE)$DLLEXT \$(TESTDLL:%=../%$DLLEXT)
check test: \$(C_SRCS:.c=.ok)
.PHONY: check test crosstest
")
if test -n "$CROSSTARGET"
then
AS_VAR_APPEND([MAKE_TEST_RULES],"
MAKEDEPFLAGS = -xo -xcross.o
CROSSTESTMODULE = \$(TESTDLL:%.dll=%)_crosstest.exe
crosstest: \$(CROSSTESTMODULE)
")
fi
dnl Main makefile
WINE_APPEND_RULE([
......@@ -2659,7 +2679,6 @@ WINE_CONFIG_EXTRA_DIR(dlls/wineps.drv/data)
WINE_CONFIG_EXTRA_DIR(include/wine)
WINE_CONFIG_MAKERULES([Make.rules],[MAKE_RULES])
WINE_CONFIG_MAKERULES([Maketest.rules],[MAKE_TEST_RULES],[Make.rules])
WINE_CONFIG_DLL(acledit)
WINE_CONFIG_DLL(aclui,,[implib])
......
......@@ -25,7 +25,6 @@ use strict;
my %makerules =
(
"MAKE_RULES" => "Make.rules",
"MAKE_TEST_RULES" => "Maketest.rules",
);
# Programs that we want to install in the bin directory too
......@@ -486,7 +485,7 @@ sub update_makefiles(@)
$args .= "enable_win16" if $is_win16;
push @lines, "WINE_CONFIG_PROGRAM($name$args$flag_args)\n";
}
elsif ($rules eq $makerules{"MAKE_TEST_RULES"})
elsif ($rules eq "MAKE_TEST_RULES")
{
(my $dir = $file) =~ s/^(.*)\/Makefile/$1/;
push @lines, "WINE_CONFIG_TEST($dir$flag_args)\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment