Test results need to depend on the module being tested.
[wine] / dlls / Maketest.rules.in
1 # Global rules for building dll unit tests     -*-Makefile-*-
2 #
3 # Each individual makefile should define the following variables:
4 # DLLTEST      : the dll to test
5 # CTESTS       : list of C test programs
6 # 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
12 DEFS         = @DLLFLAGS@ -D__WINE__ $(EXTRADEFS)
13 LDDLLFLAGS   = @LDDLLFLAGS@
14
15 MODULE       = $(TESTDLL:%.dll=%)_test.exe
16 TESTLIST     = testlist.c
17 TESTMAIN     = $(TOPOBJDIR)/programs/winetest/wtmain.o
18 TESTRESULTS  = $(CTESTS:.c=.ok)
19 TESTPROGRAM  = $(MODULE)$(DLLEXT)
20 RUNTESTFLAGS = -q -P wine -M $(TESTDLL) -T $(TOPOBJDIR) -p $(TESTPROGRAM)
21
22 C_SRCS       = $(CTESTS)
23 GEN_C_SRCS   = $(TESTLIST)
24 EXTRA_OBJS   = $(TESTMAIN)
25 ALL_LIBS     = $(LIBWINE) $(EXTRALIBS) $(LIBS)
26
27 @MAKE_RULES@
28
29 # Rule for main module spec file
30
31 $(MODULE).spec.c: $(RC_SRCS:.rc=.res) $(OBJS) $(WINEBUILD)
32         $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -exe $(MODULE) -mcui $(RC_SRCS:%.rc=-res %.res) $(OBJS) -L$(DLLDIR) $(DELAYIMPORTS:%=-dl%) $(IMPORTS:%=-l%)
33
34 # Rules for .so main module
35
36 $(MODULE).so: $(MODULE).spec.o $(OBJS) Makefile.in
37         $(LDSHARED) $(LDDLLFLAGS) $(MODULE).spec.o $(OBJS) -o $@ $(ALL_LIBS)
38
39 # Rules for .exe main module
40
41 $(MODULE): $(OBJS) $(RCOBJS) Makefile.in
42         $(CC) $(OBJS) $(RCOBJS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(ALL_LIBS)
43
44 # Rules for building test list
45
46 $(TESTLIST): Makefile.in
47         $(TOPSRCDIR)/programs/winetest/make_ctests $(CTESTS) >$(TESTLIST) || $(RM) $(TESTLIST)
48
49 # Rules for checking that no imports are missing
50
51 CHECKLINK_RPATH = library tsx11 unicode
52
53 checklink:: $(MODULE).so $(SUBDIRS:%=%/__checklink__)
54         $(CC) -o checklink $(CHECKLINK_RPATH:%=-Wl,-rpath,$(TOPOBJDIR)/%) $(TOPSRCDIR)/library/checklink.c $(MODULE).so && $(RM) checklink
55
56 # Rules for testing
57
58 check test:: $(TESTRESULTS) $(SUBDIRS:%=%/__test__)
59
60 $(TESTRESULTS): $(MODULE)$(DLLEXT) $(TOPOBJDIR)/dlls/$(TESTDLL)$(DLLEXT)
61
62 $(TESTMAIN):
63         cd $(TOPOBJDIR)/programs/winetest && $(MAKE) wtmain.o
64
65 # Rules for cleaning
66
67 testclean::
68         $(RM) $(TESTRESULTS)
69
70 clean::
71         $(RM) $(MODULE) $(TESTLIST) $(TESTRESULTS)