1 # Global rules for building dlls -*-Makefile-*-
3 # Each individual makefile should define the following variables:
4 # MODULE : name of the main module being built
5 # EXTRALIBS : extra libraries to link in (optional)
6 # SPEC_SRCS16 : interface definition files for 16-bit dlls (optional)
7 # SUBSYSTEM : (optional) subsystem (for native dlls)
9 # plus all variables required by the global Make.rules.in
15 DEFS = -D__WINESRC__ $(DLLDEFS) $(EXTRADEFS)
16 MAINSPEC = $(MODULE:%.dll=%).spec
17 SPEC_DEF = $(MAINSPEC).def
18 WIN16_FILES = $(SPEC_SRCS16:.spec=.spec.o) $(C_SRCS16:.c=.o) $(EXTRA_OBJS16)
19 ALL_OBJS = @WIN16_FILES@ $(OBJS) $(MODULE).dbg.o $(RC_SRCS:.rc=.res)
20 ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBPORT) $(LDFLAGS) $(LIBS)
21 ALL_IMPORTS = $(DELAYIMPORTS) $(IMPORTS)
22 IMPORTLIBS = $(ALL_IMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT))
24 all: $(MODULE)$(DLLEXT) $(SUBDIRS)
30 $(MODULE).so: $(MAINSPEC) $(ALL_OBJS) $(IMPORTLIBS) Makefile.in
31 $(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -shared $(SRCDIR)/$(MAINSPEC) $(ALL_OBJS) $(SUBSYSTEM:%=-Wb,--subsystem,%) -o $@ -L$(DLLDIR) $(ALL_IMPORTS:%=-l%) $(DELAYIMPORTS:%=-Wb,-d%) $(ALL_LIBS)
33 # Rules for .dll files
35 $(MODULE): $(RCOBJS) $(OBJS) $(MODULE).dbg.o $(SPEC_DEF) $(IMPORTLIBS) Makefile.in
36 $(DLLWRAP) -k --def $(SPEC_DEF) -o $@ $(RCOBJS) $(OBJS) $(MODULE).dbg.o -L$(DLLDIR) $(ALL_IMPORTS:%=-l%) $(ALL_LIBS)
38 $(SPEC_DEF): $(WINEBUILD)
40 # Rules for checking that no imports are missing
42 .PHONY: checklink16 $(WIN16_FILES:%=__checklink16__%)
44 $(WIN16_FILES:%=__checklink16__%): checklink16
46 checklink16:: $(MAINSPEC).o $(OBJS) $(MODULE).dbg.o dummy
47 $(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
49 checklink:: $(WIN16_FILES:%=__checklink16__%)
53 check test:: $(SUBDIRS:%=%/__test__)
55 crosstest:: $(SUBDIRS:%=%/__crosstest__)
57 # Rule to explicitly generate the .spec.c for debugging
59 $(MAINSPEC).c: $(MAINSPEC) $(ALL_OBJS) $(IMPORTLIBS) $(WINEBUILD)
60 $(WINEBUILD) $(DEFS) $(DLLFLAGS) --dll -o $@ --export $(SRCDIR)/$(MAINSPEC) $(SUBSYSTEM:%=--subsystem %) $(ALL_OBJS) -L$(DLLDIR) $(ALL_IMPORTS:%=-l%) $(DELAYIMPORTS:%=-d%)
62 # Rules for auto documentation
65 $(C2MAN) -o $(TOPOBJDIR)/documentation/man$(api_manext) -R$(TOPOBJDIR) -S$(api_manext) $(INCLUDES) $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
68 $(C2MAN) -o $(TOPOBJDIR)/documentation/html -R$(TOPSRCDIR) $(INCLUDES) -Th $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
71 $(C2MAN) -o $(TOPOBJDIR)/documentation/api-guide -R$(TOPSRCDIR) $(INCLUDES) -Ts $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
73 .PHONY: man doc-html doc-sgml
75 # Rules for installation
77 EXE_SPECS16 = $(SPEC_SRCS16:.exe.spec=.exe)
78 DRV_SPECS16 = $(EXE_SPECS16:.drv.spec=.drv)
79 ALL_SPECS16 = $(DRV_SPECS16:.spec=.dll)
81 WIN16_INSTALL = $(ALL_SPECS16:%=_install_/%)
83 .PHONY: install_lib $(ALL_SPECS16:%=_install_/%) $(ALL_SPECS16:%=_uninstall_/%)
85 $(ALL_SPECS16:%=_install_/%): install_lib
86 cd $(dlldir) && $(RM) `basename $@`$(DLLEXT) && $(LN_S) $(MODULE)$(DLLEXT) `basename $@`$(DLLEXT)
88 $(ALL_SPECS16:%=_uninstall_/%): dummy
89 $(RM) $(dlldir)/`basename $@`$(DLLEXT)
91 install_lib: $(MODULE)$(DLLEXT)
92 $(MKINSTALLDIRS) $(dlldir)
93 $(INSTALL_PROGRAM) $(MODULE)$(DLLEXT) $(dlldir)/$(MODULE)$(DLLEXT)
95 install:: install_lib @WIN16_INSTALL@
97 uninstall:: $(ALL_SPECS16:%=_uninstall_/%)
98 $(RM) $(dlldir)/$(MODULE)$(DLLEXT)
102 $(SPEC_SRCS16:.spec=.spec.c): $(WINEBUILD)
104 # End of global dll rules