1 # Global rules for building dlls -*-Makefile-*-
3 # Each individual makefile should define the following variables:
4 # MODULE : name of the main module being built
5 # EXTRALIBS : extra libraries to link in (optional)
7 # plus all variables required by the global Make.rules.in
11 DEFS = -D__WINESRC__ $(EXTRADEFS)
12 BASEMODULE = $(MODULE:%.dll=%)
13 MAINSPEC = $(BASEMODULE).spec
14 ALL_LIBS = $(LIBPORT) $(EXTRALIBS) $(LDFLAGS) $(LIBS)
15 IMPLIB_OBJS = $(IMPLIB_SRCS:.c=.o)
16 IMPLIBFLAGS = $(TARGETFLAGS) $(EXTRAIMPLIBFLAGS)
17 IMPORTLIBFILE = $(IMPORTLIB:%=lib%.@IMPLIBEXT@)
18 STATICIMPLIB = $(IMPORTLIBFILE:.def=.def.a)
19 DLL_LDPATH = -L$(DLLDIR) $(DELAYIMPORTS:%=-L$(DLLDIR)/%) $(IMPORTS:%=-L$(DLLDIR)/%)
20 INSTALLDIRS = $(DESTDIR)$(dlldir) $(DESTDIR)$(fakedlldir) $(DESTDIR)$(datadir)/wine
24 all: $(MODULE)$(DLLEXT) $(MODULE)$(FAKEEXT) $(SUBDIRS)
26 $(MODULE) $(MODULE).so $(MODULE).fake: $(MAINSPEC) $(OBJS) Makefile.in
27 $(WINEGCC) -shared $(SRCDIR)/$(MAINSPEC) $(OBJS) $(EXTRADLLFLAGS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(DELAYIMPORTS:%=-Wb,-d%) $(ALL_LIBS)
29 # Rules for import libraries
31 .PHONY: implib $(IMPLIB_SRCS:%=__static_implib__%)
33 all implib: $(IMPORTLIBFILE) $(IMPLIB_SRCS:%=__static_implib__%)
35 $(IMPLIB_SRCS:%=__static_implib__%): $(STATICIMPLIB)
37 $(IMPORTLIB:%=lib%.def): $(MAINSPEC)
38 $(WINEBUILD) $(IMPLIBFLAGS) -w --def -o $@ --export $(SRCDIR)/$(MAINSPEC)
40 $(IMPORTLIB:%=lib%.def.a): $(IMPLIB_OBJS)
42 $(AR) $(ARFLAGS) $@ $(IMPLIB_OBJS)
45 $(IMPORTLIB:%=lib%.a): $(MAINSPEC) $(IMPLIB_OBJS)
46 $(WINEBUILD) $(IMPLIBFLAGS) @CROSSTARGETFLAGS@ -w --implib -o $@ --export $(SRCDIR)/$(MAINSPEC) $(IMPLIB_OBJS)
52 check test:: $(SUBDIRS:%=%/__test__) dummy
54 crosstest:: $(SUBDIRS:%=%/__crosstest__) dummy
56 # Rules for auto documentation
59 $(C2MAN) -o $(TOPOBJDIR)/documentation/man$(api_manext) -R$(TOPOBJDIR) -C$(SRCDIR) -S$(api_manext) $(INCLUDES) $(MAINSPEC:%=-w %) $(C_SRCS)
61 doc-html: $(C_SRCS) dummy
62 $(C2MAN) -o $(TOPOBJDIR)/documentation/html -R$(TOPOBJDIR) -C$(SRCDIR) $(INCLUDES) -Th $(MAINSPEC:%=-w %) $(C_SRCS)
64 doc-sgml: $(C_SRCS) dummy
65 $(C2MAN) -o $(TOPOBJDIR)/documentation/api-guide -R$(TOPOBJDIR) -C$(SRCDIR) $(INCLUDES) -Ts $(MAINSPEC:%=-w %) $(C_SRCS)
67 doc-xml: $(C_SRCS) dummy
68 $(C2MAN) -o $(TOPOBJDIR)/documentation/api-guide-xml -R$(TOPOBJDIR) -C$(SRCDIR) $(INCLUDES) -Tx $(MAINSPEC:%=-w %) $(C_SRCS)
70 .PHONY: man doc-html doc-sgml doc-xml
72 # Rules for installation
74 .PHONY: install_static_implib_def install_static_implib_a
75 .PHONY: $(IMPORTLIB:%=_install_/%) $(IMPLIB_SRCS:%=_install_static_implib_/%)
77 $(IMPORTLIB:%=_install_/%): $(IMPORTLIBFILE) $(DESTDIR)$(dlldir) dummy
78 $(INSTALL_DATA) $(IMPORTLIBFILE) $(DESTDIR)$(dlldir)/$(IMPORTLIBFILE)
80 install_static_implib_def: $(STATICIMPLIB) $(DESTDIR)$(dlldir) dummy
81 $(INSTALL_DATA) $(STATICIMPLIB) $(DESTDIR)$(dlldir)/$(STATICIMPLIB)
83 install_static_implib_a:
85 $(IMPLIB_SRCS:%=_install_static_implib_/%): install_static_implib_$(IMPLIBEXT)
87 .PHONY: install_dll install_dll.so install_dll.fake
89 install_dll: $(MODULE) $(DESTDIR)$(dlldir) dummy
90 $(INSTALL_PROGRAM) $(MODULE) $(DESTDIR)$(dlldir)/$(MODULE)
92 install_dll.so: $(MODULE).so $(DESTDIR)$(dlldir) dummy
93 $(INSTALL_PROGRAM) $(MODULE).so $(DESTDIR)$(dlldir)/$(MODULE).so
95 install_dll.fake: $(MODULE).fake $(DESTDIR)$(fakedlldir) dummy
96 $(INSTALL_DATA) $(MODULE).fake $(DESTDIR)$(fakedlldir)/$(MODULE)
98 install install-lib:: install_dll$(DLLEXT) install_dll$(FAKEEXT)
100 install install-dev:: $(IMPORTLIB:%=_install_/%) $(IMPLIB_SRCS:%=_install_static_implib_/%) dummy
103 -cd $(DESTDIR)$(dlldir) && $(RM) $(MODULE)$(DLLEXT) $(IMPORTLIBFILE) $(STATICIMPLIB)
104 $(RM) $(DESTDIR)$(fakedlldir)/$(MODULE)
109 $(RM) $(IMPORTLIBFILE)
111 # End of global dll rules