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)
9 # plus all variables required by the global Make.rules.in
12 DEFS = @DLLFLAGS@ -D__WINESRC__ $(EXTRADEFS)
14 MAINSPEC = $(MODULE:%.dll=%).spec
15 SPEC_DEF = $(MAINSPEC).def
16 WIN16_FILES = $(SPEC_SRCS16:.spec=.spec.o) $(C_SRCS16:.c=.o) $(EXTRA_OBJS16)
17 ALL_OBJS = @WIN16_FILES@ $(OBJS) $(MODULE).dbg.o
18 ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBPORT) $(LIBS)
19 IMPORTLIBS = $(DELAYIMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT)) $(IMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT))
21 all: $(MODULE)$(DLLEXT) $(SUBDIRS)
27 $(MAINSPEC).c: $(MAINSPEC) $(RC_SRCS:.rc=.res) $(SYMBOLFILE) $(IMPORTLIBS) $(WINEBUILD)
28 $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --spec $(SRCDIR)/$(MAINSPEC) $(RC_SRCS:.rc=.res) $(SYMBOLFILE) $(DLLMAIN:%=--entry %) -L$(DLLDIR) $(DELAYIMPORTS:%=-d%) $(IMPORTS:%=-l%)
30 $(MODULE).so: $(MAINSPEC).o $(ALL_OBJS) Makefile.in
31 $(LDSHARED) $(LDDLLFLAGS) $(MAINSPEC).o $(ALL_OBJS) -o $@ -L$(DLLDIR) $(LDIMPORTS:%=-l%) $(ALL_LIBS) -lc
33 $(MODULE).tmp.o: $(ALL_OBJS) Makefile.in
34 $(LDCOMBINE) $(ALL_OBJS) -o $@
35 -$(STRIP) --strip-unneeded $@
37 # Rule for 16-bit glue
39 $(MODULE).glue.c: $(C_SRCS) $(C_SRCS16) $(WINEBUILD)
40 $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --glue -C$(SRCDIR) $(C_SRCS) $(C_SRCS16)
42 # Rules for .dll files
44 $(MODULE): $(RCOBJS) $(OBJS) $(MODULE).dbg.o $(SPEC_DEF) $(IMPORTLIBS) Makefile.in
45 $(DLLWRAP) -k --def $(SPEC_DEF) -o $@ $(RCOBJS) $(OBJS) $(MODULE).dbg.o $(DLLMAIN:%=--entry %) -L$(DLLDIR) $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(ALL_LIBS)
47 $(SPEC_DEF): $(WINEBUILD)
49 # Rules for checking that no imports are missing
51 CHECKLINK_RPATH = dlls libs/unicode libs/wine
53 .PHONY: checklink16 $(WIN16_FILES:%=__checklink16__%)
55 $(WIN16_FILES:%=__checklink16__%): checklink16
57 checklink16:: $(MAINSPEC).o $(OBJS) $(MODULE).dbg.o dummy
58 $(CC) -o checklink $(CHECKLINK_RPATH:%=-Wl,-rpath,$(TOPOBJDIR)/%) $(TOPSRCDIR)/dlls/checklink.c $(MAINSPEC).o $(OBJS) $(MODULE).dbg.o -L$(DLLDIR) $(LDIMPORTS:%=-l%) $(ALL_LIBS) && $(RM) checklink
60 checklink:: $(WIN16_FILES:%=__checklink16__%)
64 check test:: $(SUBDIRS:%=%/__test__)
66 crosstest:: $(SUBDIRS:%=%/__crosstest__)
68 # Rules for auto documentation
70 $(SUBDIRS:%=%/__man__): dummy
71 cd `dirname $@` && $(MAKE) man
73 man: $(C_SRCS) $(SUBDIRS:%=%/__man__)
74 $(C2MAN) -o $(TOPOBJDIR)/documentation/man$(api_manext) -R$(TOPOBJDIR) -S$(api_manext) $(DIVINCL) $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
76 $(SUBDIRS:%=%/__doc_html__): dummy
77 cd `dirname $@` && $(MAKE) doc-html
79 doc-html: $(C_SRCS) $(SUBDIRS:%=%/__doc_html__)
80 $(C2MAN) -o $(TOPOBJDIR)/documentation/html -R$(TOPOBJDIR) $(DIVINCL) -Th $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
82 $(SUBDIRS:%=%/__doc_sgml__): dummy
83 cd `dirname $@` && $(MAKE) doc-sgml
85 doc-sgml: $(C_SRCS) $(SUBDIRS:%=%/__doc_sgml__)
86 $(C2MAN) -o $(TOPOBJDIR)/documentation/api-guide -R$(TOPOBJDIR) $(DIVINCL) -Ts $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
88 .PHONY: man doc-html doc-sgml $(SUBDIRS:%=%/__man__) $(SUBDIRS:%=%/__doc_html__) $(SUBDIRS:%=%/__doc_sgml__)
92 Makedll.rules: $(TOPSRCDIR)/dlls/Makedll.rules.in $(TOPSRCDIR)/configure
93 @echo $? is newer than 'Makedll.rules', please rerun ./configure!
96 # Rules for installation
98 WIN16_INSTALL = $(ALTNAMES:%=_install_/%$(DLLEXT))
100 .PHONY: install_lib $(WIN16_INSTALL)
102 $(ALTNAMES:%=_install_/%$(DLLEXT)): install_lib
103 cd $(dlldir) && $(RM) `basename $@` && $(LN_S) $(MODULE)$(DLLEXT) `basename $@`
105 install_lib: $(MODULE)$(DLLEXT)
106 $(MKINSTALLDIRS) $(dlldir)
107 $(INSTALL_PROGRAM) $(MODULE)$(DLLEXT) $(dlldir)/$(MODULE)$(DLLEXT)
109 install:: install_lib @WIN16_INSTALL@
112 $(RM) $(dlldir)/$(MODULE)$(DLLEXT) $(ALTNAMES:%=$(dlldir)/%$(DLLEXT))
116 $(SPEC_SRCS16:.spec=.spec.c): $(WINEBUILD)
118 # End of global dll rules