Fix signed/unsigned comparison warnings.
[wine] / dlls / Makedll.rules.in
1 # Global rules for building dlls     -*-Makefile-*-
2 #
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)
8 #
9 # plus all variables required by the global Make.rules.in
10 #
11
12 DEFS        = -D__WINESRC__ $(EXTRADEFS)
13 DLLFLAGS    = @DLLFLAGS@
14 DLLEXT      = @DLLEXT@
15 MAINSPEC    = $(MODULE:%.dll=%).spec
16 SPEC_DEF    = $(MAINSPEC).def
17 WIN16_FILES = $(SPEC_SRCS16:.spec=.spec.o) $(C_SRCS16:.c=.o) $(EXTRA_OBJS16)
18 ALL_OBJS    = @WIN16_FILES@ $(OBJS) $(MODULE).dbg.o
19 ALL_LIBS    = $(LIBWINE) $(EXTRALIBS) $(LIBPORT) $(LDFLAGS) $(LIBS)
20 IMPORTLIBS  = $(DELAYIMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT)) $(IMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT))
21
22 all: $(MODULE)$(DLLEXT) $(SUBDIRS)
23
24 @MAKE_RULES@
25
26 # Rules for .so files
27
28 $(MODULE).so: $(MAINSPEC) $(RC_SRCS:.rc=.res) $(ALL_OBJS) $(IMPORTLIBS) Makefile.in
29         $(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -shared $(SRCDIR)/$(MAINSPEC) $(ALL_OBJS) $(RC_SRCS:.rc=.res) $(SUBSYSTEM:%=-Wb,--subsystem,%) -o $@ -L$(DLLDIR) $(DELAYIMPORTS:%=-Wb,-d%) $(IMPORTS:%=-l%) $(ALL_LIBS)
30
31 # Rules for .dll files
32
33 $(MODULE): $(RCOBJS) $(OBJS) $(MODULE).dbg.o $(SPEC_DEF) $(IMPORTLIBS) Makefile.in
34         $(DLLWRAP) -k --def $(SPEC_DEF) -o $@ $(RCOBJS) $(OBJS) $(MODULE).dbg.o -L$(DLLDIR) $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(ALL_LIBS)
35
36 $(SPEC_DEF): $(WINEBUILD)
37
38 # Rules for checking that no imports are missing
39
40 .PHONY: checklink16 $(WIN16_FILES:%=__checklink16__%)
41
42 $(WIN16_FILES:%=__checklink16__%): checklink16
43
44 checklink16:: $(MAINSPEC).o $(OBJS) $(MODULE).dbg.o dummy
45         $(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
46
47 checklink:: $(WIN16_FILES:%=__checklink16__%)
48
49 # Rules for testing
50
51 check test:: $(SUBDIRS:%=%/__test__)
52
53 crosstest:: $(SUBDIRS:%=%/__crosstest__)
54
55 # Rule to explicitly generate the .spec.c for debugging
56
57 $(MAINSPEC).c: $(MAINSPEC) $(RC_SRCS:.rc=.res) $(ALL_OBJS) $(IMPORTLIBS) $(WINEBUILD)
58         $(WINEBUILD) $(DEFS) $(DLLFLAGS) -o $@ --dll $(SRCDIR)/$(MAINSPEC) $(SUBSYSTEM:%=--subsystem %) $(RC_SRCS:.rc=.res) $(ALL_OBJS) -L$(DLLDIR) $(DELAYIMPORTS:%=-d%) $(IMPORTS:%=-l%)
59
60 # Rules for auto documentation
61
62 man: $(C_SRCS)
63         $(C2MAN) -o $(TOPOBJDIR)/documentation/man$(api_manext) -R$(TOPOBJDIR) -S$(api_manext) $(INCLUDES) $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
64
65 doc-html: $(C_SRCS)
66         $(C2MAN) -o $(TOPOBJDIR)/documentation/html -R$(TOPOBJDIR) $(INCLUDES) -Th $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
67
68 doc-sgml: $(C_SRCS)
69         $(C2MAN) -o $(TOPOBJDIR)/documentation/api-guide -R$(TOPOBJDIR) $(INCLUDES) -Ts $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
70
71 .PHONY: man doc-html doc-sgml
72
73 # Rules for installation
74
75 EXE_SPECS16 = $(SPEC_SRCS16:.exe.spec=.exe)
76 DRV_SPECS16 = $(EXE_SPECS16:.drv.spec=.drv)
77 ALL_SPECS16 = $(DRV_SPECS16:.spec=.dll)
78
79 WIN16_INSTALL = $(ALL_SPECS16:%=_install_/%)
80
81 .PHONY: install_lib $(ALL_SPECS16:%=_install_/%) $(ALL_SPECS16:%=_uninstall_/%)
82
83 $(ALL_SPECS16:%=_install_/%): install_lib
84         cd $(dlldir) && $(RM) `basename $@`$(DLLEXT) && $(LN_S) $(MODULE)$(DLLEXT) `basename $@`$(DLLEXT)
85
86 $(ALL_SPECS16:%=_uninstall_/%): dummy
87         $(RM) $(dlldir)/`basename $@`$(DLLEXT)
88
89 install_lib: $(MODULE)$(DLLEXT)
90         $(MKINSTALLDIRS) $(dlldir)
91         $(INSTALL_PROGRAM) $(MODULE)$(DLLEXT) $(dlldir)/$(MODULE)$(DLLEXT)
92
93 install:: install_lib @WIN16_INSTALL@
94
95 uninstall:: $(ALL_SPECS16:%=_uninstall_/%)
96         $(RM) $(dlldir)/$(MODULE)$(DLLEXT)
97
98 # Misc. rules
99
100 $(SPEC_SRCS16:.spec=.spec.c): $(WINEBUILD)
101
102 # End of global dll rules