Created separate libraries for dplay, shfolder, shlwapi, wow32 and
[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 # WRCEXTRA     : extra wrc flags (e.g. '-p _SysRes')
20 # SUBDIRS      : subdirectories that contain a Makefile
21 # EXTRASUBDIRS : subdirectories that do not contain a Makefile
22
23 # First some useful definitions
24
25 SHELL     = /bin/sh
26 CC        = @CC@
27 CPP       = @CPP@
28 CFLAGS    = @CFLAGS@
29 OPTIONS   = @OPTIONS@ -D_REENTRANT
30 X_CFLAGS  = @X_CFLAGS@
31 X_LIBS    = @X_LIBS@
32 XLIB      = @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@
33 DLL_LINK  = @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/winebuild/winebuild
58 MAKEDEP   = $(TOPOBJDIR)/tools/makedep
59 WRC       = $(TOPOBJDIR)/tools/wrc/wrc
60 WRCFLAGS  = -c -s -p $*
61 WMC       = $(TOPOBJDIR)/tools/wmc/wmc
62 DLLDIR    = $(TOPOBJDIR)/dlls
63 @SET_MAKE@
64
65 # Installation infos
66
67 INSTALL         = @INSTALL@
68 INSTALL_PROGRAM = @INSTALL_PROGRAM@
69 INSTALL_DATA    = @INSTALL_DATA@
70 prefix          = @prefix@
71 exec_prefix     = @exec_prefix@
72 bindir          = @bindir@
73 libdir          = @libdir@
74 infodir         = @infodir@
75 mandir          = @mandir@
76 prog_manext     = 1
77 conf_manext     = 5
78 includedir      = @includedir@/wine
79 CLEAN_FILES     = *.o *.a *.so *.ln \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej \
80                   *.flc *.spec.c *.glue.c y.tab.c y.tab.h lex.yy.c core
81
82 OBJS = $(SPEC_SRCS:.spec=.spec.o) $(C_SRCS:.c=.o) $(GEN_C_SRCS:.c=.o) $(GEN_ASM_SRCS:.s=.o) \
83        $(ASM_SRCS:.S=.o) $(RC_SRCS:.rc=.o) $(GLUE:.c=.glue.o) $(EXTRA_OBJS)
84
85 LINTS = $(C_SRCS:.c=.ln)
86
87 # DLL list
88
89 X_DLLS = \
90         ddraw \
91         @OPENGL32_DLL@ \
92         x11drv
93
94 DLLS = \
95         @X_DLLS@ \
96         avifil32 \
97         comctl32 \
98         comdlg32 \
99         crtdll \
100         dciman32 \
101         dinput \
102         dplay \
103         dplayx \
104         dsound \
105         gdi32 \
106         icmp \
107         imagehlp \
108         imm32 \
109         joystick.drv \
110         kernel32 \
111         lz32 \
112         mcianim.drv \
113         mciavi.drv \
114         mcicda.drv \
115         mciseq.drv \
116         mciwave.drv \
117         midimap.drv \
118         mpr \
119         msacm \
120         msacm.drv \
121         msacm32 \
122         msnet32 \
123         msvfw32 \
124         odbc32 \
125         ole32 \
126         oleaut32 \
127         olecli32 \
128         oledlg \
129         olepro32 \
130         olesvr32 \
131         psapi \
132         rasapi32 \
133         riched32 \
134         setupapi \
135         setupx \
136         shell32 \
137         shfolder \
138         shlwapi \
139         sound \
140         stress \
141         tapi32 \
142         ttydrv \
143         urlmon \
144         user32 \
145         version \
146         w32skrnl \
147         win87em \
148         windebug \
149         wineoss.drv \
150         wineps \
151         wing \
152         wininet \
153         winmm \
154         winspool.drv \
155         wnaspi32 \
156         wow32 \
157         ws2_32 \
158         wsock32
159
160 # Implicit rules
161
162 .SUFFIXES: .rc .res .spec .spec.c .spec.o .glue.c
163
164 .c.o:
165         $(CC) -c $(ALLCFLAGS) -o $*.o $<
166
167 .spec.c.spec.o:
168         $(CC) -c $(ALLCFLAGS) @GCC_NO_BUILTIN@ -o $*.spec.o $<
169
170 .s.o:
171         $(AS) -o $*.o $<  
172
173 .S.o:
174         $(CC) -c -o $*.o $<  
175
176 .rc.s:
177         $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) $<
178
179 .rc.h:
180         $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) -nh $<
181
182 .rc.res:
183         $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) -r $<
184
185 .res.s:
186         $(WRC) $(WRCFLAGS) $(WRCEXTRA) -b $<
187
188 .res.h:
189         $(WRC) $(WRCFLAGS) $(WRCEXTRA) -bnh $<
190
191 .spec.spec.c:
192         $(BUILD) @DLLFLAGS@ -o $@ -spec $<
193
194 .c.glue.c:
195         $(BUILD) @DLLFLAGS@ -o $@ -glue $<
196
197 .c.ln:
198         $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
199
200 .PHONY: all install uninstall clean distclean depend dummy
201
202 # 'all' target first in case the enclosing Makefile didn't define any target
203
204 all: Makefile
205
206 # Rule to rebuild the resource compiler
207
208 $(WRC) check_wrc:
209         cd $(TOPOBJDIR)/tools/wrc && $(MAKE) wrc
210
211 # Rule to rebuild the message compiler
212
213 $(WMC) check_wmc:
214         cd $(TOPOBJDIR)/tools/wmc && $(MAKE) wmc
215
216 # Rule to rebuild the 'makedep' program
217
218 $(MAKEDEP) check_makedep:
219         cd $(TOPOBJDIR)/tools && $(MAKE) makedep
220
221 # Rule to rebuild the 'winebuild' program
222
223 $(BUILD) check_winebuild:
224         cd $(TOPOBJDIR)/tools/winebuild && $(MAKE) winebuild
225
226 # Rule for main module
227
228 $(MODULE).o: $(OBJS) Makefile.in $(TOPSRCDIR)/Make.rules.in
229         $(LDCOMBINE) $(OBJS) -o $(MODULE).o
230
231 # Rules for makefile
232
233 Makefile: Makefile.in $(TOPSRCDIR)/configure
234         @echo Makefile is older than $?, please rerun $(TOPSRCDIR)/configure
235         @exit 1
236
237 # Rules for auto documentation
238
239 man: $(C_SRCS)
240         for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/man3w -S3w $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done
241
242 html: $(C_SRCS)
243         for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/html -Th -iwindows.h  $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done
244
245 # Rule for linting
246
247 $(MODULE).ln : $(LINTS)
248         if test "$(LINTS)" ; \
249         then \
250                 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
251                 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
252         else \
253                 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
254         fi
255
256 lint:: $(MODULE).ln
257
258 # Rules for Windows API checking
259
260 winapi_check::
261         $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
262
263 # Rules for dependencies
264
265 $(SUBDIRS:%=%/__depend__): $(MAKEDEP) dummy
266         cd `dirname $@` && $(MAKE) depend
267
268 depend: $(MAKEDEP) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS) $(GEN_C_SRCS) $(SUBDIRS:%=%/__depend__)
269         $(MAKEDEP) $(DIVINCL) -C$(SRCDIR) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS) -C. $(GEN_C_SRCS)
270
271 # Rules for cleaning
272
273 $(SUBDIRS:%=%/__clean__): dummy
274         cd `dirname $@` && $(MAKE) clean
275
276 $(EXTRASUBDIRS:%=%/__clean__): dummy
277         -cd `dirname $@` && $(RM) $(CLEAN_FILES)
278
279 clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
280         $(RM) $(CLEAN_FILES) $(GEN_C_SRCS) $(GEN_ASM_SRCS) $(RC_SRCS:.rc=.s) $(RC_SRCS:.rc=.h) $(PROGRAMS)
281
282 # Rules for installing
283
284 $(SUBDIRS:%=%/__install__): dummy
285         cd `dirname $@` && $(MAKE) install
286
287 $(SUBDIRS:%=%/__uninstall__): dummy
288         cd `dirname $@` && $(MAKE) uninstall
289
290 # Misc. rules
291
292 $(SPEC_SRCS:.spec=.spec.c): $(BUILD) $(TOPSRCDIR)/include/builtin16.h $(TOPSRCDIR)/include/builtin32.h
293
294 $(GLUE:.c=.glue.c): $(BUILD) $(TOPSRCDIR)/include/builtin16.h $(TOPSRCDIR)/include/builtin32.h
295
296 $(RC_SRCS:.rc=.s): $(WRC)
297
298 $(SUBDIRS): dummy
299         @cd $@ && $(MAKE)
300
301 dummy:
302
303 # End of global rules