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 ALTSPECS = $(ALTNAMES:%.dll=%)
15 SPEC_SRCS = $(ALTSPECS:%=%.spec)
16 ALL_OBJS = $(MODULE:%.dll=%).spec.o $(OBJS)
17 ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBS)
19 all: $(MODULE)$(DLLEXT)
25 $(MODULE).so: $(ALL_OBJS) Makefile.in
26 $(LDSHARED) $(LDDLLFLAGS) $(ALL_OBJS) -o $@ -L$(DLLDIR) $(IMPORTS:%=-l%) $(ALL_LIBS)
28 # Rules for .dll files
30 $(MODULE): $(ALL_OBJS) Makefile.in
31 $(DLLWRAP) $(DLLWRAPFLAGS) --implib $(MODULE:.dll=.a) -o $(MODULE) $(ALL_OBJS) -L$(DLLDIR) $(IMPORTS:%=-l%) $(ALL_LIBS)
33 # Rules for checking that no imports are missing
35 checklink:: $(MODULE)$(DLLEXT)
36 $(CC) -o checklink $(TOPSRCDIR)/library/checklink.c $(MODULE)$(DLLEXT) $(ALL_LIBS) && $(RM) checklink
40 $(TESTRESULTS): $(MODULE)$(DLLEXT)
42 # Rules for debug channels
45 $(TOPSRCDIR)/tools/make_debug $(MAINSPEC) $(C_SRCS) $(SUBDIRS:%=%/*.c)
49 Makedll.rules: $(TOPSRCDIR)/Makedll.rules.in $(TOPSRCDIR)/configure
50 @echo $? is newer than 'Makedll.rules', please rerun ./configure!
53 # Rules for installation
55 .PHONY: install_lib $(ALTNAMES:%=_install_/%$(DLLEXT))
57 $(ALTNAMES:%=_install_/%$(DLLEXT)): install_lib
58 cd $(dlldir) && $(RM) `basename $@` && $(LN_S) $(MODULE)$(DLLEXT) `basename $@`
60 install_lib: $(MODULE)$(DLLEXT)
61 [ -d $(dlldir) ] || $(MKDIR) $(dlldir)
62 $(INSTALL_PROGRAM) $(MODULE)$(DLLEXT) $(dlldir)/$(MODULE)$(DLLEXT)
64 install:: install_lib $(ALTNAMES:%=_install_/%$(DLLEXT))
67 $(RM) $(dlldir)/$(MODULE)$(DLLEXT) $(ALTNAMES:%=$(dlldir)/%$(DLLEXT))
69 # Extra install rules for dlls not yet properly separated
71 install_libdir:: install_lib
72 cd $(libdir) && $(RM) lib$(MODULE).$(LIBEXT) && if [ "$(dlldir)" = "$(libdir)/wine" ]; \
73 then $(LN_S) wine/$(MODULE)$(DLLEXT) lib$(MODULE).$(LIBEXT); \
74 else $(LN_S) $(dlldir)/$(MODULE)$(DLLEXT) lib$(MODULE).$(LIBEXT); fi
77 $(RM) $(libdir)/lib$(MODULE).$(LIBEXT)
79 # End of global dll rules