wine/dlls/Makedll.rules.in
2001-05-07 18:22:43 +00:00

79 lines
2.4 KiB
Makefile

# 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))
ALLNAMES = lib$(MODULE).so $(ALTNAMES:%=lib%.so)
SPEC_SRCS = $(ALTNAMES:%=%.spec)
ALL_OBJS = $(MODULE).spec.o $(OBJS)
ALL_LIBS = $(LIBWINE) $(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 .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_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))