winegcc: Automatically add the correct lib paths when building inside the Wine tree.
[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 DLLFLAGS     = @DLLFLAGS@
13 DEFS         = $(EXTRADEFS)
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) $(TESTLIST)
22 ALL_LIBS     = $(IMPORTS:%=-l%) $(EXTRALIBS) $(LDFLAGS) $(LIBS)
23
24 CROSSTEST    = $(TESTDLL:%.dll=%)_crosstest.exe
25 CROSSOBJS    = $(C_SRCS:.c=.cross.o) $(RC_SRCS:.rc=.res.cross.o)
26 CROSSCC      = @CROSSCC@
27 CROSSWINDRES = @CROSSWINDRES@
28
29 @MAKE_RULES@
30
31 all: $(TESTPROGRAM)
32
33 # Rules for .so main module
34
35 $(MODULE).so: $(OBJS) $(RC_SRCS:.rc=.res) Makefile.in
36         $(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -mconsole $(OBJS) $(RC_SRCS:.rc=.res) -o $@ $(LIBPORT) $(ALL_LIBS)
37
38 # Rules for .exe main module
39
40 $(MODULE): $(OBJS) $(RCOBJS) Makefile.in
41         $(CC) $(OBJS) $(RCOBJS) -o $@ $(ALL_LIBS)
42
43 # Rules for building test list
44
45 $(TESTLIST): Makefile.in $(MAKECTESTS)
46         $(MAKECTESTS) -o $@ $(CTESTS)
47
48 depend: $(TESTLIST)
49
50 # Rules for testing
51
52 check test:: $(TESTRESULTS) $(SUBDIRS:%=%/__test__)
53
54 $(TESTRESULTS): $(MODULE)$(DLLEXT) ../$(TESTDLL)$(DLLEXT)
55
56 # Rules for cross-compiling tests
57
58 .SUFFIXES: .cross.o .res.cross.o
59
60 .c.cross.o:
61         $(CROSSCC) -c $(ALLCFLAGS) -o $@ $<
62
63 .res.res.cross.o:
64         $(CROSSWINDRES) -i $< -o $@
65
66 crosstest:: @CROSSTEST@
67
68 $(CROSSTEST): $(CROSSOBJS) Makefile.in
69         $(CROSSCC) $(CROSSOBJS) -o $@ $(ALL_LIBS)
70
71 # Rules for cleaning
72
73 testclean::
74         $(RM) $(TESTRESULTS)
75
76 clean::
77         $(RM) $(MODULE) $(TESTLIST) $(TESTRESULTS) $(CROSSTEST)