blob: 8a9c46c9f47d0fb7803ad0254c6ae1a2ca17cd48 [file] [log] [blame]
Alexandre Julliardedeee892002-08-09 01:22:40 +00001# 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
Alexandre Julliard16cd8612003-09-24 19:01:44 +000012DEFS = $(EXTRADEFS)
13DLLFLAGS = @DLLFLAGS@
Alexandre Julliardedeee892002-08-09 01:22:40 +000014
15MODULE = $(TESTDLL:%.dll=%)_test.exe
16TESTLIST = testlist.c
Alexandre Julliardedeee892002-08-09 01:22:40 +000017TESTRESULTS = $(CTESTS:.c=.ok)
18TESTPROGRAM = $(MODULE)$(DLLEXT)
19RUNTESTFLAGS = -q -P wine -M $(TESTDLL) -T $(TOPOBJDIR) -p $(TESTPROGRAM)
20
21C_SRCS = $(CTESTS)
Francois Gougetbc8b8a22002-12-11 01:29:36 +000022EXTRA_SRCS = $(TESTLIST)
Alexandre Julliard0cf75332002-10-30 20:36:21 +000023EXTRA_OBJS = $(TESTLIST:.c=.o)
Alexandre Julliard4d6b27e2004-03-03 22:39:22 +000024ALL_LIBS = $(IMPORTS:%=-l%) $(EXTRALIBS) $(LDFLAGS) $(LIBS)
Alexandre Julliard21ee3292003-04-21 22:52:31 +000025IMPORTLIBS = $(IMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT))
Alexandre Julliardedeee892002-08-09 01:22:40 +000026
Alexandre Julliardc3c587e2002-09-06 19:46:00 +000027CROSSTEST = $(TESTDLL:%.dll=%)_crosstest.exe
Alexandre Julliard21ee3292003-04-21 22:52:31 +000028CROSSOBJS = $(C_SRCS:.c=.cross.o) $(RC_SRCS:.rc=.res.cross.o) $(TESTLIST:.c=.cross.o)
29CROSSCC = @CROSSCC@
30CROSSWINDRES = @CROSSWINDRES@
Alexandre Julliardc3c587e2002-09-06 19:46:00 +000031
Alexandre Julliardedeee892002-08-09 01:22:40 +000032@MAKE_RULES@
33
Alexandre Julliardbcf2a782002-12-06 19:51:20 +000034all: $(TESTPROGRAM)
35
Alexandre Julliardedeee892002-08-09 01:22:40 +000036# Rules for .so main module
37
Alexandre Julliardccc3d662004-03-02 06:58:21 +000038$(MODULE).so: $(OBJS) $(RC_SRCS:.rc=.res) $(IMPORTLIBS) Makefile.in
Alexandre Julliard6be39b62004-03-09 04:54:07 +000039 $(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -mconsole $(OBJS) $(RC_SRCS:.rc=.res) -o $@ $(LIBPORT) -L$(DLLDIR) -L$(LIBDIR) $(ALL_LIBS)
Alexandre Julliardedeee892002-08-09 01:22:40 +000040
41# Rules for .exe main module
42
Alexandre Julliardc3eac432004-01-26 21:29:05 +000043$(MODULE): $(OBJS) $(RCOBJS) Makefile.in
Alexandre Julliard4d6b27e2004-03-03 22:39:22 +000044 $(CC) $(OBJS) $(RCOBJS) -o $@ $(ALL_LIBS)
Alexandre Julliardedeee892002-08-09 01:22:40 +000045
46# Rules for building test list
47
Alexandre Julliard3110e952003-09-06 02:30:30 +000048$(TESTLIST): Makefile.in $(TOPSRCDIR)/tools/make_ctests
Dimitrie O. Paune39e8a12002-11-11 20:25:54 +000049 $(TOPSRCDIR)/tools/make_ctests $(CTESTS) >$(TESTLIST) || $(RM) $(TESTLIST)
Alexandre Julliardedeee892002-08-09 01:22:40 +000050
Francois Gougetbc8b8a22002-12-11 01:29:36 +000051depend: $(TESTLIST)
52
Alexandre Julliardedeee892002-08-09 01:22:40 +000053# Rules for testing
54
55check test:: $(TESTRESULTS) $(SUBDIRS:%=%/__test__)
56
Alexandre Julliard309fde72002-12-13 20:45:39 +000057$(TESTRESULTS): $(MODULE)$(DLLEXT) $(DLLDIR)/$(TESTDLL)$(DLLEXT)
Alexandre Julliardedeee892002-08-09 01:22:40 +000058
Alexandre Julliardc3c587e2002-09-06 19:46:00 +000059# Rules for cross-compiling tests
60
Alexandre Julliard21ee3292003-04-21 22:52:31 +000061.SUFFIXES: .cross.o .res.cross.o
62
63.c.cross.o:
64 $(CROSSCC) -c $(ALLCFLAGS) -o $@ $<
65
66.res.res.cross.o:
67 $(CROSSWINDRES) -i $< -o $@
68
Alexandre Julliardc3c587e2002-09-06 19:46:00 +000069crosstest:: @CROSSTEST@
70
71$(CROSSTEST): $(CROSSOBJS) Makefile.in
Alexandre Julliard4d6b27e2004-03-03 22:39:22 +000072 $(CROSSCC) $(CROSSOBJS) -o $@ $(ALL_LIBS)
Alexandre Julliardc3c587e2002-09-06 19:46:00 +000073
Alexandre Julliardedeee892002-08-09 01:22:40 +000074# Rules for cleaning
75
76testclean::
77 $(RM) $(TESTRESULTS)
78
79clean::
Alexandre Julliardc3c587e2002-09-06 19:46:00 +000080 $(RM) $(MODULE) $(TESTLIST) $(TESTRESULTS) $(CROSSTEST)