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 LDDLLFLAGS = @LDDLLFLAGS@
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 = $(LIBWINE) $(EXTRALIBS) $(LIBPORT) $(LDFLAGS) $(LIBS)
26 IMPORTLIBS = $(IMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT))
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 # Rule for main module spec file
39 $(MODULE).spec.c: $(RC_SRCS:.rc=.res) $(OBJS) $(IMPORTLIBS) $(WINEBUILD)
40 $(WINEBUILD) $(DEFS) $(DLLFLAGS) -o $@ --exe $(MODULE) --exe-mode cui $(RC_SRCS:.rc=.res) $(OBJS) -L$(DLLDIR) $(IMPORTS:%=-l%)
42 # Rules for .so main module
44 $(MODULE).so: $(MODULE).spec.o $(OBJS) Makefile.in
45 $(LDSHARED) $(LDDLLFLAGS) $(MODULE).spec.o $(OBJS) -o $@ $(ALL_LIBS) -lc
47 # Rules for .exe main module
49 $(MODULE): $(OBJS) $(RCOBJS) $(IMPORTLIBS) Makefile.in
50 $(CC) $(OBJS) $(RCOBJS) -o $@ -L$(DLLDIR) $(IMPORTS:%=-l%) $(ALL_LIBS)
52 # Rules for building test list
54 $(TESTLIST): Makefile.in $(TOPSRCDIR)/tools/make_ctests
55 $(TOPSRCDIR)/tools/make_ctests $(CTESTS) >$(TESTLIST) || $(RM) $(TESTLIST)
61 check test:: $(TESTRESULTS) $(SUBDIRS:%=%/__test__)
63 $(TESTRESULTS): $(MODULE)$(DLLEXT) $(DLLDIR)/$(TESTDLL)$(DLLEXT)
65 # Rules for cross-compiling tests
67 .SUFFIXES: .cross.o .res.cross.o
70 $(CROSSCC) -c $(ALLCFLAGS) -o $@ $<
73 $(CROSSWINDRES) -i $< -o $@
75 crosstest:: @CROSSTEST@
77 $(CROSSTEST): $(CROSSOBJS) Makefile.in
78 $(CROSSCC) $(CROSSOBJS) -o $@ $(IMPORTS:%=-l%) $(LIBS)
86 $(RM) $(MODULE) $(TESTLIST) $(TESTRESULTS) $(CROSSTEST)