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 WIN16_FILES = $(SPEC_SRCS:.spec=.spec.o) $(C_SRCS16:.c=.o) $(EXTRA_OBJS16)
18 ALL_OBJS = @WIN16_FILES@ $(OBJS) $(MODULE).dbg.o
19 ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBS)
20 IMPORTLIBS = $(DELAYIMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT)) $(IMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT))
22 all: $(MODULE)$(DLLEXT) $(SUBDIRS)
28 $(MAINSPEC).c: $(MAINSPEC) $(RC_SRCS:.rc=.res) $(SYMBOLFILE) $(IMPORTLIBS) $(WINEBUILD)
29 $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --spec $(SRCDIR)/$(MAINSPEC) $(RC_SRCS:.rc=.res) $(SYMBOLFILE) $(DLLMAIN:%=-e %) -L$(DLLDIR) $(DELAYIMPORTS:%=-d%) $(IMPORTS:%=-l%)
31 $(MODULE).so: $(MAINSPEC).o $(ALL_OBJS) Makefile.in
32 $(LDSHARED) $(LDDLLFLAGS) $(MAINSPEC).o $(ALL_OBJS) -o $@ -L$(DLLDIR) $(LDIMPORTS:%=-l%) $(ALL_LIBS) -lc
34 $(MODULE).tmp.o: $(ALL_OBJS) Makefile.in
35 $(LDCOMBINE) $(ALL_OBJS) -o $@
36 -$(STRIP) --strip-unneeded $@
38 # Rule for 16-bit glue
40 $(MODULE).glue.c: $(C_SRCS) $(C_SRCS16) $(WINEBUILD)
41 $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --glue -C$(SRCDIR) $(C_SRCS) $(C_SRCS16)
43 # Rules for .dll files
45 $(MODULE): $(RCOBJS) $(OBJS) $(MODULE).dbg.o $(SPEC_DEF) $(IMPORTLIBS) Makefile.in
46 $(DLLWRAP) -k --def $(SPEC_DEF) -o $@ $(RCOBJS) $(OBJS) $(MODULE).dbg.o $(DLLMAIN:%=--entry %) -L$(DLLDIR) $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(ALL_LIBS)
48 $(SPEC_DEF): $(WINEBUILD)
50 # Rules for checking that no imports are missing
52 CHECKLINK_RPATH = dlls library unicode
54 .PHONY: checklink16 $(WIN16_FILES:%=__checklink16__%)
56 $(WIN16_FILES:%=__checklink16__%): checklink16
58 checklink16:: $(MAINSPEC).o $(OBJS) $(MODULE).dbg.o dummy
59 $(CC) -o checklink $(CHECKLINK_RPATH:%=-Wl,-rpath,$(TOPOBJDIR)/%) $(TOPSRCDIR)/library/checklink.c $(MAINSPEC).o $(OBJS) $(MODULE).dbg.o -L$(DLLDIR) $(LDIMPORTS:%=-l%) $(ALL_LIBS) && $(RM) checklink
61 checklink:: $(WIN16_FILES:%=__checklink16__%)
65 check test:: $(SUBDIRS:%=%/__test__)
67 crosstest:: $(SUBDIRS:%=%/__crosstest__)
71 Makedll.rules: $(TOPSRCDIR)/dlls/Makedll.rules.in $(TOPSRCDIR)/configure
72 @echo $? is newer than 'Makedll.rules', please rerun ./configure!
75 # Rules for installation
77 WIN16_INSTALL = $(ALTNAMES:%=_install_/%$(DLLEXT))
79 .PHONY: install_lib $(WIN16_INSTALL)
81 $(ALTNAMES:%=_install_/%$(DLLEXT)): install_lib
82 cd $(dlldir) && $(RM) `basename $@` && $(LN_S) $(MODULE)$(DLLEXT) `basename $@`
84 install_lib: $(MODULE)$(DLLEXT)
85 $(MKINSTALLDIRS) $(dlldir)
86 $(INSTALL_PROGRAM) $(MODULE)$(DLLEXT) $(dlldir)/$(MODULE)$(DLLEXT)
88 install:: install_lib @WIN16_INSTALL@
91 $(RM) $(dlldir)/$(MODULE)$(DLLEXT) $(ALTNAMES:%=$(dlldir)/%$(DLLEXT))
93 # End of global dll rules