Sweden-Number/dlls/Maketest.rules.in

86 lines
2.3 KiB
Plaintext
Raw Normal View History

# 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
#
DEFS = $(EXTRADEFS)
DLLFLAGS = @DLLFLAGS@
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 = $(LIBWINE) $(EXTRALIBS) $(LIBPORT) $(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)
# Rule for main module spec file
2002-12-13 21:45:39 +01:00
$(MODULE).spec.c: $(RC_SRCS:.rc=.res) $(OBJS) $(IMPORTLIBS) $(WINEBUILD)
$(WINEBUILD) $(DEFS) $(DLLFLAGS) -o $@ --exe $(MODULE) --mode cui $(RC_SRCS:.rc=.res) $(OBJS) -L$(DLLDIR) $(IMPORTS:%=-l%)
# Rules for .so main module
$(MODULE).so: $(MODULE).spec.o $(OBJS) Makefile.in
$(LDDLL) $(MODULE).spec.o $(OBJS) -o $@ -L$(DLLDIR) $(ALL_LIBS) -lc
# Rules for .exe main module
$(MODULE): $(OBJS) $(RCOBJS) Makefile.in
$(CC) $(OBJS) $(RCOBJS) -o $@ $(IMPORTS:%=-l%) $(EXTRALIBS) $(LDFLAGS) $(LIBS)
# Rules for building test list
$(TESTLIST): Makefile.in $(TOPSRCDIR)/tools/make_ctests
$(TOPSRCDIR)/tools/make_ctests $(CTESTS) >$(TESTLIST) || $(RM) $(TESTLIST)
depend: $(TESTLIST)
# Rules for testing
check test:: $(TESTRESULTS) $(SUBDIRS:%=%/__test__)
2002-12-13 21:45:39 +01:00
$(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 $@ $(IMPORTS:%=-l%) $(EXTRALIBS) $(LDFLAGS) $(LIBS)
# Rules for cleaning
testclean::
$(RM) $(TESTRESULTS)
clean::
$(RM) $(MODULE) $(TESTLIST) $(TESTRESULTS) $(CROSSTEST)