makefiles: Use winegcc to build the crosstests too.
[wine.git] / dlls / Maketest.rules.in
blob0ff50d95a9501da1c6b70a4ef5be17fdf393da81
1 # Global rules for building dll unit tests     -*-Makefile-*-
3 # Each individual makefile should define the following variables:
4 # TESTDLL      : 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 DLLFLAGS     = @DLLFLAGS@
13 DEFS         = $(EXTRADEFS)
15 MODULE       = $(TESTDLL:%.dll=%)_test.exe
16 TESTRESULTS  = $(CTESTS:.c=.ok)
17 TESTPROGRAM  = $(MODULE)$(DLLEXT)
18 RUNTESTFLAGS = -q -P wine -M $(TESTDLL) -T $(TOPOBJDIR) -p $(TESTPROGRAM)
20 C_SRCS       = $(CTESTS)
21 ALL_LIBS     = $(IMPORTS:%=-l%) $(EXTRALIBS) $(LDFLAGS) $(LIBS)
22 EXTRA_OBJS   = testlist.o
24 CROSSTEST    = $(TESTDLL:%.dll=%)_crosstest.exe
25 CROSSCC      = @CROSSCC@
26 CROSSWINEGCC = $(TOOLSDIR)/tools/winegcc/winegcc @CROSSTARGETFLAGS@ -B$(TOOLSDIR)/tools/winebuild --sysroot=$(TOPOBJDIR)
28 @MAKE_RULES@
30 all: $(TESTPROGRAM)
32 $(MODULE) $(MODULE).so: $(OBJS) $(RC_SRCS:.rc=.res) Makefile.in
33         $(WINEGCC) $(APPMODE) $(OBJS) $(RC_SRCS:.rc=.res) -o $@ $(LIBPORT) $(ALL_LIBS)
35 # Rules for building test list
37 testlist.c: Makefile.in $(MAKECTESTS)
38         $(MAKECTESTS) -o $@ $(CTESTS)
40 testlist.o: testlist.c $(TOPSRCDIR)/include/wine/test.h
42 # Rules for testing
44 check test:: $(TESTRESULTS)
46 $(TESTRESULTS): $(MODULE)$(DLLEXT) ../$(TESTDLL)$(DLLEXT)
48 # Rules for cross-compiling tests
50 CROSSOBJS = $(OBJS:.o=.cross.o) $(RC_SRCS:.rc=.res)
52 .SUFFIXES: .cross.o
54 .c.cross.o:
55         $(CROSSCC) -c $(INCLUDES) $(DEFS) $(CPPFLAGS) $(CFLAGS) -o $@ $<
57 crosstest:: @CROSSTEST@
59 $(CROSSTEST): $(CROSSOBJS) Makefile.in
60         $(CROSSWINEGCC) $(CROSSOBJS) -o $@ $(ALL_LIBS)
62 $(CROSSOBJS): $(IDL_GEN_HEADERS)
64 # Rules for cleaning
66 testclean::
67         $(RM) $(TESTRESULTS)
69 clean::
70         $(RM) testlist.c $(MODULE) $(TESTRESULTS) $(CROSSTEST)