Beginnings of the code that should allow DOS programs to set their
[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 # ALTNAMES     : alternate names for this dll (optional)
6 # IMPORTS      : dlls to import (optional)
7 # EXTRALIBS    : extra libraries to link in (optional)
8 #
9 # plus all variables required by the global Make.rules.in
10 #
11
12 DEFS       = @DLLFLAGS@ -D__WINE__ $(EXTRADEFS)
13 LIBEXT     = @LIBEXT@
14 IMPORTLIBS = $(IMPORTS:%=$(DLLDIR)/lib%.$(LIBEXT))
15 SPEC_SRCS  = $(ALTNAMES:%=%.spec)
16 ALL_OBJS   = $(MODULE).spec.o $(OBJS)
17 ALL_LIBS   = $(LIBWINE) $(EXTRALIBS) $(LIBS)
18
19 all: lib$(MODULE).$(LIBEXT)
20
21 @MAKE_RULES@
22
23 # Rules for .so files
24
25 lib$(MODULE).so: $(ALL_OBJS) Makefile.in
26         $(LDSHARED) $(LDDLLFLAGS) $(ALL_OBJS) -o $@ -L$(DLLDIR) $(IMPORTS:%=-l%) $(ALL_LIBS)
27
28 # Rules for .dll files
29
30 lib$(MODULE).dll: $(ALL_OBJS) Makefile.in
31         $(DLLWRAP) $(DLLWRAPFLAGS) --implib lib$(MODULE).a -o lib$(MODULE).dll $(ALL_OBJS) -L$(DLLDIR) $(IMPORTS:%=-l%) $(ALL_LIBS)
32
33 # Rules for checking that no imports are missing
34
35 checklink:: lib$(MODULE).$(LIBEXT)
36         $(CC) -o checklink $(TOPSRCDIR)/library/checklink.c -L. -l$(MODULE) $(ALL_LIBS) && $(RM) checklink
37
38 # Rules for testing
39
40 $(TESTRESULTS): lib$(MODULE).$(LIBEXT)
41
42 # Rules for debug channels
43
44 debug_channels: dummy
45         $(TOPSRCDIR)/tools/make_debug $(MODULE).spec $(C_SRCS) $(SUBDIRS:%=%/*.c)
46
47 # Sanity check
48
49 Makedll.rules: $(TOPSRCDIR)/Makedll.rules.in $(TOPSRCDIR)/configure
50         @echo $? is newer than 'Makedll.rules', please rerun ./configure!
51         @exit 1  
52
53 # Rules for installation
54
55 .PHONY: install_lib $(ALTNAMES:%=_install_/lib%.$(LIBEXT))
56
57 $(ALTNAMES:%=_install_/lib%.$(LIBEXT)): install_lib
58         cd $(libdir) && $(RM) `basename $@` && $(LN_S) lib$(MODULE).$(LIBEXT) `basename $@`
59
60 install_lib: lib$(MODULE).$(LIBEXT)
61         [ -d $(libdir) ] || $(MKDIR) $(libdir)
62         $(INSTALL_PROGRAM) lib$(MODULE).$(LIBEXT) $(libdir)/lib$(MODULE).$(LIBEXT)
63
64 install:: install_lib $(ALTNAMES:%=_install_/lib%.$(LIBEXT))
65
66 uninstall::
67         cd $(libdir) && $(RM) lib$(MODULE).$(LIBEXT) $(ALTNAMES:%=lib%.$(LIBEXT))
68
69 # End of global dll rules