# 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) # 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) MAINSPEC = $(MODULE:%.dll=%).spec SPEC_DEF = $(MAINSPEC).def ALL_OBJS = $(MAINSPEC).o $(SPEC_SRCS:.spec=.spec.o) $(OBJS) $(MODULE).dbg.o ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBS) TESTIMPORTS = $(MODULE:%.dll=%) $(DELAYIMPORTS) $(IMPORTS) all: $(MODULE)$(DLLEXT) @MAKE_RULES@ # Rule for main module spec file $(MAINSPEC).c: $(MAINSPEC) $(RC_SRCS:.rc=.res) $(SYMBOLFILE) $(WINEBUILD) $(LDPATH) $(WINEBUILD) $(DEFS) $(SYMBOLFILE:%=-sym %) -o $@ -spec $(SRCDIR)/$(MAINSPEC) $(RC_SRCS:%.rc=-res %.res) -L$(DLLDIR) $(DELAYIMPORTS:%=-dl%) $(IMPORTS:%=-l%) # Rules for .so files $(MODULE).so: $(ALL_OBJS) Makefile.in $(LDSHARED) $(LDDLLFLAGS) $(ALL_OBJS) -o $@ -L$(DLLDIR) $(LDIMPORTS:%=-l%) $(ALL_LIBS) # Rules for .dll files $(MODULE): $(OBJS) $(MODULE).dbg.o $(SPEC_DEF) Makefile.in $(DLLWRAP) $(DLLWRAPFLAGS) --def $(SPEC_DEF) --implib $(MODULE:.dll=.a) -o $@ $(OBJS) $(MODULE).dbg.o -L$(DLLDIR) $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(ALL_LIBS) $(SPEC_DEF): $(WINEBUILD) # Rules for checking that no imports are missing CHECKLINK_RPATH = dlls library tsx11 unicode checklink:: $(MODULE)$(DLLEXT) $(CC) -o checklink $(CHECKLINK_RPATH:%=-Wl,-rpath,$(TOPOBJDIR)/%) $(TOPSRCDIR)/library/checklink.c $(MODULE)$(DLLEXT) && $(RM) checklink # Rules for testing $(TESTRESULTS): $(MODULE)$(DLLEXT) # 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) $(MKINSTALLDIRS) $(dlldir) $(INSTALL_PROGRAM) $(MODULE)$(DLLEXT) $(dlldir)/$(MODULE)$(DLLEXT) install:: install_lib $(ALTNAMES:%=_install_/%$(DLLEXT)) uninstall:: $(RM) $(dlldir)/$(MODULE)$(DLLEXT) $(ALTNAMES:%=$(dlldir)/%$(DLLEXT)) # End of global dll rules