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