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)
25 CROSSTEST = $(TESTDLL:%.dll=%)_crosstest.exe
26 CROSSOBJS = $(C_SRCS:.c=.cross.o) $(RC_SRCS:.rc=.res.cross.o)
28 CROSSWINDRES = @CROSSWINDRES@
34 # Rules for .so main module
36 $(MODULE).so: $(OBJS) $(RC_SRCS:.rc=.res) Makefile.in
37 $(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -mconsole $(OBJS) $(RC_SRCS:.rc=.res) -o $@ $(LIBPORT) -L$(DLLDIR) -L$(LIBDIR) $(ALL_LIBS)
39 # Rules for .exe main module
41 $(MODULE): $(OBJS) $(RCOBJS) Makefile.in
42 $(CC) $(OBJS) $(RCOBJS) -o $@ $(ALL_LIBS)
44 # Rules for building test list
46 $(TESTLIST): Makefile.in $(MAKECTESTS)
47 $(MAKECTESTS) -o $@ $(CTESTS)
53 check test:: $(TESTRESULTS) $(SUBDIRS:%=%/__test__)
55 $(TESTRESULTS): $(MODULE)$(DLLEXT) ../$(TESTDLL)$(DLLEXT)
57 # Rules for cross-compiling tests
59 .SUFFIXES: .cross.o .res.cross.o
62 $(CROSSCC) -c $(ALLCFLAGS) -o $@ $<
65 $(CROSSWINDRES) -i $< -o $@
67 crosstest:: @CROSSTEST@
69 $(CROSSTEST): $(CROSSOBJS) Makefile.in
70 $(CROSSCC) $(CROSSOBJS) -o $@ $(ALL_LIBS)
78 $(RM) $(MODULE) $(TESTLIST) $(TESTRESULTS) $(CROSSTEST)