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)
21 C_SRCS = $(CTESTS) $(TESTLIST)
22 ALL_LIBS = $(IMPORTS:%=-l%) $(EXTRALIBS) $(LDFLAGS) $(LIBS)
24 CROSSTEST = $(TESTDLL:%.dll=%)_crosstest.exe
25 CROSSOBJS = $(C_SRCS:.c=.cross.o) $(RC_SRCS:.rc=.res.cross.o)
27 CROSSWINDRES = @CROSSWINDRES@
33 # Rules for .so main module
35 $(MODULE).so: $(OBJS) $(RC_SRCS:.rc=.res) Makefile.in
36 $(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -mconsole $(OBJS) $(RC_SRCS:.rc=.res) -o $@ $(LIBPORT) -L$(DLLDIR) -L$(LIBDIR) $(ALL_LIBS)
38 # Rules for .exe main module
40 $(MODULE): $(OBJS) $(RCOBJS) Makefile.in
41 $(CC) $(OBJS) $(RCOBJS) -o $@ $(ALL_LIBS)
43 # Rules for building test list
45 $(TESTLIST): Makefile.in $(MAKECTESTS)
46 $(MAKECTESTS) -o $@ $(CTESTS)
52 check test:: $(TESTRESULTS) $(SUBDIRS:%=%/__test__)
54 $(TESTRESULTS): $(MODULE)$(DLLEXT) ../$(TESTDLL)$(DLLEXT)
56 # Rules for cross-compiling tests
58 .SUFFIXES: .cross.o .res.cross.o
61 $(CROSSCC) -c $(ALLCFLAGS) -o $@ $<
64 $(CROSSWINDRES) -i $< -o $@
66 crosstest:: @CROSSTEST@
68 $(CROSSTEST): $(CROSSOBJS) Makefile.in
69 $(CROSSCC) $(CROSSOBJS) -o $@ $(ALL_LIBS)
77 $(RM) $(MODULE) $(TESTLIST) $(TESTRESULTS) $(CROSSTEST)