Need to get any outstanding input prior to returning number.
[wine] / Make.rules.in
1 # Global rules shared by all makefiles     -*-Makefile-*-
2 #
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
8 #
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
22 # First some useful definitions
23
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 LIBS      = @LIBS@
34 YACC      = @YACC@
35 LEX       = @LEX@
36 LEXLIB    = @LEXLIB@
37 LIBEXT    = @LIBEXT@
38 LDSHARED  = @LDSHARED@
39 RANLIB    = @RANLIB@
40 LN_S      = @LN_S@
41 DIVINCL   = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include
42 ALLCFLAGS = $(DIVINCL) $(CFLAGS) $(DEFS) $(OPTIONS) $(X_CFLAGS)
43 LDCOMBINE = ld -r
44 LDFLAGS   = @LDFLAGS@
45 AR        = ar rc
46 RM        = rm -f
47 MV        = mv
48 MKDIR     = mkdir -p
49 C2MAN     = @C2MAN@
50 MANSPECS  = -w $(TOPSRCDIR)/dlls/gdi/gdi32.spec \
51             -w $(TOPSRCDIR)/dlls/user/user32.spec \
52             -w $(TOPSRCDIR)/dlls/comctl32/comctl32.spec \
53             -w $(TOPSRCDIR)/dlls/comdlg32/comdlg32.spec \
54             -w $(TOPSRCDIR)/dlls/kernel/kernel32.spec 
55 LINT      = @LINT@
56 LINTFLAGS = @LINTFLAGS@
57 ALLLINTFLAGS = $(LINTFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL)
58 WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi_check/winapi_check
59 WINEBUILD = $(TOPOBJDIR)/tools/winebuild/winebuild
60 MAKEDEP   = $(TOPOBJDIR)/tools/makedep
61 WRC       = $(TOPOBJDIR)/tools/wrc/wrc
62 WMC       = $(TOPOBJDIR)/tools/wmc/wmc
63 DLLDIR    = $(TOPOBJDIR)/dlls
64 @SET_MAKE@
65
66 # Installation infos
67
68 INSTALL         = @INSTALL@
69 INSTALL_PROGRAM = @INSTALL_PROGRAM@
70 INSTALL_DATA    = @INSTALL_DATA@
71 prefix          = @prefix@
72 exec_prefix     = @exec_prefix@
73 bindir          = @bindir@
74 libdir          = @libdir@
75 infodir         = @infodir@
76 mandir          = @mandir@
77 prog_manext     = 1
78 conf_manext     = 5
79 includedir      = @includedir@/wine
80 CLEAN_FILES     = *.o *.a *.so *.ln \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej \
81                   *.flc *.spec.c *.glue.c y.tab.c y.tab.h lex.yy.c core
82
83 OBJS = $(SPEC_SRCS:.spec=.spec.o) $(C_SRCS:.c=.o) $(GEN_C_SRCS:.c=.o) $(GEN_ASM_SRCS:.s=.o) \
84        $(ASM_SRCS:.S=.o) $(GLUE:.c=.glue.o) $(EXTRA_OBJS)
85
86 LINTS = $(C_SRCS:.c=.ln)
87
88 # DLL list
89
90 X_DLLS = \
91         ddraw \
92         @OPENGL32_DLL@ \
93         x11drv
94
95 DLLS = \
96         @X_DLLS@ \
97         advapi32 \
98         avifil32 \
99         comctl32 \
100         comdlg32 \
101         crtdll \
102         dciman32 \
103         dinput \
104         dplay \
105         dplayx \
106         dsound \
107         gdi32 \
108         icmp \
109         imagehlp \
110         imm32 \
111         joystick.drv \
112         kernel32 \
113         lz32 \
114         mcianim.drv \
115         mciavi.drv \
116         mcicda.drv \
117         mciseq.drv \
118         mciwave.drv \
119         midimap.drv \
120         mpr \
121         msacm.drv \
122         msacm32 \
123         msnet32 \
124         msvfw32 \
125         odbc32 \
126         ole32 \
127         oleaut32 \
128         olecli32 \
129         oledlg \
130         olepro32 \
131         olesvr32 \
132         psapi \
133         rasapi32 \
134         riched32 \
135         rpcrt4 \
136         serialui \
137         setupapi \
138         shell32 \
139         shfolder \
140         shlwapi \
141         tapi32 \
142         ttydrv \
143         urlmon \
144         user32 \
145         version \
146         w32skrnl \
147         wineoss.drv \
148         wineps \
149         wininet \
150         winmm \
151         winspool.drv \
152         wnaspi32 \
153         wow32 \
154         ws2_32 \
155         wsock32
156
157 # Implicit rules
158
159 .SUFFIXES: .mc .rc .res .spec .spec.c .spec.o .glue.c
160
161 .c.o:
162         $(CC) -c $(ALLCFLAGS) -o $*.o $<
163
164 .spec.c.spec.o:
165         $(CC) -c $(ALLCFLAGS) @GCC_NO_BUILTIN@ -o $*.spec.o $<
166
167 .s.o:
168         $(AS) -o $*.o $<  
169
170 .S.o:
171         $(CC) -c -o $*.o $<  
172
173 .mc.rc:
174         LD_LIBRARY_PATH="$(TOPOBJDIR):$$LD_LIBRARY_PATH" $(WMC) -i -H /dev/null -o $@ $<
175
176 .rc.res:
177         LD_LIBRARY_PATH="$(TOPOBJDIR):$$LD_LIBRARY_PATH" $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -r $<
178
179 .spec.spec.c:
180         LD_LIBRARY_PATH="$(TOPOBJDIR):$$LD_LIBRARY_PATH" $(WINEBUILD) @DLLFLAGS@ -o $@ -spec $<
181
182 .c.glue.c:
183         LD_LIBRARY_PATH="$(TOPOBJDIR):$$LD_LIBRARY_PATH" $(WINEBUILD) @DLLFLAGS@ -o $@ -glue $<
184
185 .c.ln:
186         $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
187
188 .PHONY: all install uninstall clean distclean depend dummy
189
190 # 'all' target first in case the enclosing Makefile didn't define any target
191
192 all: Makefile
193
194 # Rule to rebuild the resource compiler
195
196 $(WRC):
197         cd $(TOPOBJDIR)/tools/wrc && $(MAKE) wrc
198
199 # Rule to rebuild the message compiler
200
201 $(WMC):
202         cd $(TOPOBJDIR)/tools/wmc && $(MAKE) wmc
203
204 # Rule to rebuild the 'makedep' program
205
206 $(MAKEDEP):
207         cd $(TOPOBJDIR)/tools && $(MAKE) makedep
208
209 # Rule to rebuild the 'winebuild' program
210
211 $(WINEBUILD):
212         cd $(TOPOBJDIR)/tools/winebuild && $(MAKE) winebuild
213
214 # Rule for main module spec file
215
216 $(MODULE).spec.c: $(RC_SRCS:.rc=.res)
217
218 # Rules for makefile
219
220 Makefile: Makefile.in $(TOPSRCDIR)/configure
221         @echo Makefile is older than $?, please rerun $(TOPSRCDIR)/configure
222         @exit 1
223
224 # Rules for auto documentation
225
226 man: $(C_SRCS)
227         for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/man3w -S3w $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done
228
229 doc-html: $(C_SRCS)
230         for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/html -Th -iwindows.h  $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done
231
232 # Rule for linting
233
234 $(MODULE).ln : $(LINTS)
235         if test "$(LINTS)" ; \
236         then \
237                 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
238                 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
239         else \
240                 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
241         fi
242
243 lint:: $(MODULE).ln
244
245 # Rules for Windows API checking
246
247 winapi_check::
248         $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
249
250 # Rules for dependencies
251
252 $(SUBDIRS:%=%/__depend__): $(MAKEDEP) dummy
253         cd `dirname $@` && $(MAKE) depend
254
255 depend: $(MAKEDEP) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS) $(GEN_C_SRCS) $(SUBDIRS:%=%/__depend__)
256         $(MAKEDEP) $(DIVINCL) -C$(SRCDIR) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS) -C. $(GEN_C_SRCS)
257
258 # Rules for cleaning
259
260 $(SUBDIRS:%=%/__clean__): dummy
261         cd `dirname $@` && $(MAKE) clean
262
263 $(EXTRASUBDIRS:%=%/__clean__): dummy
264         -cd `dirname $@` && $(RM) $(CLEAN_FILES)
265
266 clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
267         $(RM) $(CLEAN_FILES) $(GEN_C_SRCS) $(GEN_ASM_SRCS) $(RC_SRCS:.rc=.res) $(MC_SRCS:.mc=.rc) $(PROGRAMS)
268
269 # Rules for installing
270
271 $(SUBDIRS:%=%/__install__): dummy
272         cd `dirname $@` && $(MAKE) install
273
274 $(SUBDIRS:%=%/__uninstall__): dummy
275         cd `dirname $@` && $(MAKE) uninstall
276
277 # Misc. rules
278
279 $(SPEC_SRCS:.spec=.spec.c): $(WINEBUILD) $(TOPSRCDIR)/include/builtin16.h
280
281 $(GLUE:.c=.glue.c): $(WINEBUILD) $(TOPSRCDIR)/include/builtin16.h
282
283 $(RC_SRCS:.rc=.res): $(WRC)
284
285 $(MC_SRCS:.mc=.rc): $(WMC)
286
287 $(SUBDIRS): dummy
288         @cd $@ && $(MAKE)
289
290 dummy:
291
292 # End of global rules