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@ -D__WINE__ $(EXTRADEFS)
13 LDDLLFLAGS = @LDDLLFLAGS@
15 MODULE = $(TESTDLL:%.dll=%)_test.exe
17 TESTMAIN = $(TOPOBJDIR)/programs/winetest/wtmain.o
18 TESTRESULTS = $(CTESTS:.c=.ok)
19 TESTPROGRAM = $(MODULE)$(DLLEXT)
20 RUNTESTFLAGS = -q -P wine -M $(TESTDLL) -T $(TOPOBJDIR) -p $(TESTPROGRAM)
23 GEN_C_SRCS = $(TESTLIST)
24 EXTRA_OBJS = $(TESTMAIN)
25 ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBS)
27 CROSSTEST = $(TESTDLL:%.dll=%)_crosstest.exe
28 CROSSTESTMAIN= $(TOPOBJDIR)/programs/winetest/wtmain.cross.o
29 CROSSOBJS = $(C_SRCS:.c=.cross.o) $(GEN_C_SRCS:.c=.cross.o) $(CROSSTESTMAIN)
33 # Rule for main module spec file
35 $(MODULE).spec.c: $(RC_SRCS:.rc=.res) $(OBJS) $(WINEBUILD)
36 $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -exe $(MODULE) -mcui $(RC_SRCS:%.rc=-res %.res) $(OBJS) -L$(DLLDIR) $(DELAYIMPORTS:%=-dl%) $(IMPORTS:%=-l%)
38 # Rules for .so main module
40 $(MODULE).so: $(MODULE).spec.o $(OBJS) Makefile.in
41 $(LDSHARED) $(LDDLLFLAGS) $(MODULE).spec.o $(OBJS) -o $@ $(ALL_LIBS)
43 # Rules for .exe main module
45 $(MODULE): $(OBJS) $(RCOBJS) Makefile.in
46 $(CC) $(OBJS) $(RCOBJS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(ALL_LIBS)
48 # Rules for building test list
50 $(TESTLIST): Makefile.in
51 $(TOPSRCDIR)/programs/winetest/make_ctests $(CTESTS) >$(TESTLIST) || $(RM) $(TESTLIST)
53 # Rules for checking that no imports are missing
55 CHECKLINK_RPATH = library tsx11 unicode
57 checklink:: $(MODULE).so $(SUBDIRS:%=%/__checklink__)
58 $(CC) -o checklink $(CHECKLINK_RPATH:%=-Wl,-rpath,$(TOPOBJDIR)/%) $(TOPSRCDIR)/library/checklink.c $(MODULE).so && $(RM) checklink
62 check test:: $(TESTRESULTS) $(SUBDIRS:%=%/__test__)
64 $(TESTRESULTS): $(MODULE)$(DLLEXT) $(TOPOBJDIR)/dlls/$(TESTDLL)$(DLLEXT)
67 cd $(TOPOBJDIR)/programs/winetest && $(MAKE) wtmain.o
69 # Rules for cross-compiling tests
71 crosstest:: @CROSSTEST@
73 $(CROSSTEST): $(CROSSOBJS) Makefile.in
74 $(CROSSCC) $(CROSSOBJS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(LIBS)
77 cd $(TOPOBJDIR)/programs/winetest && $(MAKE) wtmain.cross.o
85 $(RM) $(MODULE) $(TESTLIST) $(TESTRESULTS) $(CROSSTEST)