wine/dlls/Makedll.rules.in
2002-03-26 19:56:06 +00:00

80 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)
DLLEXT = @DLLEXT@
ALTSPECS = $(ALTNAMES:%.dll=%)
SPEC_SRCS = $(ALTSPECS:%=%.spec)
ALL_OBJS = $(MODULE:%.dll=%).spec.o $(OBJS)
ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBS)
all: $(MODULE)$(DLLEXT)
@MAKE_RULES@
# Rules for .so files
$(MODULE).so: $(ALL_OBJS) Makefile.in
$(LDSHARED) $(LDDLLFLAGS) $(ALL_OBJS) -o $@ -L$(DLLDIR) $(IMPORTS:%=-l%) $(ALL_LIBS)
# Rules for .dll files
$(MODULE): $(ALL_OBJS) Makefile.in
$(DLLWRAP) $(DLLWRAPFLAGS) --implib $(MODULE:.dll=.a) -o $(MODULE) $(ALL_OBJS) -L$(DLLDIR) $(IMPORTS:%=-l%) $(ALL_LIBS)
# Rules for checking that no imports are missing
checklink:: $(MODULE)$(DLLEXT)
$(CC) -o checklink $(TOPSRCDIR)/library/checklink.c $(MODULE)$(DLLEXT) $(ALL_LIBS) && $(RM) checklink
# Rules for testing
$(TESTRESULTS): $(MODULE)$(DLLEXT)
# Rules for debug channels
debug_channels: dummy
$(TOPSRCDIR)/tools/make_debug $(MAINSPEC) $(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_/%$(DLLEXT))
$(ALTNAMES:%=_install_/%$(DLLEXT)): install_lib
cd $(dlldir) && $(RM) `basename $@` && $(LN_S) $(MODULE)$(DLLEXT) `basename $@`
install_lib: $(MODULE)$(DLLEXT)
[ -d $(dlldir) ] || $(MKDIR) $(dlldir)
$(INSTALL_PROGRAM) $(MODULE)$(DLLEXT) $(dlldir)/$(MODULE)$(DLLEXT)
install:: install_lib $(ALTNAMES:%=_install_/%$(DLLEXT))
uninstall::
$(RM) $(dlldir)/$(MODULE)$(DLLEXT) $(ALTNAMES:%=$(dlldir)/%$(DLLEXT))
# Extra install rules for dlls not yet properly separated
install_libdir:: install_lib
cd $(libdir) && $(RM) lib$(MODULE).$(LIBEXT) && if [ "$(dlldir)" = "$(libdir)/wine" ]; \
then $(LN_S) wine/$(MODULE)$(DLLEXT) lib$(MODULE).$(LIBEXT); \
else $(LN_S) $(dlldir)/$(MODULE)$(DLLEXT) lib$(MODULE).$(LIBEXT); fi
uninstall_libdir::
$(RM) $(libdir)/lib$(MODULE).$(LIBEXT)
# End of global dll rules