blob: 4833f5a1f975b2119b5c25d7f93746023e0dba5d [file] [log] [blame]
Alexandre Julliardedeee892002-08-09 01:22:40 +00001# Global rules for building dll unit tests -*-Makefile-*-
2#
3# Each individual makefile should define the following variables:
Thomas Kho1afed1f2006-07-28 13:53:52 -05004# TESTDLL : the dll to test
Alexandre Julliard6164ce22010-02-20 19:56:55 +01005# C_SRCS : list of C test programs
Alexandre Julliardedeee892002-08-09 01:22:40 +00006# EXTRALIBS : extra libraries to link in (optional)
7# EXTRADEFS : extra symbol definitions, like -DWINELIB (optional)
8#
9# plus all variables required by the global Make.rules.in
10#
11
Alexandre Julliard16cd8612003-09-24 19:01:44 +000012DLLFLAGS = @DLLFLAGS@
Jacek Caban45be0192010-12-23 16:05:29 +010013DEFS = -DWINE_STRICT_PROTOTYPES -DWINE_NO_NAMELESS_EXTENSION $(EXTRADEFS)
Alexandre Julliardedeee892002-08-09 01:22:40 +000014
15MODULE = $(TESTDLL:%.dll=%)_test.exe
Alexandre Julliard6164ce22010-02-20 19:56:55 +010016TESTRESULTS = $(C_SRCS:.c=.ok)
Alexandre Julliardedeee892002-08-09 01:22:40 +000017TESTPROGRAM = $(MODULE)$(DLLEXT)
Alexandre Julliard9b99cd12011-05-24 11:11:22 +020018WINETEST_EXE = $(TESTDLL:%.dll=%)_test-stripped.exe$(DLLEXT)
19WINETEST_RES = $(top_builddir)/programs/winetest/$(TESTDLL:%.dll=%)_test.res
Alexandre Julliardbd9852c2010-09-19 12:40:12 +020020RUNTESTFLAGS = -q -P wine -M $(TESTDLL) -T $(top_builddir) -p $(TESTPROGRAM)
Alexandre Julliardedeee892002-08-09 01:22:40 +000021
Alexandre Julliard4d6b27e2004-03-03 22:39:22 +000022ALL_LIBS = $(IMPORTS:%=-l%) $(EXTRALIBS) $(LDFLAGS) $(LIBS)
Alexandre Julliard9953dd62006-09-11 15:43:38 +020023EXTRA_OBJS = testlist.o
Alexandre Julliardedeee892002-08-09 01:22:40 +000024
Alexandre Julliardc3c587e2002-09-06 19:46:00 +000025CROSSTEST = $(TESTDLL:%.dll=%)_crosstest.exe
Francois Gouget7bb43a32009-06-30 10:25:19 +020026MAKEDEPFLAGS = -xo -xcross.o
Alexandre Julliardc3c587e2002-09-06 19:46:00 +000027
Alexandre Julliardedeee892002-08-09 01:22:40 +000028@MAKE_RULES@
29
Alexandre Julliard9b99cd12011-05-24 11:11:22 +020030all: $(TESTPROGRAM) $(WINETEST_RES)
Alexandre Julliardbcf2a782002-12-06 19:51:20 +000031
Alexandre Julliard68a1f4d2009-06-02 15:50:57 +020032$(MODULE) $(MODULE).so: $(OBJS) Makefile.in
33 $(WINEGCC) $(APPMODE) $(OBJS) -o $@ $(LIBPORT) $(ALL_LIBS)
Alexandre Julliardedeee892002-08-09 01:22:40 +000034
Alexandre Julliard9b99cd12011-05-24 11:11:22 +020035$(WINETEST_EXE): $(OBJS) Makefile.in
Alexandre Julliardee5a3212011-05-25 10:24:57 +020036 $(WINEGCC) -s -Wb,-F,$(MODULE) $(APPMODE) $(OBJS) -o $@ $(LIBPORT) $(ALL_LIBS)
Alexandre Julliard9b99cd12011-05-24 11:11:22 +020037
38$(WINETEST_RES): $(WINETEST_EXE)
39 echo "$(MODULE) TESTRES \"$(WINETEST_EXE)\"" | $(LDPATH) $(WRC) $(RCFLAGS) -o $@
40
Alexandre Julliard93f03392010-02-10 20:27:52 +010041.PHONY: check test testclean crosstest
42
Alexandre Julliardedeee892002-08-09 01:22:40 +000043# Rules for building test list
44
Alexandre Julliard9953dd62006-09-11 15:43:38 +020045testlist.c: Makefile.in $(MAKECTESTS)
Alexandre Julliard6164ce22010-02-20 19:56:55 +010046 $(MAKECTESTS) -o $@ $(C_SRCS)
Alexandre Julliardedeee892002-08-09 01:22:40 +000047
Octavian Voicu24a1fc32011-11-05 07:55:06 +020048testlist.o testlist.cross.o: testlist.c $(top_srcdir)/include/wine/test.h
Francois Gougetbc8b8a22002-12-11 01:29:36 +000049
Alexandre Julliardedeee892002-08-09 01:22:40 +000050# Rules for testing
51
Alexandre Julliardeab7efd2010-03-25 21:42:54 +010052check test: $(TESTRESULTS)
Alexandre Julliardedeee892002-08-09 01:22:40 +000053
Alexandre Julliard02fa42d2006-03-21 12:01:31 +010054$(TESTRESULTS): $(MODULE)$(DLLEXT) ../$(TESTDLL)$(DLLEXT)
Alexandre Julliardedeee892002-08-09 01:22:40 +000055
Alexandre Julliardc3c587e2002-09-06 19:46:00 +000056# Rules for cross-compiling tests
57
Alexandre Julliard7d2e7722010-07-26 12:13:47 +020058crosstest: @CROSSTEST_DISABLE@ $(CROSSTEST)
Alexandre Julliardc3c587e2002-09-06 19:46:00 +000059
60$(CROSSTEST): $(CROSSOBJS) Makefile.in
Alexandre Julliarda2d88ab2009-05-30 17:08:06 +020061 $(CROSSWINEGCC) $(CROSSOBJS) -o $@ $(ALL_LIBS)
Alexandre Julliardc3c587e2002-09-06 19:46:00 +000062
Alexandre Julliardedeee892002-08-09 01:22:40 +000063# Rules for cleaning
64
65testclean::
66 $(RM) $(TESTRESULTS)
67
68clean::
Alexandre Julliard9953dd62006-09-11 15:43:38 +020069 $(RM) testlist.c $(MODULE) $(TESTRESULTS) $(CROSSTEST)