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 INSTALLDIRS = $(DESTDIR)$(dlldir) $(DESTDIR)$(fakedlldir) $(DESTDIR)$(datadir)/wine
23 all: $(MODULE)$(DLLEXT) $(MODULE)$(FAKEEXT)
25 $(MODULE) $(MODULE).so $(MODULE).fake: $(MAINSPEC) $(OBJS) Makefile.in
26 $(WINEGCC) -shared $(srcdir)/$(MAINSPEC) $(OBJS) $(EXTRADLLFLAGS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(DELAYIMPORTS:%=-Wb,-d%) $(ALL_LIBS)
28 # Rules for import libraries
30 IMPLIB_CROSSOBJS = $(IMPLIB_OBJS:.o=.cross.o)
32 .PHONY: $(IMPLIB_SRCS:%=__static_implib__%)
34 all: $(IMPORTLIBFILE) $(IMPLIB_SRCS:%=__static_implib__%) @CROSSTEST_DISABLE@ $(IMPORTLIB:%=lib%.cross.a)
36 $(IMPLIB_SRCS:%=__static_implib__%): $(STATICIMPLIB)
38 $(IMPORTLIB:%=lib%.def): $(MAINSPEC)
39 $(WINEBUILD) $(IMPLIBFLAGS) -w --def -o $@ --export $(srcdir)/$(MAINSPEC)
41 $(IMPORTLIB:%=lib%.def.a): $(IMPLIB_OBJS)
43 $(AR) $(ARFLAGS) $@ $(IMPLIB_OBJS)
46 $(IMPORTLIB:%=lib%.a): $(MAINSPEC) $(IMPLIB_OBJS)
47 $(WINEBUILD) $(IMPLIBFLAGS) -w --implib -o $@ --export $(srcdir)/$(MAINSPEC) $(IMPLIB_OBJS)
49 $(IMPORTLIB:%=lib%.cross.a): $(MAINSPEC) $(IMPLIB_CROSSOBJS)
50 $(WINEBUILD) $(IMPLIBFLAGS) $(CROSSTARGET:%=-b %) -w --implib -o $@ --export $(srcdir)/$(MAINSPEC) $(IMPLIB_CROSSOBJS)
52 # Rules for auto documentation
54 manpages:: $(C_SRCS) dummy
55 $(C2MAN) -o $(top_builddir)/documentation/man$(api_manext) -R$(top_builddir) -C$(srcdir) -S$(api_manext) $(INCLUDES) $(MAINSPEC:%=-w %) $(C_SRCS)
57 htmlpages:: $(C_SRCS) dummy
58 $(C2MAN) -o $(top_builddir)/documentation/html -R$(top_builddir) -C$(srcdir) $(INCLUDES) -Th $(MAINSPEC:%=-w %) $(C_SRCS)
60 sgmlpages:: $(C_SRCS) dummy
61 $(C2MAN) -o $(top_builddir)/documentation/api-guide -R$(top_builddir) -C$(srcdir) $(INCLUDES) -Ts $(MAINSPEC:%=-w %) $(C_SRCS)
63 xmlpages:: $(C_SRCS) dummy
64 $(C2MAN) -o $(top_builddir)/documentation/api-guide-xml -R$(top_builddir) -C$(srcdir) $(INCLUDES) -Tx $(MAINSPEC:%=-w %) $(C_SRCS)
66 # Rules for installation
68 .PHONY: install_static_implib_def install_static_implib_a
69 .PHONY: $(IMPORTLIB:%=_install_/%) $(IMPLIB_SRCS:%=_install_static_implib_/%)
71 $(IMPORTLIB:%=_install_/%): $(IMPORTLIBFILE) $(DESTDIR)$(dlldir) dummy
72 $(INSTALL_DATA) $(IMPORTLIBFILE) $(DESTDIR)$(dlldir)/$(IMPORTLIBFILE)
74 install_static_implib_def: $(STATICIMPLIB) $(DESTDIR)$(dlldir) dummy
75 $(INSTALL_DATA) $(STATICIMPLIB) $(DESTDIR)$(dlldir)/$(STATICIMPLIB)
77 install_static_implib_a:
79 $(IMPLIB_SRCS:%=_install_static_implib_/%): install_static_implib_$(IMPLIBEXT)
81 .PHONY: install_dll install_dll.so install_dll.fake
83 install_dll: $(MODULE) $(DESTDIR)$(dlldir) dummy
84 $(INSTALL_PROGRAM) $(MODULE) $(DESTDIR)$(dlldir)/$(MODULE)
86 install_dll.so: $(MODULE).so $(DESTDIR)$(dlldir) dummy
87 $(INSTALL_PROGRAM) $(MODULE).so $(DESTDIR)$(dlldir)/$(MODULE).so
89 install_dll.fake: $(MODULE).fake $(DESTDIR)$(fakedlldir) dummy
90 $(INSTALL_DATA) $(MODULE).fake $(DESTDIR)$(fakedlldir)/$(MODULE)
92 install install-lib:: install_dll$(DLLEXT) install_dll$(FAKEEXT)
94 install install-dev:: $(IMPORTLIB:%=_install_/%) $(IMPLIB_SRCS:%=_install_static_implib_/%) dummy
97 -cd $(DESTDIR)$(dlldir) && $(RM) $(MODULE)$(DLLEXT) $(IMPORTLIBFILE) $(STATICIMPLIB)
98 $(RM) $(DESTDIR)$(fakedlldir)/$(MODULE)
103 $(RM) $(IMPORTLIBFILE)
105 # End of global dll rules