Always put the dll constructor in the .init section, and like the
[wine/multimedia.git] / dlls / Makedll.rules.in
blobf732073fd622cf99c526c3a17d57489e729dbc7c
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__
13 LIBEXT     = @LIBEXT@
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   = -L$(TOPOBJDIR) -lwine $(EXTRALIBS) $(LIBS)
21 all: lib$(MODULE).$(LIBEXT) $(ALTNAMES:%=lib%.$(LIBEXT))
23 @MAKE_RULES@
25 # Rules for .so files
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) $@
33 # Rules for .a files
35 lib$(MODULE).a: $(ALL_OBJS) Makefile.in
36         $(RM) $@
37         $(AR) $@ $(ALL_OBJS)
38         $(RANLIB) $@
40 # Rules for checking that no imports are missing
42 checklink:: lib$(MODULE).$(LIBEXT)
43         $(CC) -o checklink $(TOPSRCDIR)/library/checklink.c -L. -l$(MODULE) $(ALL_LIBS) && $(RM) checklink
45 # Rules for debug channels
47 debug_channels: dummy
48         $(TOPSRCDIR)/tools/make_debug $(MODULE).spec $(C_SRCS) $(SUBDIRS:%=%/*.c)
50 # Rules for installation
52 .PHONY: install_so install_a
54 $(ALTNAMES:%=_install_/lib%.$(LIBEXT)): $(LIBEXT:%=install_%)
55         cd $(libdir) && $(RM) `basename $@` && $(LN_S) lib$(MODULE).$(LIBEXT) `basename $@`
57 install_so: lib$(MODULE).so
58         [ -d $(libdir) ] || $(MKDIR) $(libdir)
59         $(INSTALL_PROGRAM) lib$(MODULE).so $(libdir)/lib$(MODULE).so
61 install_a: lib$(MODULE).a
62         [ -d $(libdir) ] || $(MKDIR) $(libdir)
63         $(INSTALL_DATA) lib$(MODULE).a $(libdir)/lib$(MODULE).a
65 install:: $(LIBEXT:%=install_%) $(ALTNAMES:%=_install_/lib%.$(LIBEXT))
67 uninstall::
68         cd $(libdir) && $(RM) lib$(MODULE).$(LIBEXT) $(ALTNAMES:%=lib%.$(LIBEXT))