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
14 DEFS = -D__WINESRC__ $(EXTRADEFS)
15 BASEMODULE = $(MODULE:%.dll=%)
16 MAINSPEC = $(BASEMODULE).spec
17 SPEC_DEF = $(BASEMODULE).def
18 WIN16_FILES = $(SPEC_SRCS16:.spec=.spec.o) $(C_SRCS16:.c=.o) $(EXTRA_OBJS16)
19 ALL_OBJS = @WIN16_FILES@ $(OBJS)
20 ALL_LIBS = $(LIBPORT) $(EXTRALIBS) $(LDFLAGS) $(LIBS)
21 IMPLIB_OBJS = $(IMPLIB_SRCS:.c=.o)
22 IMPORTLIBFILE = $(IMPORTLIB:%=lib%.@IMPLIBEXT@)
23 STATICIMPLIB = $(IMPORTLIBFILE:.def=.def.a)
24 DLL_LDPATH = -L$(DLLDIR) $(DELAYIMPORTS:%=-L$(DLLDIR)/%) $(IMPORTS:%=-L$(DLLDIR)/%)
25 INSTALLDIRS = $(DESTDIR)$(dlldir) $(DESTDIR)$(datadir)/wine
27 all: $(MODULE)$(DLLEXT) $(SUBDIRS)
31 $(MODULE) $(MODULE).so: $(MAINSPEC) $(ALL_OBJS) Makefile.in
32 $(WINEGCC) -shared $(SRCDIR)/$(MAINSPEC) $(ALL_OBJS) $(EXTRADLLFLAGS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(DELAYIMPORTS:%=-Wb,-d%) $(ALL_LIBS)
34 # Rules for import libraries
36 .PHONY: implib $(IMPLIB_SRCS:%=__static_implib__%)
38 all implib: $(IMPORTLIBFILE) $(IMPLIB_SRCS:%=__static_implib__%)
40 $(IMPLIB_SRCS:%=__static_implib__%): $(STATICIMPLIB)
42 $(SPEC_DEF) $(IMPORTLIB:%=lib%.def): $(MAINSPEC)
43 $(WINEBUILD) $(TARGETFLAGS) -w --def -o $@ --export $(SRCDIR)/$(MAINSPEC)
45 $(IMPORTLIB:%=lib%.def.a): $(IMPLIB_OBJS)
47 $(AR) $(ARFLAGS) $@ $(IMPLIB_OBJS)
50 $(IMPORTLIB:%=lib%.a): $(SPEC_DEF) $(IMPLIB_OBJS)
51 $(DLLTOOL) -k -l $@ -d $(SPEC_DEF)
52 $(MINGWAR) rs $@ $(IMPLIB_OBJS)
58 check test:: $(SUBDIRS:%=%/__test__) dummy
60 crosstest:: $(SUBDIRS:%=%/__crosstest__) dummy
62 # Rules for auto documentation
65 $(C2MAN) -o $(TOPOBJDIR)/documentation/man$(api_manext) -R$(TOPOBJDIR) -C$(SRCDIR) -S$(api_manext) $(INCLUDES) $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
67 doc-html: $(C_SRCS) dummy
68 $(C2MAN) -o $(TOPOBJDIR)/documentation/html -R$(TOPOBJDIR) -C$(SRCDIR) $(INCLUDES) -Th $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
70 doc-sgml: $(C_SRCS) dummy
71 $(C2MAN) -o $(TOPOBJDIR)/documentation/api-guide -R$(TOPOBJDIR) -C$(SRCDIR) $(INCLUDES) -Ts $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
73 doc-xml: $(C_SRCS) dummy
74 $(C2MAN) -o $(TOPOBJDIR)/documentation/api-guide-xml -R$(TOPOBJDIR) -C$(SRCDIR) $(INCLUDES) -Tx $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
76 .PHONY: man doc-html doc-sgml doc-xml
78 # Rules for installation
80 .PHONY: install_static_implib_def install_static_implib_a
81 .PHONY: $(IMPORTLIB:%=_install_/%) $(IMPLIB_SRCS:%=_install_static_implib_/%)
83 $(IMPORTLIB:%=_install_/%): $(IMPORTLIBFILE) $(DESTDIR)$(dlldir) dummy
84 $(INSTALL_DATA) $(IMPORTLIBFILE) $(DESTDIR)$(dlldir)/$(IMPORTLIBFILE)
86 install_static_implib_def: $(STATICIMPLIB) $(DESTDIR)$(dlldir) dummy
87 $(INSTALL_DATA) $(STATICIMPLIB) $(DESTDIR)$(dlldir)/$(STATICIMPLIB)
89 install_static_implib_a:
91 $(IMPLIB_SRCS:%=_install_static_implib_/%): install_static_implib_$(IMPLIBEXT)
93 install install-lib:: $(MODULE)$(DLLEXT) $(DESTDIR)$(dlldir) dummy
94 $(INSTALL_PROGRAM) $(MODULE)$(DLLEXT) $(DESTDIR)$(dlldir)/$(MODULE)$(DLLEXT)
96 install install-dev:: $(IMPORTLIB:%=_install_/%) $(IMPLIB_SRCS:%=_install_static_implib_/%) dummy
99 -cd $(DESTDIR)$(dlldir) && $(RM) $(MODULE)$(DLLEXT) $(IMPORTLIBFILE) $(STATICIMPLIB)
104 $(RM) $(SPEC_DEF) $(IMPORTLIBFILE)
106 $(SPEC_DEF) $(SPEC_SRCS16:.spec=.spec.o): $(WINEBUILD)
108 # End of global dll rules