Maketest.rules.in 1.95 KB
Newer Older
1 2 3
# Global rules for building dll unit tests     -*-Makefile-*-
#
# Each individual makefile should define the following variables:
4
# TESTDLL      : the dll to test
5
# C_SRCS       : list of C test programs
6 7 8 9 10 11
# EXTRALIBS    : extra libraries to link in (optional)
# EXTRADEFS    : extra symbol definitions, like -DWINELIB (optional)
#
# plus all variables required by the global Make.rules.in
#

12
DLLFLAGS     = @DLLFLAGS@
13
DEFS         = -DWINE_STRICT_PROTOTYPES -DWINE_NO_NAMELESS_EXTENSION $(EXTRADEFS)
14 15

MODULE       = $(TESTDLL:%.dll=%)_test.exe
16
TESTRESULTS  = $(C_SRCS:.c=.ok)
17
TESTPROGRAM  = $(MODULE)$(DLLEXT)
18 19
WINETEST_EXE = $(TESTDLL:%.dll=%)_test-stripped.exe$(DLLEXT)
WINETEST_RES = $(top_builddir)/programs/winetest/$(TESTDLL:%.dll=%)_test.res
20
RUNTESTFLAGS = -q -P wine -M $(TESTDLL) -T $(top_builddir) -p $(TESTPROGRAM)
21

22
ALL_LIBS     = $(IMPORTS:%=-l%) $(EXTRALIBS) $(LDFLAGS) $(LIBS)
23
EXTRA_OBJS   = testlist.o
24

25
CROSSTEST    = $(TESTDLL:%.dll=%)_crosstest.exe
26
MAKEDEPFLAGS = -xo -xcross.o
27

28 29
@MAKE_RULES@

30
all: $(TESTPROGRAM) $(WINETEST_RES)
31

32 33
$(MODULE) $(MODULE).so: $(OBJS) Makefile.in
	$(WINEGCC) $(APPMODE) $(OBJS) -o $@ $(LIBPORT) $(ALL_LIBS)
34

35
$(WINETEST_EXE): $(OBJS) Makefile.in
36
	$(WINEGCC) -s -Wb,-F,$(MODULE) $(APPMODE) $(OBJS) -o $@ $(LIBPORT) $(ALL_LIBS)
37 38 39 40

$(WINETEST_RES): $(WINETEST_EXE)
	echo "$(MODULE) TESTRES \"$(WINETEST_EXE)\"" | $(LDPATH) $(WRC) $(RCFLAGS) -o $@

41 42
.PHONY: check test testclean crosstest

43 44
# Rules for building test list

45
testlist.c: Makefile.in $(MAKECTESTS)
46
	$(MAKECTESTS) -o $@ $(C_SRCS)
47

48
testlist.o testlist.cross.o: testlist.c $(top_srcdir)/include/wine/test.h
49

50 51
# Rules for testing

52
check test: $(TESTRESULTS)
53

54
$(TESTRESULTS): $(MODULE)$(DLLEXT) ../$(TESTDLL)$(DLLEXT)
55

56 57
# Rules for cross-compiling tests

58
crosstest: @CROSSTEST_DISABLE@ $(CROSSTEST)
59 60

$(CROSSTEST): $(CROSSOBJS) Makefile.in
61
	$(CROSSWINEGCC) $(CROSSOBJS) -o $@ $(ALL_LIBS)
62

63 64 65 66 67 68
# Rules for cleaning

testclean::
	$(RM) $(TESTRESULTS)

clean::
69
	$(RM) testlist.c $(MODULE) $(TESTRESULTS) $(CROSSTEST)