| # Global rules for building dlls -*-Makefile-*- |
| # |
| # Each individual makefile should define the following variables: |
| # MODULE : name of the main module being built |
| # ALTNAMES : alternate names for this dll (optional) |
| # IMPORTS : dlls to import (optional) |
| # EXTRALIBS : extra libraries to link in (optional) |
| # |
| # plus all variables required by the global Make.rules.in |
| # |
| |
| DEFS = @DLLFLAGS@ -D__WINE__ $(EXTRADEFS) |
| LIBEXT = @LIBEXT@ |
| SONAME = lib$(MODULE).so |
| IMPORTLIBS = $(IMPORTS:%=$(DLLDIR)/lib%.$(LIBEXT)) |
| SPEC_SRCS = $(ALTNAMES:%=%.spec) |
| ALL_OBJS = $(MODULE).spec.o $(OBJS) |
| ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBS) |
| |
| all: lib$(MODULE).$(LIBEXT) |
| |
| @MAKE_RULES@ |
| |
| # Rules for .so files |
| |
| lib$(MODULE).so: $(ALL_OBJS) Makefile.in |
| $(LDSHARED) $(LDDLLFLAGS) $(ALL_OBJS) -o $@ -L$(DLLDIR) $(IMPORTS:%=-l%) $(ALL_LIBS) |
| |
| # Rules for .dll files |
| |
| lib$(MODULE).dll: $(ALL_OBJS) Makefile.in |
| $(DLLWRAP) $(DLLWRAPFLAGS) --implib lib$(MODULE).a -o lib$(MODULE).dll $(ALL_OBJS) -L$(DLLDIR) $(IMPORTS:%=-l%) $(ALL_LIBS) |
| |
| # Rules for checking that no imports are missing |
| |
| checklink:: lib$(MODULE).$(LIBEXT) |
| $(CC) -o checklink $(TOPSRCDIR)/library/checklink.c -L. -l$(MODULE) $(ALL_LIBS) && $(RM) checklink |
| |
| # Rules for debug channels |
| |
| debug_channels: dummy |
| $(TOPSRCDIR)/tools/make_debug $(MODULE).spec $(C_SRCS) $(SUBDIRS:%=%/*.c) |
| |
| # Sanity check |
| |
| Makedll.rules: $(TOPSRCDIR)/Makedll.rules.in $(TOPSRCDIR)/configure |
| @echo $? is newer than 'Makedll.rules', please rerun ./configure! |
| @exit 1 |
| |
| # Rules for installation |
| |
| .PHONY: install_lib $(ALTNAMES:%=_install_/lib%.$(LIBEXT)) |
| |
| $(ALTNAMES:%=_install_/lib%.$(LIBEXT)): install_lib |
| cd $(libdir) && $(RM) `basename $@` && $(LN_S) lib$(MODULE).$(LIBEXT) `basename $@` |
| |
| install_lib: lib$(MODULE).$(LIBEXT) |
| [ -d $(libdir) ] || $(MKDIR) $(libdir) |
| $(INSTALL_PROGRAM) lib$(MODULE).$(LIBEXT) $(libdir)/lib$(MODULE).$(LIBEXT) |
| |
| install:: install_lib $(ALTNAMES:%=_install_/lib%.$(LIBEXT)) |
| |
| uninstall:: |
| cd $(libdir) && $(RM) lib$(MODULE).$(LIBEXT) $(ALTNAMES:%=lib%.$(LIBEXT)) |
| |
| # End of global dll rules |