Added winebuild -e option to specify the entry point and removed the
[wine] / dlls / Maketest.rules.in
1 # Global rules for building dll unit tests     -*-Makefile-*-
2 #
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)
8 #
9 # plus all variables required by the global Make.rules.in
10 #
11
12 DEFS         = @DLLFLAGS@ -DSTRICT -DNONAMELESSUNION -DNONAMELESSSTRUCT $(EXTRADEFS)
13 LDDLLFLAGS   = @LDDLLFLAGS@
14
15 MODULE       = $(TESTDLL:%.dll=%)_test.exe
16 TESTLIST     = testlist.c
17 TESTRESULTS  = $(CTESTS:.c=.ok)
18 TESTPROGRAM  = $(MODULE)$(DLLEXT)
19 RUNTESTFLAGS = -q -P wine -M $(TESTDLL) -T $(TOPOBJDIR) -p $(TESTPROGRAM)
20
21 C_SRCS       = $(CTESTS)
22 EXTRA_OBJS   = $(TESTLIST:.c=.o)
23 ALL_LIBS     = $(LIBWINE) $(EXTRALIBS) $(LIBS)
24
25 CROSSTEST    = $(TESTDLL:%.dll=%)_crosstest.exe
26 CROSSOBJS    = $(C_SRCS:.c=.cross.o) $(TESTLIST:.c=.cross.o)
27
28 @MAKE_RULES@
29
30 # Rule for main module spec file
31
32 $(MODULE).spec.c: $(RC_SRCS:.rc=.res) $(OBJS) $(WINEBUILD)
33         $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -exe $(MODULE) -mcui $(RC_SRCS:%.rc=-r %.res) $(OBJS) -L$(DLLDIR) $(DELAYIMPORTS:%=-d%) $(IMPORTS:%=-l%)
34
35 # Rules for .so main module
36
37 $(MODULE).so: $(MODULE).spec.o $(OBJS) Makefile.in
38         $(LDSHARED) $(LDDLLFLAGS) $(MODULE).spec.o $(OBJS) -o $@ $(ALL_LIBS)
39
40 # Rules for .exe main module
41
42 $(MODULE): $(OBJS) $(RCOBJS) Makefile.in
43         $(CC) $(OBJS) $(RCOBJS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(ALL_LIBS)
44
45 # Rules for building test list
46
47 $(TESTLIST): Makefile.in
48         $(TOPSRCDIR)/programs/winetest/make_ctests $(CTESTS) >$(TESTLIST) || $(RM) $(TESTLIST)
49
50 # Rules for checking that no imports are missing
51
52 CHECKLINK_RPATH = library
53
54 checklink:: $(MODULE).so $(SUBDIRS:%=%/__checklink__)
55         $(CC) -o checklink $(CHECKLINK_RPATH:%=-Wl,-rpath,$(TOPOBJDIR)/%) $(TOPSRCDIR)/library/checklink.c $(MODULE).so && $(RM) checklink
56
57 # Rules for testing
58
59 check test:: $(TESTRESULTS) $(SUBDIRS:%=%/__test__)
60
61 $(TESTRESULTS): $(MODULE)$(DLLEXT) $(TOPOBJDIR)/dlls/$(TESTDLL)$(DLLEXT)
62
63 # Rules for cross-compiling tests
64
65 crosstest:: @CROSSTEST@
66
67 $(CROSSTEST): $(CROSSOBJS) Makefile.in
68         $(CROSSCC) $(CROSSOBJS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(LIBS)
69
70 # Rules for cleaning
71
72 testclean::
73         $(RM) $(TESTRESULTS)
74
75 clean::
76         $(RM) $(MODULE) $(TESTLIST) $(TESTRESULTS) $(CROSSTEST)