1 # Global rules for building dll unit tests -*-Makefile-*-
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)
9 # plus all variables required by the global Make.rules.in
14 DEFS = $(DLLDEFS) $(EXTRADEFS)
16 MODULE = $(TESTDLL:%.dll=%)_test.exe
18 TESTRESULTS = $(CTESTS:.c=.ok)
19 TESTPROGRAM = $(MODULE)$(DLLEXT)
20 RUNTESTFLAGS = -q -P wine -M $(TESTDLL) -T $(TOPOBJDIR) -p $(TESTPROGRAM)
23 EXTRA_SRCS = $(TESTLIST)
24 EXTRA_OBJS = $(TESTLIST:.c=.o)
25 ALL_LIBS = $(IMPORTS:%=-l%) $(EXTRALIBS) $(LDFLAGS) $(LIBS)
26 DLL_LDPATH = -L$(DLLDIR) $(IMPORTS:%=-L$(DLLDIR)/%)
28 CROSSTEST = $(TESTDLL:%.dll=%)_crosstest.exe
29 CROSSOBJS = $(C_SRCS:.c=.cross.o) $(RC_SRCS:.rc=.res.cross.o) $(TESTLIST:.c=.cross.o)
31 CROSSWINDRES = @CROSSWINDRES@
37 # Rules for .so main module
39 $(MODULE).so: $(OBJS) $(RC_SRCS:.rc=.res) Makefile.in
40 $(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -mconsole $(OBJS) $(RC_SRCS:.rc=.res) -o $@ $(LIBPORT) $(DLL_LDPATH) -L$(LIBDIR) $(ALL_LIBS)
42 # Rules for .exe main module
44 $(MODULE): $(OBJS) $(RCOBJS) Makefile.in
45 $(CC) $(OBJS) $(RCOBJS) -o $@ $(ALL_LIBS)
47 # Rules for building test list
49 $(TESTLIST): Makefile.in $(MAKECTESTS)
50 $(MAKECTESTS) -o $@ $(CTESTS)
56 check test:: $(TESTRESULTS) $(SUBDIRS:%=%/__test__)
58 $(TESTRESULTS): $(MODULE)$(DLLEXT) $(DLLDIR)/$(TESTDLL)$(DLLEXT)
60 # Rules for cross-compiling tests
62 .SUFFIXES: .cross.o .res.cross.o
65 $(CROSSCC) -c $(ALLCFLAGS) -o $@ $<
68 $(CROSSWINDRES) -i $< -o $@
70 crosstest:: @CROSSTEST@
72 $(CROSSTEST): $(CROSSOBJS) Makefile.in
73 $(CROSSCC) $(CROSSOBJS) -o $@ $(ALL_LIBS)
81 $(RM) $(MODULE) $(TESTLIST) $(TESTRESULTS) $(CROSSTEST)