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
15 MODULE = $(TESTDLL:%.dll=%)_test.exe
17 TESTRESULTS = $(CTESTS:.c=.ok)
18 TESTPROGRAM = $(MODULE)$(DLLEXT)
19 RUNTESTFLAGS = -q -P wine -M $(TESTDLL) -T $(TOPOBJDIR) -p $(TESTPROGRAM)
22 EXTRA_SRCS = $(TESTLIST)
23 EXTRA_OBJS = $(TESTLIST:.c=.o)
24 ALL_LIBS = $(IMPORTS:%=-l%) $(EXTRALIBS) $(LDFLAGS) $(LIBS)
25 IMPORTLIBS = $(IMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT))
27 CROSSTEST = $(TESTDLL:%.dll=%)_crosstest.exe
28 CROSSOBJS = $(C_SRCS:.c=.cross.o) $(RC_SRCS:.rc=.res.cross.o) $(TESTLIST:.c=.cross.o)
30 CROSSWINDRES = @CROSSWINDRES@
36 # Rules for .so main module
38 $(MODULE).so: $(OBJS) $(RC_SRCS:.rc=.res) $(IMPORTLIBS) Makefile.in
39 WINEBUILD=$(WINEBUILD) $(WINEGCC) -mconsole $(OBJS) $(RC_SRCS:.rc=.res) -o $@ $(LIBPORT) -L$(DLLDIR) -L$(LIBDIR) $(ALL_LIBS)
41 # Rules for .exe main module
43 $(MODULE): $(OBJS) $(RCOBJS) Makefile.in
44 $(CC) $(OBJS) $(RCOBJS) -o $@ $(ALL_LIBS)
46 # Rules for building test list
48 $(TESTLIST): Makefile.in $(TOPSRCDIR)/tools/make_ctests
49 $(TOPSRCDIR)/tools/make_ctests $(CTESTS) >$(TESTLIST) || $(RM) $(TESTLIST)
55 check test:: $(TESTRESULTS) $(SUBDIRS:%=%/__test__)
57 $(TESTRESULTS): $(MODULE)$(DLLEXT) $(DLLDIR)/$(TESTDLL)$(DLLEXT)
59 # Rules for cross-compiling tests
61 .SUFFIXES: .cross.o .res.cross.o
64 $(CROSSCC) -c $(ALLCFLAGS) -o $@ $<
67 $(CROSSWINDRES) -i $< -o $@
69 crosstest:: @CROSSTEST@
71 $(CROSSTEST): $(CROSSOBJS) Makefile.in
72 $(CROSSCC) $(CROSSOBJS) -o $@ $(ALL_LIBS)
80 $(RM) $(MODULE) $(TESTLIST) $(TESTRESULTS) $(CROSSTEST)