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
12 DEFS = @DLLFLAGS@ -DSTRICT -DNONAMELESSUNION -DNONAMELESSSTRUCT $(EXTRADEFS)
13 LDDLLFLAGS = @LDDLLFLAGS@
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_OBJS = $(TESTLIST:.c=.o)
23 ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBS)
25 CROSSTEST = $(TESTDLL:%.dll=%)_crosstest.exe
26 CROSSOBJS = $(C_SRCS:.c=.cross.o) $(TESTLIST:.c=.cross.o)
32 # Rule for main module spec file
34 $(MODULE).spec.c: $(RC_SRCS:.rc=.res) $(OBJS) $(WINEBUILD)
35 $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -exe $(MODULE) -mcui $(RC_SRCS:%.rc=-r %.res) $(OBJS) -L$(DLLDIR) -L.. $(DELAYIMPORTS:%=-d%) $(IMPORTS:%=-l%)
37 # Rules for .so main module
39 $(MODULE).so: $(MODULE).spec.o $(OBJS) Makefile.in
40 $(LDSHARED) $(LDDLLFLAGS) $(MODULE).spec.o $(OBJS) -o $@ $(ALL_LIBS) -lc
42 # Rules for .exe main module
44 $(MODULE): $(OBJS) $(RCOBJS) Makefile.in
45 $(CC) $(OBJS) $(RCOBJS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(ALL_LIBS)
47 # Rules for building test list
49 $(TESTLIST): Makefile.in
50 $(TOPSRCDIR)/tools/make_ctests $(CTESTS) >$(TESTLIST) || $(RM) $(TESTLIST)
54 check test:: $(TESTRESULTS) $(SUBDIRS:%=%/__test__)
56 $(TESTRESULTS): $(MODULE)$(DLLEXT) $(TOPOBJDIR)/dlls/$(TESTDLL)$(DLLEXT)
58 # Rules for cross-compiling tests
60 crosstest:: @CROSSTEST@
62 $(CROSSTEST): $(CROSSOBJS) Makefile.in
63 $(CROSSCC) $(CROSSOBJS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(LIBS)
71 $(RM) $(MODULE) $(TESTLIST) $(TESTRESULTS) $(CROSSTEST)