Alexandre Julliard | edeee89 | 2002-08-09 01:22:40 +0000 | [diff] [blame] | 1 | # Global rules for building dll unit tests -*-Makefile-*- |
| 2 | # |
| 3 | # Each individual makefile should define the following variables: |
Thomas Kho | 1afed1f | 2006-07-28 13:53:52 -0500 | [diff] [blame] | 4 | # TESTDLL : the dll to test |
Alexandre Julliard | 6164ce2 | 2010-02-20 19:56:55 +0100 | [diff] [blame] | 5 | # C_SRCS : list of C test programs |
Alexandre Julliard | edeee89 | 2002-08-09 01:22:40 +0000 | [diff] [blame] | 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 Julliard | 16cd861 | 2003-09-24 19:01:44 +0000 | [diff] [blame] | 12 | DLLFLAGS = @DLLFLAGS@ |
Alexandre Julliard | 239265f | 2009-10-06 13:34:37 +0200 | [diff] [blame] | 13 | DEFS = -DWINE_STRICT_PROTOTYPES $(EXTRADEFS) |
Alexandre Julliard | edeee89 | 2002-08-09 01:22:40 +0000 | [diff] [blame] | 14 | |
| 15 | MODULE = $(TESTDLL:%.dll=%)_test.exe |
Alexandre Julliard | 6164ce2 | 2010-02-20 19:56:55 +0100 | [diff] [blame] | 16 | TESTRESULTS = $(C_SRCS:.c=.ok) |
Alexandre Julliard | edeee89 | 2002-08-09 01:22:40 +0000 | [diff] [blame] | 17 | TESTPROGRAM = $(MODULE)$(DLLEXT) |
| 18 | RUNTESTFLAGS = -q -P wine -M $(TESTDLL) -T $(TOPOBJDIR) -p $(TESTPROGRAM) |
| 19 | |
Alexandre Julliard | 4d6b27e | 2004-03-03 22:39:22 +0000 | [diff] [blame] | 20 | ALL_LIBS = $(IMPORTS:%=-l%) $(EXTRALIBS) $(LDFLAGS) $(LIBS) |
Alexandre Julliard | 9953dd6 | 2006-09-11 15:43:38 +0200 | [diff] [blame] | 21 | EXTRA_OBJS = testlist.o |
Alexandre Julliard | edeee89 | 2002-08-09 01:22:40 +0000 | [diff] [blame] | 22 | |
Alexandre Julliard | c3c587e | 2002-09-06 19:46:00 +0000 | [diff] [blame] | 23 | CROSSTEST = $(TESTDLL:%.dll=%)_crosstest.exe |
Francois Gouget | 7bb43a3 | 2009-06-30 10:25:19 +0200 | [diff] [blame] | 24 | MAKEDEPFLAGS = -xo -xcross.o |
Alexandre Julliard | c3c587e | 2002-09-06 19:46:00 +0000 | [diff] [blame] | 25 | |
Alexandre Julliard | edeee89 | 2002-08-09 01:22:40 +0000 | [diff] [blame] | 26 | @MAKE_RULES@ |
| 27 | |
Alexandre Julliard | bcf2a78 | 2002-12-06 19:51:20 +0000 | [diff] [blame] | 28 | all: $(TESTPROGRAM) |
| 29 | |
Alexandre Julliard | 68a1f4d | 2009-06-02 15:50:57 +0200 | [diff] [blame] | 30 | $(MODULE) $(MODULE).so: $(OBJS) Makefile.in |
| 31 | $(WINEGCC) $(APPMODE) $(OBJS) -o $@ $(LIBPORT) $(ALL_LIBS) |
Alexandre Julliard | edeee89 | 2002-08-09 01:22:40 +0000 | [diff] [blame] | 32 | |
Alexandre Julliard | 93f0339 | 2010-02-10 20:27:52 +0100 | [diff] [blame] | 33 | .PHONY: check test testclean crosstest |
| 34 | |
Alexandre Julliard | edeee89 | 2002-08-09 01:22:40 +0000 | [diff] [blame] | 35 | # Rules for building test list |
| 36 | |
Alexandre Julliard | 9953dd6 | 2006-09-11 15:43:38 +0200 | [diff] [blame] | 37 | testlist.c: Makefile.in $(MAKECTESTS) |
Alexandre Julliard | 6164ce2 | 2010-02-20 19:56:55 +0100 | [diff] [blame] | 38 | $(MAKECTESTS) -o $@ $(C_SRCS) |
Alexandre Julliard | edeee89 | 2002-08-09 01:22:40 +0000 | [diff] [blame] | 39 | |
Alexandre Julliard | 9953dd6 | 2006-09-11 15:43:38 +0200 | [diff] [blame] | 40 | testlist.o: testlist.c $(TOPSRCDIR)/include/wine/test.h |
Francois Gouget | bc8b8a2 | 2002-12-11 01:29:36 +0000 | [diff] [blame] | 41 | |
Alexandre Julliard | edeee89 | 2002-08-09 01:22:40 +0000 | [diff] [blame] | 42 | # Rules for testing |
| 43 | |
Alexandre Julliard | eab7efd | 2010-03-25 21:42:54 +0100 | [diff] [blame] | 44 | check test: $(TESTRESULTS) |
Alexandre Julliard | edeee89 | 2002-08-09 01:22:40 +0000 | [diff] [blame] | 45 | |
Alexandre Julliard | 02fa42d | 2006-03-21 12:01:31 +0100 | [diff] [blame] | 46 | $(TESTRESULTS): $(MODULE)$(DLLEXT) ../$(TESTDLL)$(DLLEXT) |
Alexandre Julliard | edeee89 | 2002-08-09 01:22:40 +0000 | [diff] [blame] | 47 | |
Alexandre Julliard | c3c587e | 2002-09-06 19:46:00 +0000 | [diff] [blame] | 48 | # Rules for cross-compiling tests |
| 49 | |
Alexandre Julliard | eab7efd | 2010-03-25 21:42:54 +0100 | [diff] [blame] | 50 | crosstest: @CROSSTEST@ |
Alexandre Julliard | c3c587e | 2002-09-06 19:46:00 +0000 | [diff] [blame] | 51 | |
| 52 | $(CROSSTEST): $(CROSSOBJS) Makefile.in |
Alexandre Julliard | a2d88ab | 2009-05-30 17:08:06 +0200 | [diff] [blame] | 53 | $(CROSSWINEGCC) $(CROSSOBJS) -o $@ $(ALL_LIBS) |
Alexandre Julliard | c3c587e | 2002-09-06 19:46:00 +0000 | [diff] [blame] | 54 | |
Alexandre Julliard | edeee89 | 2002-08-09 01:22:40 +0000 | [diff] [blame] | 55 | # Rules for cleaning |
| 56 | |
| 57 | testclean:: |
| 58 | $(RM) $(TESTRESULTS) |
| 59 | |
| 60 | clean:: |
Alexandre Julliard | 9953dd6 | 2006-09-11 15:43:38 +0200 | [diff] [blame] | 61 | $(RM) testlist.c $(MODULE) $(TESTRESULTS) $(CROSSTEST) |