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)
8 # plus all variables required by the global Make.rules.in
11 DEFS = @DLLFLAGS@ -D__WINE__ $(EXTRADEFS)
13 ALTSPECS = $(ALTNAMES:%.dll=%)
14 SPEC_SRCS = $(ALTSPECS:%=%.spec)
15 MAINSPEC = $(MODULE:%.dll=%).spec
16 SPEC_DEF = $(MAINSPEC).def
17 ALL_OBJS = $(SPEC_SRCS:.spec=.spec.o) $(OBJS) $(MODULE).dbg.o
18 ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBS)
20 all: $(MODULE)$(DLLEXT)
26 $(MAINSPEC).c: $(MAINSPEC) $(RC_SRCS:.rc=.res) $(SYMBOLFILE) $(WINEBUILD)
27 $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -spec $(SRCDIR)/$(MAINSPEC) $(RC_SRCS:%.rc=-res %.res) $(SYMBOLFILE) -L$(DLLDIR) $(DELAYIMPORTS:%=-dl%) $(IMPORTS:%=-l%)
29 $(MODULE).so: $(MAINSPEC).o $(ALL_OBJS) Makefile.in
30 $(LDSHARED) $(LDDLLFLAGS) $(MAINSPEC).o $(ALL_OBJS) -o $@ -L$(DLLDIR) $(LDIMPORTS:%=-l%) $(ALL_LIBS)
32 $(MODULE).tmp.o: $(ALL_OBJS) Makefile.in
33 $(LDCOMBINE) $(ALL_OBJS) -o $@
34 -$(STRIP) --strip-unneeded $@
36 # Rules for .dll files
38 $(MODULE): $(RCOBJS) $(OBJS) $(MODULE).dbg.o $(SPEC_DEF) Makefile.in
39 $(DLLWRAP) $(DLLWRAPFLAGS) --def $(SPEC_DEF) --implib lib$(MODULE:.dll=.a) -o $@ $(RCOBJS) $(OBJS) $(MODULE).dbg.o -L$(DLLDIR) $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(ALL_LIBS)
41 $(SPEC_DEF): $(WINEBUILD)
43 # Rules for checking that no imports are missing
45 CHECKLINK_RPATH = dlls library tsx11 unicode
47 checklink:: $(MODULE)$(DLLEXT) $(SUBDIRS:%=%/__checklink__)
48 $(CC) -o checklink $(CHECKLINK_RPATH:%=-Wl,-rpath,$(TOPOBJDIR)/%) $(TOPSRCDIR)/library/checklink.c $(MODULE)$(DLLEXT) && $(RM) checklink
52 check test:: $(SUBDIRS:%=%/__test__)
54 $(TESTRESULTS): $(MODULE)$(DLLEXT)
58 Makedll.rules: $(TOPSRCDIR)/Makedll.rules.in $(TOPSRCDIR)/configure
59 @echo $? is newer than 'Makedll.rules', please rerun ./configure!
62 # Rules for installation
64 .PHONY: install_lib $(ALTNAMES:%=_install_/%$(DLLEXT))
66 $(ALTNAMES:%=_install_/%$(DLLEXT)): install_lib
67 cd $(dlldir) && $(RM) `basename $@` && $(LN_S) $(MODULE)$(DLLEXT) `basename $@`
69 install_lib: $(MODULE)$(DLLEXT)
70 $(MKINSTALLDIRS) $(dlldir)
71 $(INSTALL_PROGRAM) $(MODULE)$(DLLEXT) $(dlldir)/$(MODULE)$(DLLEXT)
73 install:: install_lib $(ALTNAMES:%=_install_/%$(DLLEXT))
76 $(RM) $(dlldir)/$(MODULE)$(DLLEXT) $(ALTNAMES:%=$(dlldir)/%$(DLLEXT))
78 # End of global dll rules