Implemented thread and (partial) module snapshots, based on the work
[wine/multimedia.git] / Make.rules.in
blob3df717487063b1e335af974a6c46a0730218e39c
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_ASM_SRCS : generated assembly sources
13 # RC_SRCS      : resource source files
14 # SPEC_SRCS    : interface definition files
15 # GLUE         : C sources for which glue code needs to be generated
16 # EXTRA_SRCS   : extra source files for make depend
17 # EXTRA_OBJS   : extra object files
18 # WRCEXTRA     : extra wrc flags (e.g. '-p _SysRes')
19 # SUBDIRS      : subdirectories that contain a Makefile
20 # EXTRASUBDIRS : subdirectories that do not contain a Makefile
22 # First some useful definitions
24 SHELL     = /bin/sh
25 CC        = @CC@
26 CPP       = @CPP@
27 CFLAGS    = @CFLAGS@
28 OPTIONS   = @OPTIONS@ -D_REENTRANT
29 X_CFLAGS  = @X_CFLAGS@
30 X_LIBS    = @X_LIBS@
31 XLIB      = @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@
32 DLL_LINK  = @DLL_LINK@
33 WINELIB   = $(DLL_LINK)
34 LIBS      = @LIBS@
35 YACC      = @YACC@
36 LEX       = @LEX@
37 LEXLIB    = @LEXLIB@
38 RANLIB    = @RANLIB@
39 LN_S      = @LN_S@
40 DIVINCL   = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include
41 ALLCFLAGS = $(DIVINCL) $(CFLAGS) $(DEFS) $(OPTIONS) $(X_CFLAGS)
42 LDCOMBINE = ld -r
43 AR        = ar rc
44 RM        = rm -f
45 MV        = mv
46 MKDIR     = mkdir -p
47 C2MAN     = @C2MAN@
48 MANSPECS  = -w $(TOPSRCDIR)/relay32/gdi32.spec \
49             -w $(TOPSRCDIR)/relay32/user32.spec \
50             -w $(TOPSRCDIR)/relay32/comctl32.spec \
51             -w $(TOPSRCDIR)/relay32/comdlg32.spec \
52             -w $(TOPSRCDIR)/relay32/kernel32.spec 
53 LINT      = @LINT@
54 LINTFLAGS = @LINTFLAGS@
55 ALLLINTFLAGS = $(LINTFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL)
56 WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi_check/winapi_check
57 BUILD     = $(TOPOBJDIR)/tools/build@PROGEXT@
58 MAKEDEP   = $(TOPOBJDIR)/tools/makedep@PROGEXT@
59 WRC       = $(TOPOBJDIR)/tools/wrc/wrc@PROGEXT@
60 WRCFLAGS  = -c
61 DLLDIR    = $(TOPOBJDIR)/dlls
62 @SET_MAKE@
64 # Installation infos
66 INSTALL         = @INSTALL@
67 INSTALL_PROGRAM = @INSTALL_PROGRAM@
68 INSTALL_DATA    = @INSTALL_DATA@
69 prefix          = @prefix@
70 exec_prefix     = @exec_prefix@
71 bindir          = @bindir@
72 libdir          = @libdir@
73 infodir         = @infodir@
74 mandir          = @mandir@
75 prog_manext     = 1
76 conf_manext     = 5
77 includedir      = @includedir@/wine
78 CLEAN_FILES     = *.o *.a *.so *.ln \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej *.flc \
79                   *.spec.c *.glue.c y.tab.c y.tab.h lex.yy.c core
81 OBJS = $(SPEC_SRCS:.spec=.spec.o) $(C_SRCS:.c=.o) $(GEN_ASM_SRCS:.s=.o) \
82        $(ASM_SRCS:.S=.o) $(RC_SRCS:.rc=.o) $(GLUE:.c=.glue.o) $(EXTRA_OBJS)
84 LINTS = $(C_SRCS:.c=.ln)
86 # DLL list
88 DLLS = \
89         avifil32 \
90         comctl32 \
91         comdlg32 \
92         dciman32 \
93         ddraw \
94         dinput \
95         dplayx \
96         dsound \
97         gdi32 \
98         icmp \
99         imagehlp \
100         imm32 \
101         joystick.drv \
102         lz32 \
103         mcianim.drv \
104         mciavi.drv \
105         mcicda.drv \
106         mciseq.drv \
107         mciwave.drv \
108         midimap.drv \
109         mpr \
110         msacm \
111         msacm.drv \
112         msacm32 \
113         msnet32 \
114         msvfw32 \
115         odbc32 \
116         ole32 \
117         oleaut32 \
118         olecli32 \
119         oledlg \
120         olepro32 \
121         olesvr32 \
122         psapi \
123         rasapi32 \
124         setupx \
125         shell32 \
126         sound \
127         stress \
128         tapi32 \
129         ttydrv \
130         urlmon \
131         user32 \
132         version \
133         w32skrnl \
134         win87em \
135         windebug \
136         wineoss.drv \
137         wing \
138         wininet \
139         winmm \
140         winspool \
141         wnaspi32 \
142         wsock32 \
143         x11drv
145 # Implicit rules
147 .SUFFIXES:
148 .SUFFIXES: .rc .res .spec .spec.c .spec.o .glue.c $(SUFFIXES)
150 .c.o:
151         $(CC) -c $(ALLCFLAGS) -o $*.o $<
153 .spec.c.spec.o:
154         $(CC) -c $(ALLCFLAGS) @GCC_NO_BUILTIN@ -o $*.spec.o $<
156 .s.o:
157         $(AS) -o $*.o $<  
159 .S.o:
160         $(CC) -c -o $*.o $<  
162 .rc.s:
163         $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) $<
165 .rc.h:
166         $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) -nh $<
168 .rc.res:
169         $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) -r $<
171 .res.s:
172         $(WRC) $(WRCFLAGS) $(WRCEXTRA) -b $<
174 .res.h:
175         $(WRC) $(WRCFLAGS) $(WRCEXTRA) -bnh $<
177 .spec.spec.c:
178         $(BUILD) @BUILDFLAGS@ -o $@ -spec $<
180 .c.glue.c:
181         $(BUILD) @BUILDFLAGS@ -o $@ -glue $<
183 .c.ln:
184         $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
186 .PHONY: all install uninstall clean distclean depend dummy
188 # 'all' target first in case the enclosing Makefile didn't define any target
190 all: Makefile
192 # Rule to rebuild the resource compiler
194 $(WRC) check_wrc:
195         cd $(TOPOBJDIR)/tools/wrc && $(MAKE) wrc@PROGEXT@
197 # Rule to rebuild the 'makedep' program
199 $(MAKEDEP) check_makedep:
200         cd $(TOPOBJDIR)/tools && $(MAKE) makedep@PROGEXT@
202 # Rule to rebuild the 'build' program
204 $(BUILD) checkbuild:
205         cd $(TOPOBJDIR)/tools && $(MAKE) build@PROGEXT@
207 # Rule for main module
209 $(MODULE).o: $(OBJS) Makefile.in $(TOPSRCDIR)/Make.rules.in
210         $(LDCOMBINE) $(OBJS) -o $(MODULE).o
212 # Rules for makefile
214 Makefile: Makefile.in $(TOPSRCDIR)/configure
215         @echo Makefile is older than $?, please rerun $(TOPSRCDIR)/configure
216         @exit 1
218 # Rules for auto documentation
220 man: $(C_SRCS)
221         for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/man3w -S3w $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done
223 html: $(C_SRCS)
224         for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/html -Th -iwindows.h  $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done
226 # Rule for linting
228 $(MODULE).ln : $(LINTS)
229         if test "$(LINTS)" ; \
230         then \
231                 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
232                 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
233         else \
234                 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
235         fi
237 lint:: $(MODULE).ln
239 # Rules for Windows API checking
241 winapi_check::
242         $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
244 # Rules for dependencies
246 $(SUBDIRS:%=%/__depend__): $(MAKEDEP) dummy
247         cd `dirname $@` && $(MAKE) depend
249 depend: $(MAKEDEP) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS) $(SUBDIRS:%=%/__depend__)
250         $(MAKEDEP) $(DIVINCL) -C$(SRCDIR) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS)
252 # Rules for cleaning
254 $(SUBDIRS:%=%/__clean__): dummy
255         cd `dirname $@` && $(MAKE) clean
257 $(EXTRASUBDIRS:%=%/__clean__): dummy
258         -cd `dirname $@` && $(RM) $(CLEAN_FILES)
260 clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
261         $(RM) $(CLEAN_FILES) $(GEN_ASM_SRCS) $(RC_SRCS:.rc=.s) $(RC_SRCS:.rc=.h) $(PROGRAMS)
263 # Misc. rules
265 $(SPEC_SRCS:.spec=.spec.c): $(BUILD) $(TOPSRCDIR)/include/builtin16.h $(TOPSRCDIR)/include/builtin32.h
267 $(GLUE:.c=.glue.c): $(BUILD) $(TOPSRCDIR)/include/builtin16.h $(TOPSRCDIR)/include/builtin32.h
269 $(RC_SRCS:.rc=.s): $(WRC)
271 $(SUBDIRS): dummy
272         @cd $@ && $(MAKE)
274 dummy:
276 # End of global rules