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
13 DEFS = -D__WINESRC__ $(EXTRADEFS)
14 BASEMODULE = $(MODULE:%.dll=%)
15 MAINSPEC = $(BASEMODULE).spec
16 SPEC_DEF = $(BASEMODULE).def
17 WIN16_FILES = $(SPEC_SRCS16:.spec=.spec.o) $(C_SRCS16:.c=.o) $(EXTRA_OBJS16)
18 ALL_OBJS = @WIN16_FILES@ $(OBJS)
19 ALL_LIBS = $(LIBPORT) $(EXTRALIBS) $(LDFLAGS) $(LIBS)
20 IMPLIB_OBJS = $(IMPLIB_SRCS:.c=.o)
21 IMPORTLIBFILE = $(IMPORTLIB:%=lib%.@IMPLIBEXT@)
22 STATICIMPLIB = $(IMPORTLIBFILE:.def=.def.a)
23 DLL_LDPATH = -L$(DLLDIR) $(DELAYIMPORTS:%=-L$(DLLDIR)/%) $(IMPORTS:%=-L$(DLLDIR)/%)
24 INSTALLDIRS = $(DESTDIR)$(dlldir) $(DESTDIR)$(fakedlldir) $(DESTDIR)$(datadir)/wine
28 all: $(MODULE)$(DLLEXT) $(MODULE)$(FAKEEXT) $(SUBDIRS)
30 $(MODULE) $(MODULE).so $(MODULE).fake: $(MAINSPEC) $(ALL_OBJS) Makefile.in
31 $(WINEGCC) -shared $(SRCDIR)/$(MAINSPEC) $(ALL_OBJS) $(EXTRADLLFLAGS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(DELAYIMPORTS:%=-Wb,-d%) $(ALL_LIBS)
33 # Rules for import libraries
35 .PHONY: implib $(IMPLIB_SRCS:%=__static_implib__%)
37 all implib: $(IMPORTLIBFILE) $(IMPLIB_SRCS:%=__static_implib__%)
39 $(IMPLIB_SRCS:%=__static_implib__%): $(STATICIMPLIB)
41 $(SPEC_DEF) $(IMPORTLIB:%=lib%.def): $(MAINSPEC)
42 $(WINEBUILD) $(TARGETFLAGS) -w --def -o $@ --export $(SRCDIR)/$(MAINSPEC)
44 $(IMPORTLIB:%=lib%.def.a): $(IMPLIB_OBJS)
46 $(AR) $(ARFLAGS) $@ $(IMPLIB_OBJS)
49 $(IMPORTLIB:%=lib%.a): $(SPEC_DEF) $(IMPLIB_OBJS)
50 $(DLLTOOL) -k -l $@ -d $(SPEC_DEF)
51 $(MINGWAR) rs $@ $(IMPLIB_OBJS)
57 check test:: $(SUBDIRS:%=%/__test__) dummy
59 crosstest:: $(SUBDIRS:%=%/__crosstest__) dummy
61 # Rules for auto documentation
64 $(C2MAN) -o $(TOPOBJDIR)/documentation/man$(api_manext) -R$(TOPOBJDIR) -C$(SRCDIR) -S$(api_manext) $(INCLUDES) $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
66 doc-html: $(C_SRCS) dummy
67 $(C2MAN) -o $(TOPOBJDIR)/documentation/html -R$(TOPOBJDIR) -C$(SRCDIR) $(INCLUDES) -Th $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
69 doc-sgml: $(C_SRCS) dummy
70 $(C2MAN) -o $(TOPOBJDIR)/documentation/api-guide -R$(TOPOBJDIR) -C$(SRCDIR) $(INCLUDES) -Ts $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
72 doc-xml: $(C_SRCS) dummy
73 $(C2MAN) -o $(TOPOBJDIR)/documentation/api-guide-xml -R$(TOPOBJDIR) -C$(SRCDIR) $(INCLUDES) -Tx $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
75 .PHONY: man doc-html doc-sgml doc-xml
77 # Rules for installation
79 .PHONY: install_static_implib_def install_static_implib_a
80 .PHONY: $(IMPORTLIB:%=_install_/%) $(IMPLIB_SRCS:%=_install_static_implib_/%)
82 $(IMPORTLIB:%=_install_/%): $(IMPORTLIBFILE) $(DESTDIR)$(dlldir) dummy
83 $(INSTALL_DATA) $(IMPORTLIBFILE) $(DESTDIR)$(dlldir)/$(IMPORTLIBFILE)
85 install_static_implib_def: $(STATICIMPLIB) $(DESTDIR)$(dlldir) dummy
86 $(INSTALL_DATA) $(STATICIMPLIB) $(DESTDIR)$(dlldir)/$(STATICIMPLIB)
88 install_static_implib_a:
90 $(IMPLIB_SRCS:%=_install_static_implib_/%): install_static_implib_$(IMPLIBEXT)
92 .PHONY: install_dll install_dll.so install_dll.fake
94 install_dll: $(MODULE) $(DESTDIR)$(dlldir) dummy
95 $(INSTALL_PROGRAM) $(MODULE) $(DESTDIR)$(dlldir)/$(MODULE)
97 install_dll.so: $(MODULE).so $(DESTDIR)$(dlldir) dummy
98 $(INSTALL_PROGRAM) $(MODULE).so $(DESTDIR)$(dlldir)/$(MODULE).so
100 install_dll.fake: $(MODULE).fake $(DESTDIR)$(fakedlldir) dummy
101 $(INSTALL_DATA) $(MODULE).fake $(DESTDIR)$(fakedlldir)/$(MODULE)
103 install install-lib:: install_dll$(DLLEXT) install_dll$(FAKEEXT)
105 install install-dev:: $(IMPORTLIB:%=_install_/%) $(IMPLIB_SRCS:%=_install_static_implib_/%) dummy
108 -cd $(DESTDIR)$(dlldir) && $(RM) $(MODULE)$(DLLEXT) $(IMPORTLIBFILE) $(STATICIMPLIB)
109 $(RM) $(DESTDIR)$(fakedlldir)/$(MODULE)
114 $(RM) $(SPEC_DEF) $(IMPORTLIBFILE)
116 $(SPEC_DEF) $(SPEC_SRCS16:.spec=.spec.o): $(WINEBUILD)
118 # End of global dll rules