Sweden-Number/dlls/Makedll.rules.in

68 lines
2.0 KiB
Plaintext
Raw Normal View History

# Global rules for building dlls -*-Makefile-*-
#
# Each individual makefile should define the following variables:
# MODULE : name of the main module being built
# SOVERSION : version of the .so file
# 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@
LDSHARED = @LDSHARED@
SONAME = lib$(MODULE).so
IMPORTLIBS = $(IMPORTS:%=$(DLLDIR)/lib%.$(LIBEXT))
ALLNAMES = lib$(MODULE).so $(ALTNAMES:%=lib%.so)
SPEC_SRCS = $(MODULE).spec $(ALTNAMES:%=%.spec)
all: lib$(MODULE).$(LIBEXT) $(ALTNAMES:%=lib%.$(LIBEXT))
@MAKE_RULES@
# Rules for .so files
lib$(MODULE).so.$(SOVERSION): $(OBJS) Makefile.in $(TOPSRCDIR)/Make.rules.in
$(LDSHARED) $(OBJS) -o $@ -L$(DLLDIR) $(IMPORTS:%=-l%) $(EXTRALIBS)
$(ALLNAMES): lib$(MODULE).so.$(SOVERSION)
$(RM) $@ && $(LN_S) lib$(MODULE).so.$(SOVERSION) $@
# Rules for .a files
lib$(MODULE).a: $(OBJS) Makefile.in $(TOPSRCDIR)/Make.rules.in
$(RM) $@
$(AR) $@ $(OBJS)
$(RANLIB) $@
$(ALTNAMES:%=lib%.a): lib$(MODULE).a
$(RM) $@ && $(LN_S) lib$(MODULE).a $@
# Rules for checking that no imports are missing
checklink:: lib$(MODULE).$(LIBEXT)
$(CC) -o checklink $(TOPSRCDIR)/library/checklink.c -L. -l$(MODULE) -L$(TOPOBJDIR) -lwine -lwine_unicode $(EXTRALIBS) $(LIBS) && $(RM) checklink
# Rules for installation
.PHONY: install_so install_a
install_so: lib$(MODULE).so.$(SOVERSION)
[ -d $(libdir) ] || $(MKDIR) $(libdir)
$(INSTALL_PROGRAM) lib$(MODULE).so.$(SOVERSION) $(libdir)/lib$(MODULE).so.$(SOVERSION)
cd $(libdir) && for i in $(ALLNAMES); do $(RM) $$i && $(LN_S) lib$(MODULE).so.$(SOVERSION) $$i; done
install_a: lib$(MODULE).a
[ -d $(libdir) ] || $(MKDIR) $(libdir)
$(INSTALL_DATA) lib$(MODULE).a $(libdir)/lib$(MODULE).a
install:: $(LIBEXT:%=install_%)
uninstall::
cd $(libdir) && $(RM) $(ALLNAMES) lib$(MODULE).so.$(SOVERSION) lib$(MODULE).a
clean::
$(RM) lib$(MODULE).so.$(SOVERSION)