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)
22 C_SRCS = $(CTESTS) $(TESTLIST)
23 ALL_LIBS = $(IMPORTS:%=-l%) $(EXTRALIBS) $(LDFLAGS) $(LIBS)
24 DLL_LDPATH = -L$(DLLDIR) $(IMPORTS:%=-L$(DLLDIR)/%)
26 CROSSTEST = $(TESTDLL:%.dll=%)_crosstest.exe
27 CROSSOBJS = $(C_SRCS:.c=.cross.o) $(RC_SRCS:.rc=.res.cross.o)
29 CROSSWINDRES = @CROSSWINDRES@
35 # Rules for .so main module
37 $(MODULE).so: $(OBJS) $(RC_SRCS:.rc=.res) Makefile.in
38 $(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -mconsole $(OBJS) $(RC_SRCS:.rc=.res) -o $@ $(LIBPORT) $(DLL_LDPATH) -L$(LIBDIR) $(ALL_LIBS)
40 # Rules for .exe main module
42 $(MODULE): $(OBJS) $(RCOBJS) Makefile.in
43 $(CC) $(OBJS) $(RCOBJS) -o $@ $(ALL_LIBS)
45 # Rules for building test list
47 $(TESTLIST): Makefile.in $(MAKECTESTS)
48 $(MAKECTESTS) -o $@ $(CTESTS)
54 check test:: $(TESTRESULTS) $(SUBDIRS:%=%/__test__)
56 $(TESTRESULTS): $(MODULE)$(DLLEXT) $(DLLDIR)/$(TESTDLL)$(DLLEXT)
58 # Rules for cross-compiling tests
60 .SUFFIXES: .cross.o .res.cross.o
63 $(CROSSCC) -c $(ALLCFLAGS) -o $@ $<
66 $(CROSSWINDRES) -i $< -o $@
68 crosstest:: @CROSSTEST@
70 $(CROSSTEST): $(CROSSOBJS) Makefile.in
71 $(CROSSCC) $(CROSSOBJS) -o $@ $(ALL_LIBS)
79 $(RM) $(MODULE) $(TESTLIST) $(TESTRESULTS) $(CROSSTEST)