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 = -D__WINESRC__ $(EXTRADEFS)
15 MAINSPEC = $(MODULE:%.dll=%).spec
16 SPEC_DEF = $(MAINSPEC).def
17 WIN16_FILES = $(SPEC_SRCS16:.spec=.spec.o) $(C_SRCS16:.c=.o) $(EXTRA_OBJS16)
18 ALL_OBJS = @WIN16_FILES@ $(OBJS) $(MODULE).dbg.o
19 ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBPORT) $(LDFLAGS) $(LIBS)
20 IMPORTLIBS = $(DELAYIMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT)) $(IMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT))
22 all: $(MODULE)$(DLLEXT) $(SUBDIRS)
28 $(MAINSPEC).c: $(MAINSPEC) $(RC_SRCS:.rc=.res) $(ALL_OBJS) $(IMPORTLIBS) $(WINEBUILD)
29 $(WINEBUILD) $(DEFS) $(DLLFLAGS) -o $@ --spec $(SRCDIR)/$(MAINSPEC) $(RC_SRCS:.rc=.res) $(ALL_OBJS) -L$(DLLDIR) $(DELAYIMPORTS:%=-d%) $(IMPORTS:%=-l%)
31 $(MODULE).so: $(MAINSPEC).o $(ALL_OBJS) Makefile.in
32 $(LDSHARED) $(LDDLLFLAGS) $(MAINSPEC).o $(ALL_OBJS) -o $@ $(ALL_LIBS) -lc
34 # Rules for .dll files
36 $(MODULE): $(RCOBJS) $(OBJS) $(MODULE).dbg.o $(SPEC_DEF) $(IMPORTLIBS) Makefile.in
37 $(DLLWRAP) -k --def $(SPEC_DEF) -o $@ $(RCOBJS) $(OBJS) $(MODULE).dbg.o -L$(DLLDIR) $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(ALL_LIBS)
39 $(SPEC_DEF): $(WINEBUILD)
41 # Rules for checking that no imports are missing
43 CHECKLINK_RPATH = dlls libs/unicode libs/wine
45 .PHONY: checklink16 $(WIN16_FILES:%=__checklink16__%)
47 $(WIN16_FILES:%=__checklink16__%): checklink16
49 checklink16:: $(MAINSPEC).o $(OBJS) $(MODULE).dbg.o dummy
50 $(CC) -o checklink $(CHECKLINK_RPATH:%=-Wl,-rpath,$(TOPOBJDIR)/%) $(TOPSRCDIR)/dlls/checklink.c $(MAINSPEC).o $(OBJS) $(MODULE).dbg.o $(ALL_LIBS) && $(RM) checklink
52 checklink:: $(WIN16_FILES:%=__checklink16__%)
56 check test:: $(SUBDIRS:%=%/__test__)
58 crosstest:: $(SUBDIRS:%=%/__crosstest__)
60 # Rules for auto documentation
63 $(C2MAN) -o $(TOPOBJDIR)/documentation/man$(api_manext) -R$(TOPOBJDIR) -S$(api_manext) $(INCLUDES) $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
66 $(C2MAN) -o $(TOPOBJDIR)/documentation/html -R$(TOPOBJDIR) $(INCLUDES) -Th $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
69 $(C2MAN) -o $(TOPOBJDIR)/documentation/api-guide -R$(TOPOBJDIR) $(INCLUDES) -Ts $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
71 .PHONY: man doc-html doc-sgml
75 Makedll.rules: $(TOPSRCDIR)/dlls/Makedll.rules.in $(TOPSRCDIR)/configure
76 @echo $? is newer than 'Makedll.rules', please rerun ./configure!
79 # Rules for installation
81 WIN16_INSTALL = $(ALTNAMES:%=_install_/%$(DLLEXT))
83 .PHONY: install_lib $(WIN16_INSTALL)
85 $(ALTNAMES:%=_install_/%$(DLLEXT)): install_lib
86 cd $(dlldir) && $(RM) `basename $@` && $(LN_S) $(MODULE)$(DLLEXT) `basename $@`
88 install_lib: $(MODULE)$(DLLEXT)
89 $(MKINSTALLDIRS) $(dlldir)
90 $(INSTALL_PROGRAM) $(MODULE)$(DLLEXT) $(dlldir)/$(MODULE)$(DLLEXT)
92 install:: install_lib @WIN16_INSTALL@
95 $(RM) $(dlldir)/$(MODULE)$(DLLEXT) $(ALTNAMES:%=$(dlldir)/%$(DLLEXT))
99 $(SPEC_SRCS16:.spec=.spec.c): $(WINEBUILD)
101 # End of global dll rules