Use import libraries when building tests too. Make sure the .a
[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@ -DNONAMELESSUNION -DNONAMELESSSTRUCT $(EXTRADEFS)
13 LDDLLFLAGS   = @LDDLLFLAGS@
14
15 MODULE       = $(TESTDLL:%.dll=%)_test.exe
16 TESTLIST     = testlist.c
17 TESTRESULTS  = $(CTESTS:.c=.ok)
18 TESTPROGRAM  = $(MODULE)$(DLLEXT)
19 RUNTESTFLAGS = -q -P wine -M $(TESTDLL) -T $(TOPOBJDIR) -p $(TESTPROGRAM)
20
21 C_SRCS       = $(CTESTS)
22 EXTRA_SRCS   = $(TESTLIST)
23 EXTRA_OBJS   = $(TESTLIST:.c=.o)
24 ALL_LIBS     = $(LIBWINE) $(EXTRALIBS) $(LIBS)
25 IMPORTLIBS   = $(DELAYIMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT)) $(IMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT))
26
27 CROSSTEST    = $(TESTDLL:%.dll=%)_crosstest.exe
28 CROSSOBJS    = $(C_SRCS:.c=.cross.o) $(TESTLIST:.c=.cross.o)
29
30 @MAKE_RULES@
31
32 all: $(TESTPROGRAM)
33
34 # Rule for main module spec file
35
36 $(MODULE).spec.c: $(RC_SRCS:.rc=.res) $(OBJS) $(IMPORTLIBS) $(WINEBUILD)
37         $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -exe $(MODULE) -mcui $(RC_SRCS:.rc=.res) $(OBJS) -L$(DLLDIR) -L.. $(DELAYIMPORTS:%=-d%) $(IMPORTS:%=-l%)
38
39 # Rules for .so main module
40
41 $(MODULE).so: $(MODULE).spec.o $(OBJS) Makefile.in
42         $(LDSHARED) $(LDDLLFLAGS) $(MODULE).spec.o $(OBJS) -o $@ $(ALL_LIBS) -lc
43
44 # Rules for .exe main module
45
46 $(MODULE): $(OBJS) $(RCOBJS) $(IMPORTLIBS) Makefile.in
47         $(CC) $(OBJS) $(RCOBJS) -o $@ -L$(DLLDIR) $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(ALL_LIBS)
48
49 # Rules for building test list
50
51 $(TESTLIST): Makefile.in
52         $(TOPSRCDIR)/tools/make_ctests $(CTESTS) >$(TESTLIST) || $(RM) $(TESTLIST)
53
54 depend: $(TESTLIST)
55
56 # Rules for testing
57
58 check test:: $(TESTRESULTS) $(SUBDIRS:%=%/__test__)
59
60 $(TESTRESULTS): $(MODULE)$(DLLEXT) $(DLLDIR)/$(TESTDLL)$(DLLEXT)
61
62 # Rules for cross-compiling tests
63
64 crosstest:: @CROSSTEST@
65
66 $(CROSSTEST): $(CROSSOBJS) Makefile.in
67         $(CROSSCC) $(CROSSOBJS) -o $@ -L$(DLLDIR) $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(LIBS)
68
69 # Rules for cleaning
70
71 testclean::
72         $(RM) $(TESTRESULTS)
73
74 clean::
75         $(RM) $(MODULE) $(TESTLIST) $(TESTRESULTS) $(CROSSTEST)