SetFileAttributes returns now an error if target file is on CDROM.
[wine/multimedia.git] / Make.rules.in
blob25fb0d74b025aec6d56c91b24e0adce0b5d7da20
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 # GLUE         : C sources for which glue code needs to be generated
17 # EXTRA_SRCS   : extra source files for make depend
18 # EXTRA_OBJS   : extra object files
19 # SUBDIRS      : subdirectories that contain a Makefile
20 # EXTRASUBDIRS : subdirectories that do not contain a Makefile
21 # PLTESTS      : Perl test scripts
22 # CTESTS       : C test sources
24 # First some useful definitions
26 SHELL     = /bin/sh
27 CC        = @CC@
28 CPP       = @CPP@
29 CFLAGS    = @CFLAGS@
30 OPTIONS   = @OPTIONS@ -D_REENTRANT
31 X_CFLAGS  = @X_CFLAGS@
32 X_LIBS    = @X_LIBS@
33 XLIB      = @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@
34 LIBS      = @LIBS@
35 YACC      = @YACC@
36 LEX       = @LEX@
37 LEXLIB    = @LEXLIB@
38 LIBEXT    = @LIBEXT@
39 LDSHARED  = @LDSHARED@
40 DLLWRAP   = @DLLWRAP@
41 DLLWRAPFLAGS = --add-stdcall-alias
42 RANLIB    = @RANLIB@
43 LN_S      = @LN_S@
44 DIVINCL   = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include $(EXTRAINCL)
45 ALLCFLAGS = $(DIVINCL) $(CFLAGS) $(DEFS) $(OPTIONS) $(X_CFLAGS)
46 LDCOMBINE = @LDCOMBINE@
47 LDFLAGS   = @LDFLAGS@
48 AR        = ar rc
49 RM        = rm -f
50 MV        = mv
51 MKDIR     = mkdir -p
52 C2MAN     = @C2MAN@
53 MANSPECS  = -w $(TOPSRCDIR)/dlls/gdi/gdi32.spec \
54             -w $(TOPSRCDIR)/dlls/user/user32.spec \
55             -w $(TOPSRCDIR)/dlls/comctl32/comctl32.spec \
56             -w $(TOPSRCDIR)/dlls/commdlg/comdlg32.spec \
57             -w $(TOPSRCDIR)/dlls/kernel/kernel32.spec 
58 LINT      = @LINT@
59 LINTFLAGS = @LINTFLAGS@
60 ALLLINTFLAGS = $(LINTFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL)
61 WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi_check/winapi_check
62 WINETEST     = $(TOPOBJDIR)/programs/winetest/winetest
63 RUNTEST      = $(TOPSRCDIR)/programs/winetest/runtest
64 RUNTESTFLAGS = -q -P wine -M $(MODULE) -T $(TOPOBJDIR)
65 TESTRESULTS  = $(PLTESTS:.pl=.ok) $(CTESTS:.c=.ok)
66 WINEBUILD = $(TOPOBJDIR)/tools/winebuild/winebuild
67 MAKEDEP   = $(TOPOBJDIR)/tools/makedep
68 WRC       = $(TOPOBJDIR)/tools/wrc/wrc
69 WMC       = $(TOPOBJDIR)/tools/wmc/wmc
70 LDPATH    = @LDPATH@
71 DLLDIR    = $(TOPOBJDIR)/dlls
72 LIBWINE   = -L$(TOPOBJDIR)/library -lwine
73 LIBTSX11  = -L$(TOPOBJDIR)/tsx11 -lwine_tsx11
74 LIBUNICODE= -L$(TOPOBJDIR)/unicode -lwine_unicode
75 LIBUUID   = -L$(TOPOBJDIR)/ole -lwine_uuid
77 @SET_MAKE@
79 # Installation infos
81 INSTALL         = @INSTALL@
82 INSTALL_PROGRAM = @INSTALL_PROGRAM@
83 INSTALL_SCRIPT  = @INSTALL_SCRIPT@
84 INSTALL_DATA    = @INSTALL_DATA@
85 prefix          = @prefix@
86 exec_prefix     = @exec_prefix@
87 bindir          = @bindir@
88 libdir          = @libdir@
89 infodir         = @infodir@
90 mandir          = @mandir@
91 prog_manext     = 1
92 conf_manext     = 5
93 includedir      = @includedir@/wine
94 CLEAN_FILES     = *.o *.a *.so *.ln \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej \
95                   *.flc *.spec.c *.spec.def *.glue.c y.tab.c y.tab.h lex.yy.c core
97 OBJS = $(SPEC_SRCS:.spec=.spec.o) $(C_SRCS:.c=.o) $(GEN_C_SRCS:.c=.o) $(GEN_ASM_SRCS:.s=.o) \
98        $(ASM_SRCS:.S=.o) $(GLUE:.c=.glue.o) $(EXTRA_OBJS)
100 LINTS = $(C_SRCS:.c=.ln)
102 # Implicit rules
104 .SUFFIXES: .mc .rc .mc.rc .res .spec .spec.c .spec.def .glue.c .pl .ok
106 .c.o:
107         $(CC) -c $(ALLCFLAGS) -o $@ $<
109 .s.o:
110         $(AS) -o $@ $<
112 .S.o:
113         $(CC) -c -o $@ $<
115 .mc.mc.rc:
116         $(LDPATH) $(WMC) -i -H /dev/null -o $@ $<
118 .rc.res:
119         $(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -r $<
121 .spec.spec.c:
122         $(LDPATH) $(WINEBUILD) @DLLFLAGS@ -L$(DLLDIR) -o $@ -spec $<
124 .spec.spec.def:
125         $(LDPATH) $(WINEBUILD) @DLLFLAGS@ -L$(DLLDIR) -o $@ -def $<
127 .c.glue.c:
128         $(LDPATH) $(WINEBUILD) @DLLFLAGS@ -o $@ -glue $<
130 .c.ln:
131         $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
133 .pl.ok:
134         $(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
136 .PHONY: all install uninstall clean distclean depend dummy test testclean
138 # 'all' target first in case the enclosing Makefile didn't define any target
140 all: Makefile
142 filter:
143         @$(TOPSRCDIR)/tools/winapi/make_filter --make $(MAKE) all
145 # Rule for main module intermediate object
147 $(MODULE).tmp.o: $(OBJS) Makefile.in
148         $(LDCOMBINE) $(OBJS) -o $@
149         -strip --strip-unneeded $@
151 # Rule for main module spec file
153 $(MODULE).spec.c: $(MODULE).spec $(RC_SRCS:.rc=.res) $(SYMBOLFILE) $(WINEBUILD)
154         $(LDPATH) $(WINEBUILD) @DLLFLAGS@ -L$(DLLDIR) $(SYMBOLFILE:%=-sym %) -o $@ -spec $(SRCDIR)/$(MODULE).spec
156 # Rule to rebuild the resource compiler
158 $(WRC):
159         cd $(TOPOBJDIR)/tools/wrc && $(MAKE) wrc
161 # Rule to rebuild the message compiler
163 $(WMC):
164         cd $(TOPOBJDIR)/tools/wmc && $(MAKE) wmc
166 # Rule to rebuild the 'makedep' program
168 $(MAKEDEP):
169         cd $(TOPOBJDIR)/tools && $(MAKE) makedep
171 # Rule to rebuild the 'winebuild' program
173 $(WINEBUILD):
174         cd $(TOPOBJDIR)/tools/winebuild && $(MAKE) winebuild
176 # Rules for makefile
178 Makefile: Makefile.in $(TOPSRCDIR)/configure
179         @echo Makefile is older than $?, please rerun $(TOPSRCDIR)/configure
180         @exit 1
182 # Rules for auto documentation
184 $(SUBDIRS:%=%/__man__): dummy
185         cd `dirname $@` && $(MAKE) man
187 man: $(C_SRCS) $(SUBDIRS:%=%/__man__)
188         if [ -n "$(C_SRCS)" ]; then $(MKDIR) $(TOPOBJDIR)/documentation/man3w; for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/man3w -S3w $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done; fi
190 $(SUBDIRS:%=%/__doc_html__): dummy
191         cd `dirname $@` && $(MAKE) doc-html
193 doc-html: $(C_SRCS) $(SUBDIRS:%=%/__doc_html__)
194         if [ -n "$(C_SRCS)" ]; then $(MKDIR) $(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
196 # Rule for linting
198 $(MODULE).ln : $(LINTS)
199         if test "$(LINTS)" ; \
200         then \
201                 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
202                 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
203         else \
204                 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
205         fi
207 lint:: $(MODULE).ln
209 # Rules for Windows API checking
211 winapi_check::
212         $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
214 # Rules for dependencies
216 $(SUBDIRS:%=%/__depend__): $(MAKEDEP) dummy
217         cd `dirname $@` && $(MAKE) depend
219 depend: $(MAKEDEP) $(GEN_C_SRCS) $(SUBDIRS:%=%/__depend__)
220         $(MAKEDEP) $(DIVINCL) -C$(SRCDIR) $(C_SRCS) $(RC_SRCS) $(RC_SRCS16) $(MC_SRCS) $(EXTRA_SRCS) -C. $(GEN_C_SRCS)
222 # Rules for cleaning
224 $(SUBDIRS:%=%/__clean__): dummy
225         cd `dirname $@` && $(MAKE) clean
227 $(SUBDIRS:%=%/__testclean__): dummy
228         cd `dirname $@` && $(MAKE) testclean
230 $(EXTRASUBDIRS:%=%/__clean__): dummy
231         -cd `dirname $@` && $(RM) $(CLEAN_FILES)
233 testclean:: $(SUBDIRS:%=%/__testclean__)
234         $(RM) $(TESTRESULTS)
236 clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
237         $(RM) $(CLEAN_FILES) $(GEN_C_SRCS) $(GEN_ASM_SRCS) $(RC_SRCS:.rc=.res) $(RC_SRCS16:.rc=.res) $(MC_SRCS:.mc=.mc.rc) $(TESTRESULTS) $(PROGRAMS)
239 # Rules for installing
241 $(SUBDIRS:%=%/__install__): dummy
242         cd `dirname $@` && $(MAKE) install
244 $(SUBDIRS:%=%/__uninstall__): dummy
245         cd `dirname $@` && $(MAKE) uninstall
247 # Rules for testing
249 test:: $(TESTRESULTS)
251 $(TESTRESULTS): $(WINETEST)
253 $(WINETEST):
254         cd $(TOPOBJDIR)/programs/winetest && $(MAKE) winetest
256 # Misc. rules
258 $(SPEC_SRCS:.spec=.spec.c): $(WINEBUILD)
260 $(SPEC_SRCS:.spec=.spec.def): $(WINEBUILD)
262 $(GLUE:.c=.glue.c): $(WINEBUILD)
264 $(RC_SRCS:.rc=.res): $(WRC)
266 $(RC_SRCS16:.rc=.res): $(WRC)
268 $(MC_SRCS:.mc=.mc.rc): $(WMC)
270 $(SUBDIRS): dummy
271         @cd $@ && $(MAKE)
273 dummy:
275 # End of global rules