# Global rules for building dll unit tests -*-Makefile-*-
#
# Each individual makefile should define the following variables:
-# DLLTEST : the dll to test
+# TESTDLL : 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 = @DLLFLAGS@ -D__WINE__ $(EXTRADEFS)
-LDDLLFLAGS = @LDDLLFLAGS@
+DLLFLAGS = @DLLFLAGS@
+DEFS = $(EXTRADEFS)
MODULE = $(TESTDLL:%.dll=%)_test.exe
-TESTLIST = testlist.c
-TESTMAIN = $(TOPOBJDIR)/programs/winetest/wtmain.o
TESTRESULTS = $(CTESTS:.c=.ok)
TESTPROGRAM = $(MODULE)$(DLLEXT)
RUNTESTFLAGS = -q -P wine -M $(TESTDLL) -T $(TOPOBJDIR) -p $(TESTPROGRAM)
C_SRCS = $(CTESTS)
-GEN_C_SRCS = $(TESTLIST)
-EXTRA_OBJS = $(TESTMAIN)
-ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBS)
+ALL_LIBS = $(IMPORTS:%=-l%) $(EXTRALIBS) $(LDFLAGS) $(LIBS)
+EXTRA_OBJS = testlist.o
CROSSTEST = $(TESTDLL:%.dll=%)_crosstest.exe
-CROSSTESTMAIN= $(TOPOBJDIR)/programs/winetest/wtmain.cross.o
-CROSSOBJS = $(C_SRCS:.c=.cross.o) $(GEN_C_SRCS:.c=.cross.o) $(CROSSTESTMAIN)
+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
+CROSSCC = @CROSSCC@
+CROSSWINDRES = @CROSSWINDRES@
@MAKE_RULES@
-# Rule for main module spec file
-
-$(MODULE).spec.c: $(RC_SRCS:.rc=.res) $(OBJS) $(WINEBUILD)
- $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -exe $(MODULE) -mcui $(RC_SRCS:%.rc=-res %.res) $(OBJS) -L$(DLLDIR) $(DELAYIMPORTS:%=-dl%) $(IMPORTS:%=-l%)
+all: $(TESTPROGRAM)
# Rules for .so main module
-$(MODULE).so: $(MODULE).spec.o $(OBJS) Makefile.in
- $(LDSHARED) $(LDDLLFLAGS) $(MODULE).spec.o $(OBJS) -o $@ $(ALL_LIBS)
+$(MODULE).so: $(OBJS) $(RC_SRCS:.rc=.res) Makefile.in
+ $(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -mconsole $(OBJS) $(RC_SRCS:.rc=.res) -o $@ $(LIBPORT) $(ALL_LIBS)
# Rules for .exe main module
$(MODULE): $(OBJS) $(RCOBJS) Makefile.in
- $(CC) $(OBJS) $(RCOBJS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(ALL_LIBS)
+ $(CC) $(OBJS) $(RCOBJS) -o $@ $(ALL_LIBS)
# Rules for building test list
-$(TESTLIST): Makefile.in
- $(TOPSRCDIR)/programs/winetest/make_ctests $(CTESTS) >$(TESTLIST) || $(RM) $(TESTLIST)
+testlist.c: Makefile.in $(MAKECTESTS)
+ $(MAKECTESTS) -o $@ $(CTESTS)
-# Rules for checking that no imports are missing
+testlist.o: testlist.c $(TOPSRCDIR)/include/wine/test.h
-CHECKLINK_RPATH = library tsx11 unicode
+# Rules for testing
-checklink:: $(MODULE).so $(SUBDIRS:%=%/__checklink__)
- $(CC) -o checklink $(CHECKLINK_RPATH:%=-Wl,-rpath,$(TOPOBJDIR)/%) $(TOPSRCDIR)/library/checklink.c $(MODULE).so && $(RM) checklink
+check test:: $(TESTRESULTS)
-# Rules for testing
+$(TESTRESULTS): $(MODULE)$(DLLEXT) ../$(TESTDLL)$(DLLEXT)
-check test:: $(TESTRESULTS) $(SUBDIRS:%=%/__test__)
+# Rules for cross-compiling tests
-$(TESTRESULTS): $(MODULE)$(DLLEXT) $(TOPOBJDIR)/dlls/$(TESTDLL)$(DLLEXT)
+.SUFFIXES: .cross.o .res.cross.o
-$(TESTMAIN):
- cd $(TOPOBJDIR)/programs/winetest && $(MAKE) wtmain.o
+.c.cross.o:
+ $(CROSSCC) -c $(ALLCFLAGS) -o $@ $<
-# Rules for cross-compiling tests
+.res.res.cross.o:
+ $(CROSSWINDRES) -i $< -o $@
crosstest:: @CROSSTEST@
$(CROSSTEST): $(CROSSOBJS) Makefile.in
- $(CROSSCC) $(CROSSOBJS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(LIBS)
+ $(CROSSCC) $(CROSSOBJS) -o $@ $(ALL_LIBS)
-$(CROSSTESTMAIN):
- cd $(TOPOBJDIR)/programs/winetest && $(MAKE) wtmain.cross.o
+$(CROSSOBJS): $(IDL_GEN_HEADERS)
# Rules for cleaning
$(RM) $(TESTRESULTS)
clean::
- $(RM) $(MODULE) $(TESTLIST) $(TESTRESULTS) $(CROSSTEST)
+ $(RM) testlist.c $(MODULE) $(TESTRESULTS) $(CROSSTEST)