Fixed warnings.
[wine.git] / Make.rules.in
blobccbecb80d65f64c7f39dd93f49d487a3e81ec120
1 # Global rules shared by all makefiles     -*-Makefile-*-
3 # Each individual makefile must define the following variables:
4 # TOPSRCDIR    : top-level source directory
5 # TOPOBJDIR    : top-level object directory
6 # SRCDIR       : source directory for this module
7 # MODULE       : name of the module being built
9 # Each individual makefile may define the following additional variables:
10 # C_SRCS       : C sources for the module
11 # ASM_SRCS     : assembly sources
12 # GEN_C_SRCS   : generated C files
13 # GEN_ASM_SRCS : generated assembly sources
14 # RC_SRCS      : resource source files
15 # SPEC_SRCS    : interface definition files
16 # EXTRA_SRCS   : extra source files for make depend
17 # EXTRA_OBJS   : extra object files
18 # IMPORTS      : dlls to import
19 # DELAYIMPORTS : dlls to import in delayed mode
20 # SUBDIRS      : subdirectories that contain a Makefile
21 # EXTRASUBDIRS : subdirectories that do not contain a Makefile
22 # INSTALLSUBDIRS : subdirectories to run make install/uninstall into
24 # First some useful definitions
26 SHELL     = /bin/sh
27 CC        = @CC@
28 CPP       = @CPP@
29 CFLAGS    = @CFLAGS@ $(EXTRACFLAGS)
30 OPTIONS   = @OPTIONS@ -D_REENTRANT
31 LIBS      = @LIBS@
32 YACC      = @YACC@
33 LEX       = @LEX@
34 LEXLIB    = @LEXLIB@
35 EXEEXT    = @EXEEXT@
36 OBJEXT    = @OBJEXT@
37 LIBEXT    = @LIBEXT@
38 DLLEXT    = @DLLEXT@
39 CROSSCC   = @CROSSCC@
40 LDSHARED  = @LDSHARED@
41 DLLWRAP   = @DLLWRAP@
42 DLLWRAPFLAGS = --add-stdcall-alias
43 AR        = @AR@ rc
44 RANLIB    = @RANLIB@
45 STRIP     = @STRIP@
46 WINDRES   = @WINDRES@
47 LN        = @LN@
48 LN_S      = @LN_S@
49 TOOLSDIR  = @TOOLSDIR@
50 DIVINCL   = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include $(EXTRAINCL)
51 ALLCFLAGS = $(DIVINCL) $(CFLAGS) $(DEFS) $(OPTIONS)
52 LD        = @LD@
53 LDFLAGS   = @LDFLAGS@
54 LDCOMBINE = $(LD) -r
55 RM        = rm -f
56 MV        = mv
57 C2MAN     = @C2MAN@
58 MANSPECS  = -w $(TOPSRCDIR)/dlls/gdi/gdi32.spec \
59             -w $(TOPSRCDIR)/dlls/user/user32.spec \
60             -w $(TOPSRCDIR)/dlls/comctl32/comctl32.spec \
61             -w $(TOPSRCDIR)/dlls/commdlg/comdlg32.spec \
62             -w $(TOPSRCDIR)/dlls/kernel/kernel32.spec
63 LINT      = @LINT@
64 LINTFLAGS = @LINTFLAGS@
65 ALLLINTFLAGS = $(LINTFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL)
66 MKINSTALLDIRS= $(TOPSRCDIR)/tools/mkinstalldirs
67 WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi_check/winapi_check
68 WINEWRAPPER  = $(TOPSRCDIR)/tools/winewrapper
69 RUNTEST      = $(TOPSRCDIR)/programs/winetest/runtest
70 WINEBUILD    = $(TOOLSDIR)/tools/winebuild/winebuild
71 MAKEDEP      = $(TOOLSDIR)/tools/makedep
72 WRC          = $(TOOLSDIR)/tools/wrc/wrc
73 WMC          = $(TOOLSDIR)/tools/wmc/wmc
74 LDPATH    = @LDPATH@
75 DLLDIR    = $(TOPOBJDIR)/dlls
76 LIBWINE   = -L$(TOPOBJDIR)/library -lwine
77 LIBUNICODE= -L$(TOPOBJDIR)/unicode -lwine_unicode
78 LIBUUID   = -L$(TOPOBJDIR)/ole -lwine_uuid
80 @SET_MAKE@
82 # Installation infos
84 INSTALL         = @INSTALL@ $(INSTALL_FLAGS)
85 INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(INSTALL_PROGRAM_FLAGS)
86 INSTALL_SCRIPT  = @INSTALL_SCRIPT@ $(INSTALL_SCRIPT_FLAGS)
87 INSTALL_DATA    = @INSTALL_DATA@ $(INSTALL_DATA_FLAGS)
88 prefix          = @prefix@
89 exec_prefix     = @exec_prefix@
90 bindir          = @bindir@
91 libdir          = @libdir@
92 datadir         = @datadir@
93 infodir         = @infodir@
94 mandir          = @mandir@
95 sysconfdir      = @sysconfdir@
96 includedir      = @includedir@/wine
97 dlldir          = @libdir@/wine
98 prog_manext     = 1
99 conf_manext     = 5
100 CLEAN_FILES     = *.o *.a *.so *.ln *.$(LIBEXT) \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej \
101                   *.flc *.spec.c *.spec.def *.glue.c *.dbg.c y.tab.c y.tab.h @LEX_OUTPUT_ROOT@.c core
103 OBJS = $(C_SRCS:.c=.o) $(GEN_C_SRCS:.c=.o) $(GEN_ASM_SRCS:.s=.o) $(ASM_SRCS:.S=.o) $(EXTRA_OBJS)
105 RCOBJS = $(RC_SRCS:.rc=.res.o)
106 LINTS  = $(C_SRCS:.c=.ln)
108 # Implicit rules
110 .SUFFIXES: .mc .rc .mc.rc .res .res.o .spec .spec.c .spec.def .pl .ok .cross.o
112 .c.o:
113         $(CC) -c $(ALLCFLAGS) -o $@ $<
115 .c.cross.o:
116         $(CROSSCC) -c $(ALLCFLAGS) -o $@ $<
118 .s.o:
119         $(AS) -o $@ $<
121 .S.o:
122         $(CC) -c -o $@ $<
124 .mc.mc.rc:
125         $(LDPATH) $(WMC) -i -H /dev/null -o $@ $<
127 .rc.res:
128         $(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -r $<
130 .res.res.o:
131         $(WINDRES) -i $< -o $@
133 .spec.spec.c:
134         $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -M $(MODULE) -spec $<
136 .spec.spec.def:
137         $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -def $<
139 .c.ln:
140         $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
142 .c.ok:
143         $(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
145 .pl.ok:
146         $(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
148 # 'all' target first in case the enclosing Makefile didn't define any target
150 all: Makefile
152 filter:
153         @$(TOPSRCDIR)/tools/winapi/make_filter --make $(MAKE) all
155 .PHONY: all filter
157 # Rule for main module debug channels
159 $(MODULE).dbg.c: $(C_SRCS) $(WINEBUILD)
160         $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -debug -C$(SRCDIR) $(C_SRCS)
162 # Rule for 16-bit glue
164 $(MODULE).glue.c: $(C_SRCS) $(WINEBUILD)
165         $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -glue -C$(SRCDIR) $(C_SRCS)
167 # Rule to rebuild the tools
169 $(MAKEDEP) $(WINEBUILD) $(WMC) $(WRC):
170         cd $(TOOLSDIR)/tools && $(MAKE) `basename $@`
172 # Rules for makefile
174 Makefile: Makefile.in $(TOPSRCDIR)/configure
175         @echo Makefile is older than $?, please rerun $(TOPSRCDIR)/configure
176         @exit 1
178 # Rules for auto documentation
180 $(SUBDIRS:%=%/__man__): dummy
181         cd `dirname $@` && $(MAKE) man
183 man: $(C_SRCS) $(SUBDIRS:%=%/__man__)
184         if [ -n "$(C_SRCS)" ]; then $(MKINSTALLDIRS) $(TOPOBJDIR)/documentation/man3w; for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/man3w -S3w $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done; fi
186 $(SUBDIRS:%=%/__doc_html__): dummy
187         cd `dirname $@` && $(MAKE) doc-html
189 doc-html: $(C_SRCS) $(SUBDIRS:%=%/__doc_html__)
190         if [ -n "$(C_SRCS)" ]; then $(MKINSTALLDIRS) $(TOPOBJDIR)/documentation/html; for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/html -Th -iwindows.h  $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done; fi
192 .PHONY: man doc-html $(SUBDIRS:%=%/__man__) $(SUBDIRS:%=%/__doc_html__)
194 # Rule for linting
196 $(MODULE).ln : $(LINTS)
197         if test "$(LINTS)" ; \
198         then \
199                 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
200                 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
201         else \
202                 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
203         fi
205 lint:: $(MODULE).ln
207 # Rules for Windows API checking
209 winapi_check:: dummy
210         $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
212 .PHONY: winapi_check
214 # Rules for dependencies
216 $(SUBDIRS:%=%/__depend__): $(MAKEDEP) dummy
217         cd `dirname $@` && $(MAKE) depend
219 depend: $(MAKEDEP) $(SUBDIRS:%=%/__depend__)
220         $(MAKEDEP) $(DIVINCL) -C$(SRCDIR) $(C_SRCS) $(RC_SRCS) $(RC_SRCS16) $(MC_SRCS) $(EXTRA_SRCS)
222 .PHONY: depend $(SUBDIRS:%=%/__depend__)
224 # Rules for cleaning
226 $(SUBDIRS:%=%/__clean__): dummy
227         cd `dirname $@` && $(MAKE) clean
229 $(SUBDIRS:%=%/__testclean__): dummy
230         cd `dirname $@` && $(MAKE) testclean
232 $(EXTRASUBDIRS:%=%/__clean__): dummy
233         -cd `dirname $@` && $(RM) $(CLEAN_FILES)
235 testclean:: $(SUBDIRS:%=%/__testclean__)
237 clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
238         $(RM) $(CLEAN_FILES) $(GEN_C_SRCS) $(GEN_ASM_SRCS) $(RC_SRCS:.rc=.res) $(RC_SRCS16:.rc=.res) $(MC_SRCS:.mc=.mc.rc) $(PROGRAMS)
240 .PHONY: clean testclean $(SUBDIRS:%=%/__clean__) $(SUBDIRS:%=%/__testclean__) $(EXTRASUBDIRS:%=%/__clean__)
242 # Rules for installing
244 $(INSTALLSUBDIRS:%=%/__install__): dummy
245         cd `dirname $@` && $(MAKE) install
247 $(INSTALLSUBDIRS:%=%/__uninstall__): dummy
248         cd `dirname $@` && $(MAKE) uninstall
250 install:: $(INSTALLSUBDIRS:%=%/__install__)
252 uninstall:: $(INSTALLSUBDIRS:%=%/__uninstall__)
254 .PHONY: install uninstall $(INSTALLSUBDIRS:%=%/__install__) $(INSTALLSUBDIRS:%=%/__uninstall__)
256 # Rules for checking that no imports are missing
258 $(SUBDIRS:%=%/__checklink__): dummy
259         @cd `dirname $@` && $(MAKE) checklink
261 .PHONY: checklink $(SUBDIRS:%=%/__checklink__)
263 # Rules for testing
265 $(SUBDIRS:%=%/__test__): dummy
266         @cd `dirname $@` && $(MAKE) test
268 $(SUBDIRS:%=%/__crosstest__): dummy
269         @cd `dirname $@` && $(MAKE) crosstest
271 .PHONY: check test crosstest $(SUBDIRS:%=%/__test__) $(SUBDIRS:%=%/__crosstest__)
273 # Misc. rules
275 $(SPEC_SRCS:.spec=.spec.c): $(WINEBUILD)
277 $(RC_SRCS:.rc=.res): $(WRC)
279 $(RC_SRCS16:.rc=.res): $(WRC)
281 $(MC_SRCS:.mc=.mc.rc): $(WMC)
283 $(SUBDIRS): dummy
284         @cd $@ && $(MAKE)
286 dummy:
288 .PHONY: dummy $(SUBDIRS)
290 # End of global rules