Maketest.rules.in 2.14 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 6 7 8 9 10 11
# CTESTS       : list of C test programs
# 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         = $(EXTRADEFS)
14 15 16 17 18 19

MODULE       = $(TESTDLL:%.dll=%)_test.exe
TESTRESULTS  = $(CTESTS:.c=.ok)
TESTPROGRAM  = $(MODULE)$(DLLEXT)
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
23

24
CROSSTEST    = $(TESTDLL:%.dll=%)_crosstest.exe
25
CROSSOBJS    = $(C_SRCS:.c=.cross.o) $(RC_SRCS:.rc=.res.cross.o) $(BISON_SRCS:.y=.tab.cross.o) $(LEX_SRCS:.l=.yy.cross.o) $(IDL_GEN_C_SRCS:.c=.cross.o) testlist.cross.o
26 27
CROSSCC      = @CROSSCC@
CROSSWINDRES = @CROSSWINDRES@
28

29 30
@MAKE_RULES@

31 32
all: $(TESTPROGRAM)

33 34
# Rules for .so main module

35
$(MODULE).so: $(OBJS) $(RC_SRCS:.rc=.res) Makefile.in
36
	$(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -mconsole $(APPMODE) $(OBJS) $(RC_SRCS:.rc=.res) -o $@ $(LIBPORT) $(ALL_LIBS)
37 38 39

# Rules for .exe main module

40
$(MODULE): $(OBJS) $(RCOBJS) Makefile.in
41
	$(CC) $(APPMODE) $(OBJS) $(RCOBJS) -o $@ -L$(DLLDIR) $(IMPORTS:%=-L$(DLLDIR)/%) $(ALL_LIBS)
42 43 44

# Rules for building test list

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

48
testlist.o: testlist.c $(TOPSRCDIR)/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 59 60
.SUFFIXES: .cross.o .res.cross.o

.c.cross.o:
61
	$(CROSSCC) -c $(INCLUDES) $(DEFS) $(CPPFLAGS) $(CFLAGS) -o $@ $<
62 63 64 65

.res.res.cross.o:
	$(CROSSWINDRES) -i $< -o $@

66 67 68
crosstest:: @CROSSTEST@

$(CROSSTEST): $(CROSSOBJS) Makefile.in
69
	$(CROSSCC) $(CROSSOBJS) -o $@ -L$(DLLDIR) $(IMPORTS:%=-L$(DLLDIR)/%) $(ALL_LIBS)
70

71 72
$(CROSSOBJS): $(IDL_GEN_HEADERS)

73 74 75 76 77 78
# Rules for cleaning

testclean::
	$(RM) $(TESTRESULTS)

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