| # 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__ |
| LIBEXT = @LIBEXT@ |
| SONAME = lib$(MODULE).so |
| IMPORTLIBS = $(IMPORTS:%=$(DLLDIR)/lib%.$(LIBEXT)) |
| ALLNAMES = lib$(MODULE).so $(ALTNAMES:%=lib%.so) |
| SPEC_SRCS = $(ALTNAMES:%=%.spec) |
| ALL_OBJS = $(OBJS) $(MODULE).spec.o |
| ALL_LIBS = -L$(TOPOBJDIR) -lwine $(EXTRALIBS) $(LIBS) |
| |
| all: lib$(MODULE).$(LIBEXT) $(ALTNAMES:%=lib%.$(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) |
| |
| $(ALTNAMES:%=lib%.$(LIBEXT)): lib$(MODULE).$(LIBEXT) |
| $(RM) $@ && $(LN_S) lib$(MODULE).$(LIBEXT) $@ |
| |
| # Rules for .a files |
| |
| lib$(MODULE).a: $(ALL_OBJS) Makefile.in |
| $(RM) $@ |
| $(AR) $@ $(ALL_OBJS) |
| $(RANLIB) $@ |
| |
| # 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) |
| |
| # Rules for installation |
| |
| .PHONY: install_so install_a |
| |
| $(ALTNAMES:%=_install_/lib%.$(LIBEXT)): $(LIBEXT:%=install_%) |
| cd $(libdir) && $(RM) `basename $@` && $(LN_S) lib$(MODULE).$(LIBEXT) `basename $@` |
| |
| install_so: lib$(MODULE).so |
| [ -d $(libdir) ] || $(MKDIR) $(libdir) |
| $(INSTALL_PROGRAM) lib$(MODULE).so $(libdir)/lib$(MODULE).so |
| |
| install_a: lib$(MODULE).a |
| [ -d $(libdir) ] || $(MKDIR) $(libdir) |
| $(INSTALL_DATA) lib$(MODULE).a $(libdir)/lib$(MODULE).a |
| |
| install:: $(LIBEXT:%=install_%) $(ALTNAMES:%=_install_/lib%.$(LIBEXT)) |
| |
| uninstall:: |
| cd $(libdir) && $(RM) lib$(MODULE).$(LIBEXT) $(ALTNAMES:%=lib%.$(LIBEXT)) |