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)
6 # SPEC_SRCS16 : interface definition files for 16-bit dlls (optional)
8 # plus all variables required by the global Make.rules.in
12 DEFS = -D__WINESRC__ $(EXTRADEFS)
13 BASEMODULE = $(MODULE:%.dll=%)
14 MAINSPEC = $(BASEMODULE).spec
15 WIN16_FILES = $(SPEC_SRCS16:.spec=.spec.o) $(C_SRCS16:.c=.o) $(EXTRA_OBJS16)
16 ALL_OBJS = @WIN16_FILES@ $(OBJS)
17 ALL_LIBS = $(LIBPORT) $(EXTRALIBS) $(LDFLAGS) $(LIBS)
18 IMPLIB_OBJS = $(IMPLIB_SRCS:.c=.o)
19 IMPLIBFLAGS = $(TARGETFLAGS) $(EXTRAIMPLIBFLAGS)
20 IMPORTLIBFILE = $(IMPORTLIB:%=lib%.@IMPLIBEXT@)
21 STATICIMPLIB = $(IMPORTLIBFILE:.def=.def.a)
22 DLL_LDPATH = -L$(DLLDIR) $(DELAYIMPORTS:%=-L$(DLLDIR)/%) $(IMPORTS:%=-L$(DLLDIR)/%)
23 INSTALLDIRS = $(DESTDIR)$(dlldir) $(DESTDIR)$(fakedlldir) $(DESTDIR)$(datadir)/wine
27 all: $(MODULE)$(DLLEXT) $(MODULE)$(FAKEEXT) $(SUBDIRS)
29 $(MODULE) $(MODULE).so $(MODULE).fake: $(MAINSPEC) $(ALL_OBJS) Makefile.in
30 $(WINEGCC) -shared $(SRCDIR)/$(MAINSPEC) $(ALL_OBJS) $(EXTRADLLFLAGS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(DELAYIMPORTS:%=-Wb,-d%) $(ALL_LIBS)
32 # Rules for import libraries
34 .PHONY: implib $(IMPLIB_SRCS:%=__static_implib__%)
36 all implib: $(IMPORTLIBFILE) $(IMPLIB_SRCS:%=__static_implib__%)
38 $(IMPLIB_SRCS:%=__static_implib__%): $(STATICIMPLIB)
40 $(IMPORTLIB:%=lib%.def): $(MAINSPEC)
41 $(WINEBUILD) $(IMPLIBFLAGS) -w --def -o $@ --export $(SRCDIR)/$(MAINSPEC)
43 $(IMPORTLIB:%=lib%.def.a): $(IMPLIB_OBJS)
45 $(AR) $(ARFLAGS) $@ $(IMPLIB_OBJS)
48 $(IMPORTLIB:%=lib%.a): $(MAINSPEC) $(IMPLIB_OBJS)
49 $(WINEBUILD) $(IMPLIBFLAGS) @CROSSTARGETFLAGS@ -w --implib -o $@ --export $(SRCDIR)/$(MAINSPEC) $(IMPLIB_OBJS)
55 check test:: $(SUBDIRS:%=%/__test__) dummy
57 crosstest:: $(SUBDIRS:%=%/__crosstest__) dummy
59 # Rules for auto documentation
62 $(C2MAN) -o $(TOPOBJDIR)/documentation/man$(api_manext) -R$(TOPOBJDIR) -C$(SRCDIR) -S$(api_manext) $(INCLUDES) $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
64 doc-html: $(C_SRCS) dummy
65 $(C2MAN) -o $(TOPOBJDIR)/documentation/html -R$(TOPOBJDIR) -C$(SRCDIR) $(INCLUDES) -Th $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
67 doc-sgml: $(C_SRCS) dummy
68 $(C2MAN) -o $(TOPOBJDIR)/documentation/api-guide -R$(TOPOBJDIR) -C$(SRCDIR) $(INCLUDES) -Ts $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
70 doc-xml: $(C_SRCS) dummy
71 $(C2MAN) -o $(TOPOBJDIR)/documentation/api-guide-xml -R$(TOPOBJDIR) -C$(SRCDIR) $(INCLUDES) -Tx $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
73 .PHONY: man doc-html doc-sgml doc-xml
75 # Rules for installation
77 .PHONY: install_static_implib_def install_static_implib_a
78 .PHONY: $(IMPORTLIB:%=_install_/%) $(IMPLIB_SRCS:%=_install_static_implib_/%)
80 $(IMPORTLIB:%=_install_/%): $(IMPORTLIBFILE) $(DESTDIR)$(dlldir) dummy
81 $(INSTALL_DATA) $(IMPORTLIBFILE) $(DESTDIR)$(dlldir)/$(IMPORTLIBFILE)
83 install_static_implib_def: $(STATICIMPLIB) $(DESTDIR)$(dlldir) dummy
84 $(INSTALL_DATA) $(STATICIMPLIB) $(DESTDIR)$(dlldir)/$(STATICIMPLIB)
86 install_static_implib_a:
88 $(IMPLIB_SRCS:%=_install_static_implib_/%): install_static_implib_$(IMPLIBEXT)
90 .PHONY: install_dll install_dll.so install_dll.fake
92 install_dll: $(MODULE) $(DESTDIR)$(dlldir) dummy
93 $(INSTALL_PROGRAM) $(MODULE) $(DESTDIR)$(dlldir)/$(MODULE)
95 install_dll.so: $(MODULE).so $(DESTDIR)$(dlldir) dummy
96 $(INSTALL_PROGRAM) $(MODULE).so $(DESTDIR)$(dlldir)/$(MODULE).so
98 install_dll.fake: $(MODULE).fake $(DESTDIR)$(fakedlldir) dummy
99 $(INSTALL_DATA) $(MODULE).fake $(DESTDIR)$(fakedlldir)/$(MODULE)
101 install install-lib:: install_dll$(DLLEXT) install_dll$(FAKEEXT)
103 install install-dev:: $(IMPORTLIB:%=_install_/%) $(IMPLIB_SRCS:%=_install_static_implib_/%) dummy
106 -cd $(DESTDIR)$(dlldir) && $(RM) $(MODULE)$(DLLEXT) $(IMPORTLIBFILE) $(STATICIMPLIB)
107 $(RM) $(DESTDIR)$(fakedlldir)/$(MODULE)
112 $(RM) $(IMPORTLIBFILE)
114 $(SPEC_DEF) $(SPEC_SRCS16:.spec=.spec.o): $(WINEBUILD)
116 # End of global dll rules