wine/dlls/Maketest.rules.in
2005-03-16 20:02:17 +00:00

82 lines
2.1 KiB
Makefile

# Global rules for building dll unit tests -*-Makefile-*-
#
# Each individual makefile should define the following variables:
# DLLTEST : the dll to test
# 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
#
DLLDEFS = @DLLDEFS@
DLLFLAGS = @DLLFLAGS@
DEFS = $(DLLDEFS) $(EXTRADEFS)
MODULE = $(TESTDLL:%.dll=%)_test.exe
TESTLIST = testlist.c
TESTRESULTS = $(CTESTS:.c=.ok)
TESTPROGRAM = $(MODULE)$(DLLEXT)
RUNTESTFLAGS = -q -P wine -M $(TESTDLL) -T $(TOPOBJDIR) -p $(TESTPROGRAM)
C_SRCS = $(CTESTS)
EXTRA_SRCS = $(TESTLIST)
EXTRA_OBJS = $(TESTLIST:.c=.o)
ALL_LIBS = $(IMPORTS:%=-l%) $(EXTRALIBS) $(LDFLAGS) $(LIBS)
IMPORTLIBS = $(IMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT))
CROSSTEST = $(TESTDLL:%.dll=%)_crosstest.exe
CROSSOBJS = $(C_SRCS:.c=.cross.o) $(RC_SRCS:.rc=.res.cross.o) $(TESTLIST:.c=.cross.o)
CROSSCC = @CROSSCC@
CROSSWINDRES = @CROSSWINDRES@
@MAKE_RULES@
all: $(TESTPROGRAM)
# Rules for .so main module
$(MODULE).so: $(OBJS) $(RC_SRCS:.rc=.res) $(IMPORTLIBS) Makefile.in
$(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -mconsole $(OBJS) $(RC_SRCS:.rc=.res) -o $@ $(LIBPORT) -L$(DLLDIR) -L$(LIBDIR) $(ALL_LIBS)
# Rules for .exe main module
$(MODULE): $(OBJS) $(RCOBJS) Makefile.in
$(CC) $(OBJS) $(RCOBJS) -o $@ $(ALL_LIBS)
# Rules for building test list
$(TESTLIST): Makefile.in $(MAKECTESTS)
$(MAKECTESTS) -o $@ $(CTESTS)
depend: $(TESTLIST)
# Rules for testing
check test:: $(TESTRESULTS) $(SUBDIRS:%=%/__test__)
$(TESTRESULTS): $(MODULE)$(DLLEXT) $(DLLDIR)/$(TESTDLL)$(DLLEXT)
# Rules for cross-compiling tests
.SUFFIXES: .cross.o .res.cross.o
.c.cross.o:
$(CROSSCC) -c $(ALLCFLAGS) -o $@ $<
.res.res.cross.o:
$(CROSSWINDRES) -i $< -o $@
crosstest:: @CROSSTEST@
$(CROSSTEST): $(CROSSOBJS) Makefile.in
$(CROSSCC) $(CROSSOBJS) -o $@ $(ALL_LIBS)
# Rules for cleaning
testclean::
$(RM) $(TESTRESULTS)
clean::
$(RM) $(MODULE) $(TESTLIST) $(TESTRESULTS) $(CROSSTEST)