113 lines
3.8 KiB
Makefile
113 lines
3.8 KiB
Makefile
# Global rules for building dlls -*-Makefile-*-
|
|
#
|
|
# Each individual makefile should define the following variables:
|
|
# MODULE : name of the main module being built
|
|
# EXTRALIBS : extra libraries to link in (optional)
|
|
# SPEC_SRCS16 : interface definition files for 16-bit dlls (optional)
|
|
# SUBSYSTEM : (optional) subsystem (for native dlls)
|
|
#
|
|
# plus all variables required by the global Make.rules.in
|
|
#
|
|
|
|
DLLDEFS = @DLLDEFS@
|
|
DLLFLAGS = @DLLFLAGS@
|
|
DLLEXT = @DLLEXT@
|
|
IMPLIBEXT = @IMPLIBEXT@
|
|
DEFS = -D__WINESRC__ $(DLLDEFS) $(EXTRADEFS)
|
|
BASEMODULE = $(MODULE:%.dll=%)
|
|
MAINSPEC = $(BASEMODULE).spec
|
|
SPEC_DEF = lib$(BASEMODULE).def
|
|
WIN16_FILES = $(SPEC_SRCS16:.spec=.spec.o) $(C_SRCS16:.c=.o) $(EXTRA_OBJS16)
|
|
ALL_OBJS = @WIN16_FILES@ $(OBJS) $(MODULE).dbg.o $(RC_SRCS:.rc=.res)
|
|
ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBPORT) $(LDFLAGS) $(LIBS)
|
|
ALL_IMPORTS = $(DELAYIMPORTS) $(IMPORTS)
|
|
|
|
all: $(MODULE)$(DLLEXT) $(SUBDIRS)
|
|
|
|
@MAKE_RULES@
|
|
|
|
# Rules for .so files
|
|
|
|
$(MODULE).so: $(MAINSPEC) $(ALL_OBJS) Makefile.in
|
|
$(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -shared $(SRCDIR)/$(MAINSPEC) $(ALL_OBJS) $(SUBSYSTEM:%=-Wb,--subsystem,%) -o $@ -L$(DLLDIR) $(ALL_IMPORTS:%=-l%) $(DELAYIMPORTS:%=-Wb,-d%) $(ALL_LIBS)
|
|
|
|
$(SPEC_DEF): $(MAINSPEC)
|
|
$(WINEBUILD) -w --def -o $@ --export $(SRCDIR)/$(MAINSPEC)
|
|
|
|
# Rules for .dll files
|
|
|
|
$(MODULE): $(RCOBJS) $(OBJS) $(MODULE).dbg.o $(SPEC_DEF) Makefile.in
|
|
$(DLLWRAP) -k --def $(SPEC_DEF) -o $@ $(RCOBJS) $(OBJS) $(MODULE).dbg.o -L$(DLLDIR) $(ALL_IMPORTS:%=-l%) $(ALL_LIBS)
|
|
|
|
lib$(BASEMODULE).a: $(SPEC_DEF)
|
|
$(DLLTOOL) -k -l $@ -d $(SPEC_DEF)
|
|
|
|
# Rules for checking that no imports are missing
|
|
|
|
.PHONY: checklink16 $(WIN16_FILES:%=__checklink16__%)
|
|
|
|
$(WIN16_FILES:%=__checklink16__%): checklink16
|
|
|
|
checklink16:: $(MAINSPEC).o $(OBJS) $(MODULE).dbg.o dummy
|
|
$(CC) -o checklink -Wl,-rpath,$(TOPOBJDIR)/libs $(TOPSRCDIR)/dlls/checklink.c $(MAINSPEC).o $(OBJS) $(MODULE).dbg.o -L$(DLLDIR) $(ALL_LIBS) -lm && $(RM) checklink $(MAINSPEC).c $(MAINSPEC).o
|
|
|
|
checklink:: $(WIN16_FILES:%=__checklink16__%)
|
|
|
|
# Rules for testing
|
|
|
|
check test:: $(SUBDIRS:%=%/__test__)
|
|
|
|
crosstest:: $(SUBDIRS:%=%/__crosstest__)
|
|
|
|
# Rule to explicitly generate the .spec.c for debugging
|
|
|
|
$(MAINSPEC).c: $(MAINSPEC) $(ALL_OBJS)
|
|
$(WINEBUILD) $(DEFS) $(DLLFLAGS) --dll -o $@ --export $(SRCDIR)/$(MAINSPEC) $(SUBSYSTEM:%=--subsystem %) $(ALL_OBJS) -L$(DLLDIR) $(ALL_IMPORTS:%=-l%) $(DELAYIMPORTS:%=-d%)
|
|
|
|
# Rules for auto documentation
|
|
|
|
man: $(C_SRCS)
|
|
$(C2MAN) -o $(TOPOBJDIR)/documentation/man$(api_manext) -R$(TOPOBJDIR) -C$(SRCDIR) -S$(api_manext) $(INCLUDES) $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
|
|
|
|
doc-html: $(C_SRCS)
|
|
$(C2MAN) -o $(TOPOBJDIR)/documentation/html -R$(TOPOBJDIR) -C$(SRCDIR) $(INCLUDES) -Th $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
|
|
|
|
doc-sgml: $(C_SRCS)
|
|
$(C2MAN) -o $(TOPOBJDIR)/documentation/api-guide -R$(TOPOBJDIR) -C$(SRCDIR) $(INCLUDES) -Ts $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
|
|
|
|
.PHONY: man doc-html doc-sgml
|
|
|
|
# Rules for installation
|
|
|
|
EXE_SPECS16 = $(SPEC_SRCS16:.exe.spec=.exe)
|
|
DRV_SPECS16 = $(EXE_SPECS16:.drv.spec=.drv)
|
|
ALL_SPECS16 = $(DRV_SPECS16:.spec=.dll)
|
|
|
|
WIN16_INSTALL = $(ALL_SPECS16:%=_install_/%)
|
|
|
|
.PHONY: install_lib $(ALL_SPECS16:%=_install_/%) $(ALL_SPECS16:%=_uninstall_/%)
|
|
|
|
$(ALL_SPECS16:%=_install_/%): install_lib
|
|
cd $(dlldir) && $(RM) `basename $@`$(DLLEXT) && $(LN_S) $(MODULE)$(DLLEXT) `basename $@`$(DLLEXT)
|
|
|
|
$(ALL_SPECS16:%=_uninstall_/%): dummy
|
|
$(RM) $(dlldir)/`basename $@`$(DLLEXT)
|
|
|
|
install_lib: $(MODULE)$(DLLEXT)
|
|
$(MKINSTALLDIRS) $(dlldir)
|
|
$(INSTALL_PROGRAM) $(MODULE)$(DLLEXT) $(dlldir)/$(MODULE)$(DLLEXT)
|
|
|
|
install:: install_lib @WIN16_INSTALL@
|
|
|
|
uninstall:: $(ALL_SPECS16:%=_uninstall_/%)
|
|
$(RM) $(dlldir)/$(MODULE)$(DLLEXT)
|
|
|
|
# Misc. rules
|
|
|
|
clean::
|
|
$(RM) $(SPEC_DEF)
|
|
|
|
$(SPEC_DEF) $(SPEC_SRCS16:.spec=.spec.c): $(WINEBUILD)
|
|
|
|
# End of global dll rules
|