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 # IMPORTS : dlls to import (optional)
7 # EXTRALIBS : extra libraries to link in (optional)
9 # plus all variables required by the global Make.rules.in
12 DEFS = @DLLFLAGS@ -D__WINE__ $(EXTRADEFS)
14 SONAME = lib$(MODULE).so
15 IMPORTLIBS = $(IMPORTS:%=$(DLLDIR)/lib%.$(LIBEXT))
16 ALLNAMES = lib$(MODULE).so $(ALTNAMES:%=lib%.so)
17 SPEC_SRCS = $(ALTNAMES:%=%.spec)
18 ALL_OBJS = $(MODULE).spec.o $(OBJS)
19 ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBS)
21 all: lib$(MODULE).$(LIBEXT) $(ALTNAMES:%=lib%.$(LIBEXT))
27 lib$(MODULE).so: $(ALL_OBJS) Makefile.in
28 $(LDSHARED) $(LDDLLFLAGS) $(ALL_OBJS) -o $@ -L$(DLLDIR) $(IMPORTS:%=-l%) $(ALL_LIBS)
30 $(ALTNAMES:%=lib%.$(LIBEXT)): lib$(MODULE).$(LIBEXT)
31 $(RM) $@ && $(LN_S) lib$(MODULE).$(LIBEXT) $@
35 lib$(MODULE).a: $(ALL_OBJS) Makefile.in
40 # Rules for .dll files
41 lib$(MODULE).dll: $(ALL_OBJS) Makefile.in
42 $(DLLWRAP) $(DLLWRAPFLAGS) --implib lib$(MODULE).a -o lib$(MODULE).dll $(ALL_OBJS) -L$(DLLDIR) $(IMPORTS:%=-l%) $(ALL_LIBS)
44 # Rules for checking that no imports are missing
46 checklink:: lib$(MODULE).$(LIBEXT)
47 $(CC) -o checklink $(TOPSRCDIR)/library/checklink.c -L. -l$(MODULE) $(ALL_LIBS) && $(RM) checklink
49 # Rules for debug channels
52 $(TOPSRCDIR)/tools/make_debug $(MODULE).spec $(C_SRCS) $(SUBDIRS:%=%/*.c)
54 # Rules for installation
56 .PHONY: install_so install_a
58 $(ALTNAMES:%=_install_/lib%.$(LIBEXT)): $(LIBEXT:%=install_%)
59 cd $(libdir) && $(RM) `basename $@` && $(LN_S) lib$(MODULE).$(LIBEXT) `basename $@`
61 install_so: lib$(MODULE).so
62 [ -d $(libdir) ] || $(MKDIR) $(libdir)
63 $(INSTALL_PROGRAM) lib$(MODULE).so $(libdir)/lib$(MODULE).so
65 install_a: lib$(MODULE).a
66 [ -d $(libdir) ] || $(MKDIR) $(libdir)
67 $(INSTALL_DATA) lib$(MODULE).a $(libdir)/lib$(MODULE).a
69 install:: $(LIBEXT:%=install_%) $(ALTNAMES:%=_install_/lib%.$(LIBEXT))
72 cd $(libdir) && $(RM) lib$(MODULE).$(LIBEXT) $(ALTNAMES:%=lib%.$(LIBEXT))