blob: a7095a5c7db2df0f5ea68161edb92bb5f7810577 [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:
Thomas Kho1afed1f2006-07-28 13:53:52 -05004# TESTDLL : the dll to test
Alexandre Julliardedeee892002-08-09 01:22:40 +00005# 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 +000012DLLFLAGS = @DLLFLAGS@
Mike McCormack6d9af552006-04-17 18:17:18 +090013DEFS = $(EXTRADEFS)
Alexandre Julliardedeee892002-08-09 01:22:40 +000014
15MODULE = $(TESTDLL:%.dll=%)_test.exe
Alexandre Julliardedeee892002-08-09 01:22:40 +000016TESTRESULTS = $(CTESTS:.c=.ok)
17TESTPROGRAM = $(MODULE)$(DLLEXT)
18RUNTESTFLAGS = -q -P wine -M $(TESTDLL) -T $(TOPOBJDIR) -p $(TESTPROGRAM)
19
Alexandre Julliard9953dd62006-09-11 15:43:38 +020020C_SRCS = $(CTESTS)
Alexandre Julliard4d6b27e2004-03-03 22:39:22 +000021ALL_LIBS = $(IMPORTS:%=-l%) $(EXTRALIBS) $(LDFLAGS) $(LIBS)
Alexandre Julliard9953dd62006-09-11 15:43:38 +020022EXTRA_OBJS = testlist.o
Alexandre Julliardedeee892002-08-09 01:22:40 +000023
Alexandre Julliardc3c587e2002-09-06 19:46:00 +000024CROSSTEST = $(TESTDLL:%.dll=%)_crosstest.exe
Alexandre Julliard9953dd62006-09-11 15:43:38 +020025CROSSOBJS = $(C_SRCS:.c=.cross.o) $(RC_SRCS:.rc=.res.cross.o) testlist.cross.o
Alexandre Julliard21ee3292003-04-21 22:52:31 +000026CROSSCC = @CROSSCC@
27CROSSWINDRES = @CROSSWINDRES@
Alexandre Julliardc3c587e2002-09-06 19:46:00 +000028
Alexandre Julliardedeee892002-08-09 01:22:40 +000029@MAKE_RULES@
30
Alexandre Julliardbcf2a782002-12-06 19:51:20 +000031all: $(TESTPROGRAM)
32
Alexandre Julliardedeee892002-08-09 01:22:40 +000033# Rules for .so main module
34
Alexandre Julliardd62356a2005-05-07 12:39:52 +000035$(MODULE).so: $(OBJS) $(RC_SRCS:.rc=.res) Makefile.in
Alexandre Julliard523e46d2006-07-11 21:32:36 +020036 $(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -mconsole $(OBJS) $(RC_SRCS:.rc=.res) -o $@ $(LIBPORT) $(ALL_LIBS)
Alexandre Julliardedeee892002-08-09 01:22:40 +000037
38# Rules for .exe main module
39
Alexandre Julliardc3eac432004-01-26 21:29:05 +000040$(MODULE): $(OBJS) $(RCOBJS) Makefile.in
Alexandre Julliard4d6b27e2004-03-03 22:39:22 +000041 $(CC) $(OBJS) $(RCOBJS) -o $@ $(ALL_LIBS)
Alexandre Julliardedeee892002-08-09 01:22:40 +000042
43# Rules for building test list
44
Alexandre Julliard9953dd62006-09-11 15:43:38 +020045testlist.c: Makefile.in $(MAKECTESTS)
Alexandre Julliardbcb75912005-03-16 20:02:17 +000046 $(MAKECTESTS) -o $@ $(CTESTS)
Alexandre Julliardedeee892002-08-09 01:22:40 +000047
Alexandre Julliard9953dd62006-09-11 15:43:38 +020048testlist.o: testlist.c $(TOPSRCDIR)/include/wine/test.h
Francois Gougetbc8b8a22002-12-11 01:29:36 +000049
Alexandre Julliardedeee892002-08-09 01:22:40 +000050# Rules for testing
51
Alexandre Julliard5cf75e62006-08-28 13:37:44 +020052check test:: $(TESTRESULTS)
Alexandre Julliardedeee892002-08-09 01:22:40 +000053
Alexandre Julliard02fa42d2006-03-21 12:01:31 +010054$(TESTRESULTS): $(MODULE)$(DLLEXT) ../$(TESTDLL)$(DLLEXT)
Alexandre Julliardedeee892002-08-09 01:22:40 +000055
Alexandre Julliardc3c587e2002-09-06 19:46:00 +000056# Rules for cross-compiling tests
57
Alexandre Julliard21ee3292003-04-21 22:52:31 +000058.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
Alexandre Julliardc3c587e2002-09-06 19:46:00 +000066crosstest:: @CROSSTEST@
67
68$(CROSSTEST): $(CROSSOBJS) Makefile.in
Alexandre Julliard4d6b27e2004-03-03 22:39:22 +000069 $(CROSSCC) $(CROSSOBJS) -o $@ $(ALL_LIBS)
Alexandre Julliardc3c587e2002-09-06 19:46:00 +000070
Alexandre Julliardedeee892002-08-09 01:22:40 +000071# Rules for cleaning
72
73testclean::
74 $(RM) $(TESTRESULTS)
75
76clean::
Alexandre Julliard9953dd62006-09-11 15:43:38 +020077 $(RM) testlist.c $(MODULE) $(TESTRESULTS) $(CROSSTEST)