Initialize the DDCAPS structure of the DDRAW object at creation.
[wine/multimedia.git] / Make.rules.in
blobf07b8d1408db37e2feaf37c44174e9a2d3a3c330
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
23 # PLTESTS      : Perl test scripts
24 # CTESTS       : C test sources
26 # First some useful definitions
28 SHELL     = /bin/sh
29 CC        = @CC@
30 CPP       = @CPP@
31 CFLAGS    = @CFLAGS@ $(EXTRACFLAGS)
32 OPTIONS   = @OPTIONS@ -D_REENTRANT
33 X_CFLAGS  = @X_CFLAGS@
34 X_LIBS    = @X_LIBS@
35 XLIB      = @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@
36 LIBS      = @LIBS@
37 YACC      = @YACC@
38 LEX       = @LEX@
39 LEXLIB    = @LEXLIB@
40 EXEEXT    = @EXEEXT@
41 OBJEXT    = @OBJEXT@
42 LIBEXT    = @LIBEXT@
43 DLLEXT    = @DLLEXT@
44 LDSHARED  = @LDSHARED@
45 DLLWRAP   = @DLLWRAP@
46 DLLWRAPFLAGS = --add-stdcall-alias
47 AR        = @AR@ rc
48 RANLIB    = @RANLIB@
49 STRIP     = @STRIP@
50 WINDRES   = @WINDRES@
51 LN        = @LN@
52 LN_S      = @LN_S@
53 TOOLSDIR  = @TOOLSDIR@
54 DIVINCL   = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include $(EXTRAINCL)
55 ALLCFLAGS = $(DIVINCL) $(CFLAGS) $(DEFS) $(OPTIONS) $(X_CFLAGS)
56 LD        = @LD@
57 LDFLAGS   = @LDFLAGS@
58 LDCOMBINE = $(LD) -r
59 RM        = rm -f
60 MV        = mv
61 C2MAN     = @C2MAN@
62 MANSPECS  = -w $(TOPSRCDIR)/dlls/gdi/gdi32.spec \
63             -w $(TOPSRCDIR)/dlls/user/user32.spec \
64             -w $(TOPSRCDIR)/dlls/comctl32/comctl32.spec \
65             -w $(TOPSRCDIR)/dlls/commdlg/comdlg32.spec \
66             -w $(TOPSRCDIR)/dlls/kernel/kernel32.spec
67 LINT      = @LINT@
68 LINTFLAGS = @LINTFLAGS@
69 ALLLINTFLAGS = $(LINTFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL)
70 MKINSTALLDIRS= $(TOPSRCDIR)/tools/mkinstalldirs
71 WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi_check/winapi_check
72 WINEWRAPPER  = $(TOPSRCDIR)/tools/winewrapper
73 WINEBUILD    = $(TOOLSDIR)/tools/winebuild/winebuild
74 MAKEDEP      = $(TOOLSDIR)/tools/makedep
75 WRC          = $(TOOLSDIR)/tools/wrc/wrc
76 WMC          = $(TOOLSDIR)/tools/wmc/wmc
77 LDPATH    = @LDPATH@
78 DLLDIR    = $(TOPOBJDIR)/dlls
79 LIBWINE   = -L$(TOPOBJDIR)/library -lwine
80 LIBTSX11  = -L$(TOPOBJDIR)/tsx11 -lwine_tsx11
81 LIBUNICODE= -L$(TOPOBJDIR)/unicode -lwine_unicode
82 LIBUUID   = -L$(TOPOBJDIR)/ole -lwine_uuid
84 RUNTEST      = $(TOPSRCDIR)/programs/winetest/runtest
85 RUNTESTFLAGS = -q -P wine -M $(MODULE) -T $(TOPOBJDIR)
86 TESTRESULTS  = $(PLTESTS:.pl=.ok) $(CTESTS:.c=.ok)
87 TESTPROGRAM  = tests/$(MODULE:%.dll=%)_test.exe
88 TESTLIST     = tests/testlist.c
89 TESTOBJS     = $(TESTMAIN) $(TESTLIST:.c=.o) $(CTESTS:.c=.o)
90 TESTMAIN     = $(TOPOBJDIR)/programs/winetest/wtmain.o
92 @SET_MAKE@
94 # Installation infos
96 INSTALL         = @INSTALL@ $(INSTALL_FLAGS)
97 INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(INSTALL_PROGRAM_FLAGS)
98 INSTALL_SCRIPT  = @INSTALL_SCRIPT@ $(INSTALL_SCRIPT_FLAGS)
99 INSTALL_DATA    = @INSTALL_DATA@ $(INSTALL_DATA_FLAGS)
100 prefix          = @prefix@
101 exec_prefix     = @exec_prefix@
102 bindir          = @bindir@
103 libdir          = @libdir@
104 datadir         = @datadir@
105 infodir         = @infodir@
106 mandir          = @mandir@
107 sysconfdir      = @sysconfdir@
108 includedir      = @includedir@/wine
109 dlldir          = @libdir@/wine
110 prog_manext     = 1
111 conf_manext     = 5
112 CLEAN_FILES     = *.o *.a *.so *.ln *.$(LIBEXT) \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej \
113                   *.flc *.spec.c *.spec.def *.glue.c *.dbg.c y.tab.c y.tab.h @LEX_OUTPUT_ROOT@.c core
115 OBJS = $(C_SRCS:.c=.o) $(GEN_C_SRCS:.c=.o) $(GEN_ASM_SRCS:.s=.o) $(ASM_SRCS:.S=.o) $(EXTRA_OBJS)
117 RCOBJS = $(RC_SRCS:.rc=.res.o)
118 LINTS  = $(C_SRCS:.c=.ln)
120 # Implicit rules
122 .SUFFIXES: .mc .rc .mc.rc .res .res.o .spec .spec.c .spec.def .pl .ok
124 .c.o:
125         $(CC) -c $(ALLCFLAGS) -o $@ $<
127 .s.o:
128         $(AS) -o $@ $<
130 .S.o:
131         $(CC) -c -o $@ $<
133 .mc.mc.rc:
134         $(LDPATH) $(WMC) -i -H /dev/null -o $@ $<
136 .rc.res:
137         $(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -r $<
139 .res.res.o:
140         $(WINDRES) -i $< -o $@
142 .spec.spec.c:
143         $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -M $(MODULE) -spec $<
145 .spec.spec.def:
146         $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -def $<
148 .c.ln:
149         $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
151 .c.ok:
152         $(RUNTEST) $(RUNTESTFLAGS) -p $(TESTPROGRAM)$(DLLEXT) $< && touch $@
154 .pl.ok:
155         $(RUNTEST) $(RUNTESTFLAGS) $(PLTESTPROGRAM:%=-p %) $< && touch $@
157 # 'all' target first in case the enclosing Makefile didn't define any target
159 all: Makefile
161 filter:
162         @$(TOPSRCDIR)/tools/winapi/make_filter --make $(MAKE) all
164 .PHONY: all filter
166 # Rule for main module debug channels
168 $(MODULE).dbg.c: $(C_SRCS) $(WINEBUILD)
169         $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -debug -C$(SRCDIR) $(C_SRCS)
171 # Rule for 16-bit glue
173 $(MODULE).glue.c: $(C_SRCS) $(WINEBUILD)
174         $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -glue -C$(SRCDIR) $(C_SRCS)
176 # Rule to rebuild the tools
178 $(MAKEDEP) $(WINEBUILD) $(WMC) $(WRC):
179         cd $(TOOLSDIR)/tools && $(MAKE) `basename $@`
181 # Rules for makefile
183 Makefile: Makefile.in $(TOPSRCDIR)/configure
184         @echo Makefile is older than $?, please rerun $(TOPSRCDIR)/configure
185         @exit 1
187 # Rules for auto documentation
189 $(SUBDIRS:%=%/__man__): dummy
190         cd `dirname $@` && $(MAKE) man
192 man: $(C_SRCS) $(SUBDIRS:%=%/__man__)
193         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
195 $(SUBDIRS:%=%/__doc_html__): dummy
196         cd `dirname $@` && $(MAKE) doc-html
198 doc-html: $(C_SRCS) $(SUBDIRS:%=%/__doc_html__)
199         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
201 .PHONY: man doc-html $(SUBDIRS:%=%/__man__) $(SUBDIRS:%=%/__doc_html__)
203 # Rule for linting
205 $(MODULE).ln : $(LINTS)
206         if test "$(LINTS)" ; \
207         then \
208                 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
209                 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
210         else \
211                 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
212         fi
214 lint:: $(MODULE).ln
216 # Rules for Windows API checking
218 winapi_check:: dummy
219         $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
221 .PHONY: winapi_check
223 # Rules for dependencies
225 $(SUBDIRS:%=%/__depend__): $(MAKEDEP) dummy
226         cd `dirname $@` && $(MAKE) depend
228 depend: $(MAKEDEP) $(SUBDIRS:%=%/__depend__)
229         $(MAKEDEP) $(DIVINCL) -C$(SRCDIR) $(C_SRCS) $(RC_SRCS) $(RC_SRCS16) $(MC_SRCS) $(EXTRA_SRCS) $(CTESTS)
231 .PHONY: depend $(SUBDIRS:%=%/__depend__)
233 # Rules for cleaning
235 $(SUBDIRS:%=%/__clean__): dummy
236         cd `dirname $@` && $(MAKE) clean
238 $(SUBDIRS:%=%/__testclean__): dummy
239         cd `dirname $@` && $(MAKE) testclean
241 $(EXTRASUBDIRS:%=%/__clean__): dummy
242         -cd `dirname $@` && $(RM) $(CLEAN_FILES)
244 testclean:: $(SUBDIRS:%=%/__testclean__)
245         $(RM) $(TESTRESULTS)
247 clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
248         $(RM) $(CLEAN_FILES) $(GEN_C_SRCS) $(GEN_ASM_SRCS) $(RC_SRCS:.rc=.res) $(RC_SRCS16:.rc=.res) $(MC_SRCS:.mc=.mc.rc) $(TESTRESULTS) $(TESTLIST) $(TESTPROGRAM) $(PROGRAMS)
250 .PHONY: clean testclean $(SUBDIRS:%=%/__clean__) $(SUBDIRS:%=%/__testclean__) $(EXTRASUBDIRS:%=%/__clean__)
252 # Rules for installing
254 $(INSTALLSUBDIRS:%=%/__install__): dummy
255         cd `dirname $@` && $(MAKE) install
257 $(INSTALLSUBDIRS:%=%/__uninstall__): dummy
258         cd `dirname $@` && $(MAKE) uninstall
260 install:: $(INSTALLSUBDIRS:%=%/__install__)
262 uninstall:: $(INSTALLSUBDIRS:%=%/__uninstall__)
264 .PHONY: install uninstall $(INSTALLSUBDIRS:%=%/__install__) $(INSTALLSUBDIRS:%=%/__uninstall__)
266 # Rules for testing
268 check test:: $(TESTRESULTS)
270 $(SUBDIRS:%=%/__test__): dummy
271         @cd `dirname $@` && $(MAKE) test
273 .PHONY: check test $(SUBDIRS:%=%/__test__)
275 $(PLTESTS:.pl=.ok): $(PLTESTPROGRAM)
276 $(CTESTS:.c=.ok): $(TESTPROGRAM)$(DLLEXT)
278 $(TESTMAIN):
279         cd $(TOPOBJDIR)/programs/winetest && $(MAKE) wtmain.o
281 $(TESTLIST): Makefile.in
282         $(TOPSRCDIR)/programs/winetest/make_ctests $(CTESTS) >$(TESTLIST) || $(RM) $(TESTLIST)
284 $(TESTPROGRAM).so: $(TESTPROGRAM).spec.o $(TESTOBJS)
285         $(LDSHARED) @LDDLLFLAGS@ $(TESTPROGRAM).spec.o $(TESTOBJS) -o $@ $(LIBWINE) $(LIBS)
287 $(TESTPROGRAM).spec.c: $(TESTOBJS) $(WINEBUILD)
288         $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -exe $(TESTPROGRAM) -mcui $(TESTOBJS) -L$(DLLDIR) $(TESTIMPORTS:%=-l%)
290 $(TESTPROGRAM): $(TESTOBJS)
291         $(CC) $(TESTOBJS) -o $@ $(TESTIMPORTS:%=-l%) $(LIBWINE) $(LIBS)
293 # Misc. rules
295 $(SPEC_SRCS:.spec=.spec.c): $(WINEBUILD)
297 $(RC_SRCS:.rc=.res): $(WRC)
299 $(RC_SRCS16:.rc=.res): $(WRC)
301 $(MC_SRCS:.mc=.mc.rc): $(WMC)
303 $(SUBDIRS): dummy
304         @cd $@ && $(MAKE)
306 dummy:
308 .PHONY: dummy $(SUBDIRS)
310 # End of global rules