Build ntdll as a real dll, including everything that was previously in
[wine] / dlls / Makedll.rules.in
1 # Global rules for building dlls     -*-Makefile-*-
2 #
3 # Each individual makefile should define the following variables:
4 # MODULE       : name of the main module being built
5 # SOVERSION    : version of the .so file
6 # ALTNAMES     : alternate names for this dll (optional)
7 # IMPORTS      : dlls to import (optional)
8 # EXTRALIBS    : extra libraries to link in (optional)
9 #
10 # plus all variables required by the global Make.rules.in
11 #
12
13 DEFS       = @DLLFLAGS@ -D__WINE__
14 LIBEXT     = @LIBEXT@
15 SONAME     = lib$(MODULE).so
16 IMPORTLIBS = $(IMPORTS:%=$(DLLDIR)/lib%.$(LIBEXT))
17 ALLNAMES   = lib$(MODULE).so $(ALTNAMES:%=lib%.so)
18 SPEC_SRCS  = $(MODULE).spec $(ALTNAMES:%=%.spec)
19
20 all: lib$(MODULE).$(LIBEXT) $(ALTNAMES:%=lib%.$(LIBEXT))
21
22 @MAKE_RULES@
23
24 # Rules for .so files
25
26 lib$(MODULE).so.$(SOVERSION): $(OBJS) Makefile.in $(TOPSRCDIR)/Make.rules.in
27         $(LDSHARED) $(OBJS) -o $@ -L$(DLLDIR) $(IMPORTS:%=-l%) -L$(TOPOBJDIR) -lwine -lwine_unicode $(EXTRALIBS)
28
29 $(ALLNAMES): lib$(MODULE).so.$(SOVERSION)
30         $(RM) $@ && $(LN_S) lib$(MODULE).so.$(SOVERSION) $@
31
32 # Rules for .a files
33
34 lib$(MODULE).a: $(OBJS) Makefile.in $(TOPSRCDIR)/Make.rules.in
35         $(RM) $@
36         $(AR) $@ $(OBJS)
37         $(RANLIB) $@
38
39 $(ALTNAMES:%=lib%.a): lib$(MODULE).a
40         $(RM) $@ && $(LN_S) lib$(MODULE).a $@
41
42 # Rules for checking that no imports are missing
43
44 checklink:: lib$(MODULE).$(LIBEXT)
45         $(CC) -o checklink $(TOPSRCDIR)/library/checklink.c -L. -l$(MODULE) -L$(TOPOBJDIR) -lwine -lwine_unicode $(EXTRALIBS) $(LIBS) && $(RM) checklink
46
47 # Rules for installation
48
49 .PHONY: install_so install_a
50
51 install_so: lib$(MODULE).so.$(SOVERSION)
52         [ -d $(libdir) ] || $(MKDIR) $(libdir)
53         $(INSTALL_PROGRAM) lib$(MODULE).so.$(SOVERSION) $(libdir)/lib$(MODULE).so.$(SOVERSION)
54         cd $(libdir) && for i in $(ALLNAMES); do $(RM) $$i && $(LN_S) lib$(MODULE).so.$(SOVERSION) $$i; done
55
56 install_a: lib$(MODULE).a
57         [ -d $(libdir) ] || $(MKDIR) $(libdir)
58         $(INSTALL_DATA) lib$(MODULE).a $(libdir)/lib$(MODULE).a
59
60 install:: $(LIBEXT:%=install_%)
61
62 uninstall::
63         cd $(libdir) && $(RM) $(ALLNAMES) lib$(MODULE).so.$(SOVERSION) lib$(MODULE).a
64
65 clean::
66         $(RM) lib$(MODULE).so.$(SOVERSION)