# Each individual makefile should define the following variables:
# MODULE : name of the main module being built
# EXTRALIBS : extra libraries to link in (optional)
-# SPEC_SRCS16 : interface definition files for 16-bit dlls (optional)
-# SUBSYSTEM : (optional) subsystem (for native dlls)
#
# plus all variables required by the global Make.rules.in
#
-DLLDEFS = @DLLDEFS@
DLLFLAGS = @DLLFLAGS@
-DLLEXT = @DLLEXT@
-IMPLIBEXT = @IMPLIBEXT@
-DEFS = -D__WINESRC__ $(DLLDEFS) $(EXTRADEFS)
+DEFS = -D__WINESRC__ $(EXTRADEFS)
BASEMODULE = $(MODULE:%.dll=%)
MAINSPEC = $(BASEMODULE).spec
-SPEC_DEF = lib$(BASEMODULE).def
-WIN16_FILES = $(SPEC_SRCS16:.spec=.spec.o) $(C_SRCS16:.c=.o) $(EXTRA_OBJS16)
-ALL_OBJS = @WIN16_FILES@ $(OBJS) $(MODULE).dbg.o $(RC_SRCS:.rc=.res)
-ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBPORT) $(LDFLAGS) $(LIBS)
-ALL_IMPORTS = $(DELAYIMPORTS) $(IMPORTS)
+ALL_LIBS = $(LIBPORT) $(EXTRALIBS) $(LDFLAGS) $(LIBS)
IMPLIB_OBJS = $(IMPLIB_SRCS:.c=.o)
-STATICIMPLIB= $(IMPORTLIB:.def=.def.a)
-DLL_LDPATH = -L$(DLLDIR) $(ALL_IMPORTS:%=-L$(DLLDIR)/%)
-
-all: $(MODULE)$(DLLEXT) $(SUBDIRS)
+IMPLIBFLAGS = $(TARGETFLAGS) $(EXTRAIMPLIBFLAGS)
+IMPORTLIBFILE = $(IMPORTLIB:%=lib%.@IMPLIBEXT@)
+STATICIMPLIB = $(IMPORTLIBFILE:.def=.def.a)
+INSTALLDIRS = $(DESTDIR)$(dlldir) $(DESTDIR)$(fakedlldir) $(DESTDIR)$(datadir)/wine
@MAKE_RULES@
-# Rules for .so files
-
-$(MODULE).so: $(MAINSPEC) $(ALL_OBJS) Makefile.in
- $(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -shared $(SRCDIR)/$(MAINSPEC) $(ALL_OBJS) $(SUBSYSTEM:%=-Wb,--subsystem,%) $(BASEADDRESS:%=-Wl,--image-base,%) -o $@ $(DLL_LDPATH) $(ALL_IMPORTS:%=-l%) $(DELAYIMPORTS:%=-Wb,-d%) $(ALL_LIBS)
-
-# Rules for .dll files
+all: $(MODULE)$(DLLEXT) $(MODULE)$(FAKEEXT)
-$(MODULE): $(RCOBJS) $(OBJS) $(MODULE).dbg.o $(SPEC_DEF) Makefile.in
- $(DLLWRAP) -k --def $(SPEC_DEF) -o $@ $(RCOBJS) $(OBJS) $(MODULE).dbg.o $(DLL_LDPATH) $(ALL_IMPORTS:%=-l%) $(ALL_LIBS)
+$(MODULE) $(MODULE).so $(MODULE).fake: $(MAINSPEC) $(OBJS) Makefile.in
+ $(WINEGCC) -shared $(srcdir)/$(MAINSPEC) $(OBJS) $(EXTRADLLFLAGS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(DELAYIMPORTS:%=-Wb,-d%) $(ALL_LIBS)
# Rules for import libraries
-.PHONY: implib static_implib $(IMPLIB_OBJS:%=__static_implib__%)
+IMPLIB_CROSSOBJS = $(IMPLIB_OBJS:.o=.cross.o)
-all implib: $(IMPORTLIB) $(IMPLIB_OBJS:%=__static_implib__%)
+.PHONY: $(IMPLIB_SRCS:%=__static_implib__%)
-$(IMPLIB_OBJS:%=__static_implib__%): $(STATICIMPLIB)
+all: $(IMPORTLIBFILE) $(IMPLIB_SRCS:%=__static_implib__%) @CROSSTEST_DISABLE@ $(IMPORTLIB:%=lib%.cross.a)
-lib$(BASEMODULE).def: $(MAINSPEC)
- $(WINEBUILD) -w --def -o $@ --export $(SRCDIR)/$(MAINSPEC)
+$(IMPLIB_SRCS:%=__static_implib__%): $(STATICIMPLIB)
-lib$(BASEMODULE).def.a: $(IMPLIB_OBJS)
- $(RM) $@
- $(AR) $@ $(IMPLIB_OBJS)
- $(RANLIB) $@
+$(IMPORTLIB:%=lib%.def): $(MAINSPEC)
+ $(WINEBUILD) $(IMPLIBFLAGS) -w --def -o $@ --export $(srcdir)/$(MAINSPEC)
-lib$(BASEMODULE).a: $(SPEC_DEF) $(IMPLIB_OBJS)
- $(DLLTOOL) -k -l $@ -d $(SPEC_DEF)
- $(AR) $@ $(IMPLIB_OBJS)
+$(IMPORTLIB:%=lib%.def.a): $(IMPLIB_OBJS)
+ $(RM) $@
+ $(AR) $(ARFLAGS) $@ $(IMPLIB_OBJS)
$(RANLIB) $@
-# Rules for checking that no imports are missing
-
-.PHONY: checklink16 $(WIN16_FILES:%=__checklink16__%)
-
-$(WIN16_FILES:%=__checklink16__%): checklink16
-
-checklink16:: $(MAINSPEC).o $(OBJS) $(MODULE).dbg.o dummy
- $(CC) -o checklink -Wl,-rpath,$(TOPOBJDIR)/libs $(TOPSRCDIR)/dlls/checklink.c $(MAINSPEC).o $(OBJS) $(MODULE).dbg.o -L$(DLLDIR) $(ALL_LIBS) -lm && $(RM) checklink $(MAINSPEC).c $(MAINSPEC).o
+$(IMPORTLIB:%=lib%.a): $(MAINSPEC) $(IMPLIB_OBJS)
+ $(WINEBUILD) $(IMPLIBFLAGS) -w --implib -o $@ --export $(srcdir)/$(MAINSPEC) $(IMPLIB_OBJS)
-checklink:: $(WIN16_FILES:%=__checklink16__%)
-
-# Rules for testing
-
-check test:: $(SUBDIRS:%=%/__test__)
-
-crosstest:: $(SUBDIRS:%=%/__crosstest__)
-
-# Rule to explicitly generate the .spec.c for debugging
-
-$(MAINSPEC).c: $(MAINSPEC) $(ALL_OBJS)
- $(WINEBUILD) $(DEFS) $(DLLFLAGS) --dll -o $@ --export $(SRCDIR)/$(MAINSPEC) $(SUBSYSTEM:%=--subsystem %) $(ALL_OBJS) $(DLL_LDPATH) $(ALL_IMPORTS:%=-l%) $(DELAYIMPORTS:%=-d%)
+$(IMPORTLIB:%=lib%.cross.a): $(MAINSPEC) $(IMPLIB_CROSSOBJS)
+ $(WINEBUILD) $(IMPLIBFLAGS) $(CROSSTARGET:%=-b %) -w --implib -o $@ --export $(srcdir)/$(MAINSPEC) $(IMPLIB_CROSSOBJS)
# Rules for auto documentation
-man: $(C_SRCS)
- $(C2MAN) -o $(TOPOBJDIR)/documentation/man$(api_manext) -R$(TOPOBJDIR) -C$(SRCDIR) -S$(api_manext) $(INCLUDES) $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
+manpages:: $(C_SRCS) dummy
+ $(C2MAN) -o $(top_builddir)/documentation/man$(api_manext) -R$(top_builddir) -C$(srcdir) -S$(api_manext) $(INCLUDES) $(MAINSPEC:%=-w %) $(C_SRCS)
-doc-html: $(C_SRCS)
- $(C2MAN) -o $(TOPOBJDIR)/documentation/html -R$(TOPOBJDIR) -C$(SRCDIR) $(INCLUDES) -Th $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
+htmlpages:: $(C_SRCS) dummy
+ $(C2MAN) -o $(top_builddir)/documentation/html -R$(top_builddir) -C$(srcdir) $(INCLUDES) -Th $(MAINSPEC:%=-w %) $(C_SRCS)
-doc-sgml: $(C_SRCS)
- $(C2MAN) -o $(TOPOBJDIR)/documentation/api-guide -R$(TOPOBJDIR) -C$(SRCDIR) $(INCLUDES) -Ts $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
+sgmlpages:: $(C_SRCS) dummy
+ $(C2MAN) -o $(top_builddir)/documentation/api-guide -R$(top_builddir) -C$(srcdir) $(INCLUDES) -Ts $(MAINSPEC:%=-w %) $(C_SRCS)
-.PHONY: man doc-html doc-sgml
+xmlpages:: $(C_SRCS) dummy
+ $(C2MAN) -o $(top_builddir)/documentation/api-guide-xml -R$(top_builddir) -C$(srcdir) $(INCLUDES) -Tx $(MAINSPEC:%=-w %) $(C_SRCS)
# Rules for installation
-EXE_SPECS16 = $(SPEC_SRCS16:.exe.spec=.exe)
-DRV_SPECS16 = $(EXE_SPECS16:.drv.spec=.drv)
-ALL_SPECS16 = $(DRV_SPECS16:.spec=.dll)
+.PHONY: install_static_implib_def install_static_implib_a
+.PHONY: $(IMPORTLIB:%=_install_/%) $(IMPLIB_SRCS:%=_install_static_implib_/%)
-WIN16_INSTALL = $(ALL_SPECS16:%=_install_/%)
+$(IMPORTLIB:%=_install_/%): $(IMPORTLIBFILE) $(DESTDIR)$(dlldir) dummy
+ $(INSTALL_DATA) $(IMPORTLIBFILE) $(DESTDIR)$(dlldir)/$(IMPORTLIBFILE)
-.PHONY: install_lib install_static_implib_def install_static_implib_a
-.PHONY: $(ALL_SPECS16:%=_install_/%) $(IMPORTLIB:%=_install_/%) $(IMPLIB_OBJS:%=_install_static_implib_/%)
+install_static_implib_def: $(STATICIMPLIB) $(DESTDIR)$(dlldir) dummy
+ $(INSTALL_DATA) $(STATICIMPLIB) $(DESTDIR)$(dlldir)/$(STATICIMPLIB)
-$(ALL_SPECS16:%=_install_/%): install_lib
- cd $(dlldir) && $(RM) `basename $@`$(DLLEXT) && $(LN_S) $(MODULE)$(DLLEXT) `basename $@`$(DLLEXT)
+install_static_implib_a:
-install_lib: $(MODULE)$(DLLEXT)
- $(MKINSTALLDIRS) $(dlldir)
- $(INSTALL_PROGRAM) $(MODULE)$(DLLEXT) $(dlldir)/$(MODULE)$(DLLEXT)
+$(IMPLIB_SRCS:%=_install_static_implib_/%): install_static_implib_$(IMPLIBEXT)
-$(IMPORTLIB:%=_install_/%): $(IMPORTLIB)
- $(MKINSTALLDIRS) $(dlldir)
- $(INSTALL_DATA) $(IMPORTLIB) $(dlldir)/$(IMPORTLIB)
+.PHONY: install_dll install_dll.so install_dll.fake
-install_static_implib_def: $(STATICIMPLIB)
- $(MKINSTALLDIRS) $(dlldir)
- $(INSTALL_DATA) $(STATICIMPLIB) $(dlldir)/$(STATICIMPLIB)
+install_dll: $(MODULE) $(DESTDIR)$(dlldir) dummy
+ $(INSTALL_PROGRAM) $(MODULE) $(DESTDIR)$(dlldir)/$(MODULE)
-install_static_implib_a:
+install_dll.so: $(MODULE).so $(DESTDIR)$(dlldir) dummy
+ $(INSTALL_PROGRAM) $(MODULE).so $(DESTDIR)$(dlldir)/$(MODULE).so
-$(IMPLIB_OBJS:%=_install_static_implib_/%): install_static_implib_$(IMPLIBEXT)
+install_dll.fake: $(MODULE).fake $(DESTDIR)$(fakedlldir) dummy
+ $(INSTALL_DATA) $(MODULE).fake $(DESTDIR)$(fakedlldir)/$(MODULE)
-install install-lib:: install_lib @WIN16_INSTALL@
+install install-lib:: install_dll$(DLLEXT) install_dll$(FAKEEXT)
-install install-dev:: $(IMPORTLIB:%=_install_/%) $(IMPLIB_OBJS:%=_install_static_implib_/%)
+install install-dev:: $(IMPORTLIB:%=_install_/%) $(IMPLIB_SRCS:%=_install_static_implib_/%) dummy
uninstall::
- [ ! -d $(dlldir) ] || (cd $(dlldir) && $(RM) $(MODULE)$(DLLEXT) $(IMPORTLIB) $(STATICIMPLIB) $(ALL_SPECS16:%=%$(DLLEXT)))
+ -cd $(DESTDIR)$(dlldir) && $(RM) $(MODULE)$(DLLEXT) $(IMPORTLIBFILE) $(STATICIMPLIB)
+ $(RM) $(DESTDIR)$(fakedlldir)/$(MODULE)
# Misc. rules
clean::
- $(RM) $(SPEC_DEF)
-
-$(SPEC_DEF) $(SPEC_SRCS16:.spec=.spec.c): $(WINEBUILD)
+ $(RM) $(IMPORTLIBFILE)
# End of global dll rules