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 # ALTNAMES : alternate names for this dll (optional)
6 # EXTRALIBS : extra libraries to link in (optional)
7 # SPEC_SRCS16 : interface definition files for 16-bit dlls (optional)
8 # SUBSYSTEM : (optional) subsystem (for native dlls)
10 # plus all variables required by the global Make.rules.in
13 DEFS = -D__WINESRC__ $(EXTRADEFS)
16 MAINSPEC = $(MODULE:%.dll=%).spec
17 SPEC_DEF = $(MAINSPEC).def
18 WIN16_FILES = $(SPEC_SRCS16:.spec=.spec.o) $(C_SRCS16:.c=.o) $(EXTRA_OBJS16)
19 ALL_OBJS = @WIN16_FILES@ $(OBJS) $(MODULE).dbg.o
20 ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBPORT) $(LDFLAGS) $(LIBS)
21 IMPORTLIBS = $(DELAYIMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT)) $(IMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT))
23 all: $(MODULE)$(DLLEXT) $(SUBDIRS)
29 $(MODULE).so: $(MAINSPEC) $(RC_SRCS:.rc=.res) $(ALL_OBJS) $(IMPORTLIBS) Makefile.in
30 $(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -shared $(SRCDIR)/$(MAINSPEC) $(ALL_OBJS) $(RC_SRCS:.rc=.res) $(SUBSYSTEM:%=-Wb,--subsystem,%) -o $@ -L$(DLLDIR) $(DELAYIMPORTS:%=-Wb,-d%) $(IMPORTS:%=-l%) $(ALL_LIBS)
32 # Rules for .dll files
34 $(MODULE): $(RCOBJS) $(OBJS) $(MODULE).dbg.o $(SPEC_DEF) $(IMPORTLIBS) Makefile.in
35 $(DLLWRAP) -k --def $(SPEC_DEF) -o $@ $(RCOBJS) $(OBJS) $(MODULE).dbg.o -L$(DLLDIR) $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(ALL_LIBS)
37 $(SPEC_DEF): $(WINEBUILD)
39 # Rules for checking that no imports are missing
41 .PHONY: checklink16 $(WIN16_FILES:%=__checklink16__%)
43 $(WIN16_FILES:%=__checklink16__%): checklink16
45 checklink16:: $(MAINSPEC).o $(OBJS) $(MODULE).dbg.o dummy
46 $(CC) -o checklink -Wl,-rpath,$(TOPOBJDIR)/libs $(TOPSRCDIR)/dlls/checklink.c $(MAINSPEC).o $(OBJS) $(MODULE).dbg.o -L$(DLLDIR) $(ALL_LIBS) -lm && $(RM) checklink $(MAINSPEC).c $(MAINSPEC).o
48 checklink:: $(WIN16_FILES:%=__checklink16__%)
52 check test:: $(SUBDIRS:%=%/__test__)
54 crosstest:: $(SUBDIRS:%=%/__crosstest__)
56 # Rule to explicitly generate the .spec.c for debugging
58 $(MAINSPEC).c: $(MAINSPEC) $(RC_SRCS:.rc=.res) $(ALL_OBJS) $(IMPORTLIBS) $(WINEBUILD)
59 $(WINEBUILD) $(DEFS) $(DLLFLAGS) -o $@ --dll $(SRCDIR)/$(MAINSPEC) $(SUBSYSTEM:%=--subsystem %) $(RC_SRCS:.rc=.res) $(ALL_OBJS) -L$(DLLDIR) $(DELAYIMPORTS:%=-d%) $(IMPORTS:%=-l%)
61 # Rules for auto documentation
64 $(C2MAN) -o $(TOPOBJDIR)/documentation/man$(api_manext) -R$(TOPOBJDIR) -S$(api_manext) $(INCLUDES) $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
67 $(C2MAN) -o $(TOPOBJDIR)/documentation/html -R$(TOPOBJDIR) $(INCLUDES) -Th $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
70 $(C2MAN) -o $(TOPOBJDIR)/documentation/api-guide -R$(TOPOBJDIR) $(INCLUDES) -Ts $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
72 .PHONY: man doc-html doc-sgml
74 # Rules for installation
76 WIN16_INSTALL = $(ALTNAMES:%=_install_/%$(DLLEXT))
78 .PHONY: install_lib $(WIN16_INSTALL)
80 $(ALTNAMES:%=_install_/%$(DLLEXT)): install_lib
81 cd $(dlldir) && $(RM) `basename $@` && $(LN_S) $(MODULE)$(DLLEXT) `basename $@`
83 install_lib: $(MODULE)$(DLLEXT)
84 $(MKINSTALLDIRS) $(dlldir)
85 $(INSTALL_PROGRAM) $(MODULE)$(DLLEXT) $(dlldir)/$(MODULE)$(DLLEXT)
87 install:: install_lib @WIN16_INSTALL@
90 $(RM) $(dlldir)/$(MODULE)$(DLLEXT) $(ALTNAMES:%=$(dlldir)/%$(DLLEXT))
94 $(SPEC_SRCS16:.spec=.spec.c): $(WINEBUILD)
96 # End of global dll rules