- Fixed infinite loop bug.
[wine] / libs / Makelib.rules.in
1 # Global rules for building shared libraries     -*-Makefile-*-
2 #
3 # Each individual makefile should define the following variables:
4 # LIBRARY      : name of the library being built (without the lib prefix)
5 # SOVERSION    : the .so file version
6 #
7 # plus all variables required by the global Make.rules.in
8 #
9
10 DEFS      = $(EXTRADEFS)
11 DLLFLAGS  = @DLLFLAGS@
12 LIBEXT    = @LIBEXT@
13 LIBNAME   = lib$(LIBRARY)
14 DEFNAME   = $(LIBRARY).def
15 SONAME    = $(LIBNAME).so.$(SOVERSION)
16 MODULE    = $(LIBNAME).$(LIBEXT)
17
18 all: $(MODULE) $(MODULE:.dll=.a)
19
20 @MAKE_RULES@
21
22 $(LIBNAME).so.$(SOVERSION): $(OBJS) $(VERSCRIPT) Makefile.in
23         $(LDSHARED) $(OBJS) $(EXTRALIBS) $(LDFLAGS) $(LIBS) -o $@
24
25 $(LIBNAME).so: $(LIBNAME).so.$(SOVERSION)
26         $(RM) $@ && $(LN_S) $(LIBNAME).so.$(SOVERSION) $@
27
28 $(LIBNAME).a: $(DEFNAME)
29         $(DLLTOOL) -l $@ -d $(SRCDIR)/$(DEFNAME)
30
31 $(LIBNAME).dll: $(OBJS) $(DEFNAME) Makefile.in
32         $(DLLWRAP) --def $(SRCDIR)/$(DEFNAME) -o $@ $(OBJS) $(EXTRALIBS)
33
34 $(LIBNAME).$(SOVERSION).dylib: $(OBJS) Makefile.in
35         $(LDSHARED) -install_name $(libdir)/$(LIBNAME).$(SOVERSION).dylib $(OBJS) $(EXTRALIBS) $(LDFLAGS) $(LIBS) -o $@
36
37 $(LIBNAME).dylib: $(LIBNAME).$(SOVERSION).dylib
38         $(RM) $@ && $(LN_S) $(LIBNAME).$(SOVERSION).dylib $@
39
40 .PHONY: install-lib-so install-lib-dll install-lib-dylib install-dev-so install-dev-dll install-dev-dylib
41
42 install-lib-so: $(LIBNAME).so.$(SOVERSION) dummy
43         $(MKINSTALLDIRS) $(libdir)
44         $(INSTALL_PROGRAM) $(LIBNAME).so.$(SOVERSION) $(libdir)/$(LIBNAME).so.$(SOVERSION)
45
46 install-lib-dll: $(LIBNAME).dll dummy
47         $(MKINSTALLDIRS) $(libdir)
48         $(INSTALL_DATA) $(LIBNAME).dll $(libdir)/$(LIBNAME).dll
49
50 install-lib-dylib: $(LIBNAME).$(SOVERSION).dylib dummy
51         $(MKINSTALLDIRS) $(libdir)
52         $(INSTALL_PROGRAM) $(LIBNAME).$(SOVERSION).dylib $(libdir)/$(LIBNAME).$(SOVERSION).dylib
53
54 install-dev-so: dummy
55         $(MKINSTALLDIRS) $(libdir)
56         cd $(libdir) && $(RM) $(LIBNAME).so && $(LN_S) $(LIBNAME).so.$(SOVERSION) $(LIBNAME).so
57
58 install-dev-dll: $(LIBNAME).a dummy
59         $(MKINSTALLDIRS) $(libdir)
60         $(INSTALL_DATA) $(LIBNAME).a $(libdir)/$(LIBNAME).a
61
62 install-dev-dylib: dummy
63         $(MKINSTALLDIRS) $(libdir)
64         cd $(libdir) && $(RM) $(LIBNAME).dylib && $(LN_S) $(LIBNAME).$(SOVERSION).dylib $(LIBNAME).dylib
65
66 install install-lib:: $(LIBEXT:%=install-lib-%)
67 install install-dev:: $(LIBEXT:%=install-dev-%)
68
69 uninstall::
70         $(RM) $(libdir)/$(LIBNAME).a $(libdir)/$(LIBNAME).dll $(libdir)/$(LIBNAME).so $(libdir)/$(LIBNAME).so.$(SOVERSION) $(libdir)/$(LIBNAME).dylib $(libdir)/$(LIBNAME).$(SOVERSION).dylib
71
72 clean::
73         $(RM) $(LIBNAME).so.$(SOVERSION) $(LIBNAME).dll $(LIBNAME).$(SOVERSION).dylib