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 # C_SRCS16 : 16-bit C sources for the module
12 # RC_SRCS : resource source files
13 # EXTRA_SRCS : extra source files for make depend
14 # EXTRA_OBJS : extra object files
15 # IMPORTS : dlls to import
16 # DELAYIMPORTS : dlls to import in delayed mode
17 # SUBDIRS : subdirectories that contain a Makefile
18 # EXTRASUBDIRS : subdirectories that do not contain a Makefile
19 # INSTALLSUBDIRS : subdirectories to run make install/uninstall into
20 # MODCFLAGS : extra CFLAGS for this module
21
22 # First some useful definitions
23
24 SHELL = /bin/sh
25 CC = @CC@
26 CFLAGS = @CFLAGS@
27 CPPFLAGS = @CPPFLAGS@
28 LIBS = @LIBS@
29 BISON = @BISON@
30 FLEX = @FLEX@
31 EXEEXT = @EXEEXT@
32 OBJEXT = @OBJEXT@
33 LIBEXT = @LIBEXT@
34 DLLEXT = @DLLEXT@
35 IMPLIBEXT = @IMPLIBEXT@
36 LDSHARED = @LDSHARED@
37 DLLTOOL = @DLLTOOL@
38 DLLWRAP = @DLLWRAP@
39 AR = @AR@
40 ARFLAGS = @ARFLAGS@
41 RANLIB = @RANLIB@
42 STRIP = @STRIP@
43 WINDRES = @WINDRES@
44 LN = @LN@
45 LN_S = @LN_S@
46 TOOLSDIR = @TOOLSDIR@
47 AS = @AS@
48 LD = @LD@
49 NM = @NM@
50 LDFLAGS = @LDFLAGS@
51 PRELINK = @PRELINK@
52 RM = rm -f
53 MV = mv
54 LINT = @LINT@
55 LINTFLAGS = @LINTFLAGS@
56 FONTFORGE = @FONTFORGE@
57 RSVG = @RSVG@
58 ICOTOOL = @ICOTOOL@
59 INCLUDES = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include $(EXTRAINCL)
60 EXTRACFLAGS = @EXTRACFLAGS@
61 ALLCFLAGS = $(INCLUDES) $(DEFS) $(DLLFLAGS) $(EXTRACFLAGS) $(CPPFLAGS) $(CFLAGS) $(MODCFLAGS)
62 ALLLINTFLAGS = $(INCLUDES) $(DEFS) $(LINTFLAGS)
63 IDLFLAGS = $(INCLUDES) $(DEFS) $(EXTRAIDLFLAGS)
64 WINEBUILDFLAGS = $(DLLFLAGS) --as-cmd "$(AS)"
65 MKINSTALLDIRS= $(TOPSRCDIR)/tools/mkinstalldirs -m 755
66 WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi/winapi_check
67 WINEWRAPPER = $(TOPSRCDIR)/tools/winewrapper
68 C2MAN = $(TOPSRCDIR)/tools/c2man.pl
69 RUNTEST = $(TOPSRCDIR)/tools/runtest
70 WINEBUILD = $(TOOLSDIR)/tools/winebuild/winebuild
71 MAKEDEP = $(TOOLSDIR)/tools/makedep
72 MAKECTESTS = $(TOOLSDIR)/tools/make_ctests
73 WRC = $(TOOLSDIR)/tools/wrc/wrc
74 WMC = $(TOOLSDIR)/tools/wmc/wmc
75 WIDL = $(TOOLSDIR)/tools/widl/widl
76 WINEGCC = $(TOOLSDIR)/tools/winegcc/winegcc
77 RELPATH = $(TOOLSDIR)/tools/relpath
78 SFNT2FNT = $(TOOLSDIR)/tools/sfnt2fnt
79 FNT2FON = $(TOOLSDIR)/tools/fnt2fon
80 RC = $(WRC)
81 RC16 = $(WRC)
82 RCFLAGS = --nostdinc $(INCLUDES) $(DEFS) $(EXTRARCFLAGS)
83 RC16FLAGS = -O res16 $(RCFLAGS)
84 LDPATH = @LDPATH@
85 DLLDIR = $(TOPOBJDIR)/dlls
86 LIBPORT = $(TOPOBJDIR)/libs/port/libwine_port.a
87 LIBWPP = $(TOPOBJDIR)/libs/wpp/libwpp.a
88 LIBWINE = -L$(TOPOBJDIR)/libs/wine -lwine
89 LDRPATH_INSTALL = @LDRPATH_INSTALL@
90 LDRPATH_LOCAL = @LDRPATH_LOCAL@
91
92 @SET_MAKE@
93
94 # Installation infos
95
96 INSTALL = @INSTALL@ $(INSTALL_FLAGS)
97 INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(INSTALL_PROGRAM_FLAGS)
98 INSTALL_SCRIPT = @INSTALL_SCRIPT@ $(INSTALL_SCRIPT_FLAGS)
99 INSTALL_DATA = @INSTALL_DATA@ $(INSTALL_DATA_FLAGS)
100 prefix = @prefix@
101 exec_prefix = @exec_prefix@
102 bindir = @bindir@
103 libdir = @libdir@
104 datarootdir = @datarootdir@
105 datadir = @datadir@
106 infodir = @infodir@
107 mandir = @mandir@
108 sysconfdir = @sysconfdir@
109 includedir = @includedir@/wine
110 dlldir = @libdir@/wine
111 prog_manext = 1
112 api_manext = 3w
113 conf_manext = 5
114 CLEAN_FILES = *.o *.a *.so *.ln *.res *.$(LIBEXT) \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej *.flc core
115
116 IDL_GEN_C_SRCS = $(IDL_C_SRCS:.idl=_c.c) $(IDL_I_SRCS:.idl=_i.c) \
117 $(IDL_P_SRCS:.idl=_p.c) $(IDL_S_SRCS:.idl=_s.c)
118 IDL_GEN_HEADERS = $(IDL_H_SRCS:.idl=.h) $(IDL_C_SRCS:.idl=.h) $(IDL_I_SRCS:.idl=.h) \
119 $(IDL_P_SRCS:.idl=.h) $(IDL_S_SRCS:.idl=.h)
120
121 CLEAN_TARGETS = $(IDL_GEN_C_SRCS) $(IDL_GEN_HEADERS) $(IDL_TLB_SRCS:.idl=.tlb) $(IDL_P_SRCS:%=dlldata.c) \
122 $(BISON_SRCS:.y=.tab.c) $(BISON_SRCS:.y=.tab.h) $(LEX_SRCS:.l=.yy.c) $(MC_SRCS:.mc=.mc.rc)
123
124 OBJS = $(C_SRCS:.c=.o) $(BISON_SRCS:.y=.tab.o) $(LEX_SRCS:.l=.yy.o) $(IDL_GEN_C_SRCS:.c=.o) $(EXTRA_OBJS)
125
126 RCOBJS = $(RC_SRCS:.rc=.res.o)
127 LINTS = $(C_SRCS:.c=.ln)
128
129 # 'all' target first in case the enclosing Makefile didn't define any target
130
131 all:
132
133 filter: dummy
134 @$(TOPSRCDIR)/tools/winapi/make_filter --make $(MAKE) all
135
136 .PHONY: all filter
137
138 # Implicit rules
139
140 .SUFFIXES: .mc .rc .mc.rc .res .res.o .spec .spec.o .idl .tlb .h .y .l .tab.c .tab.h .yy.c .ok .man.in .man _c.c _i.c _p.c _s.c @MAINTAINER_MODE@ .sfd .ttf .svg .ico
141
142 .c.o:
143 $(CC) -c $(ALLCFLAGS) -o $@ $<
144
145 .s.o:
146 $(AS) -o $@ $<
147
148 .y.tab.c:
149 $(BISON) $(BISONFLAGS) -p $*_ -o $@ $<
150
151 .y.tab.h:
152 $(BISON) $(BISONFLAGS) -p $*_ -o $*.tab.c -d $<
153
154 .l.yy.c:
155 $(FLEX) $(LEXFLAGS) -o$@ $<
156
157 .mc.mc.rc:
158 $(LDPATH) $(WMC) -i -U -H /dev/null -o $@ $<
159
160 .rc.res:
161 $(LDPATH) $(RC) $(RCFLAGS) -fo$@ $<
162
163 .res.res.o:
164 $(WINDRES) -i $< -o $@
165
166 .spec.spec.o:
167 $(WINEBUILD) $(WINEBUILDFLAGS) --dll -o $@ --main-module $(MODULE) --export $<
168
169 .idl.h:
170 $(WIDL) $(IDLFLAGS) -h -H $@ $<
171
172 .idl_c.c:
173 $(WIDL) $(IDLFLAGS) -c -C $@ $<
174
175 .idl_i.c:
176 $(WIDL) $(IDLFLAGS) -u -U $@ $<
177
178 .idl_p.c:
179 $(WIDL) $(IDLFLAGS) -p -P $@ $<
180
181 .idl_s.c:
182 $(WIDL) $(IDLFLAGS) -s -S $@ $<
183
184 .idl.tlb:
185 $(WIDL) $(IDLFLAGS) -t -T $@ $<
186
187 .c.ln:
188 $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
189
190 .c.ok:
191 $(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
192
193 .sfd.ttf:
194 $(FONTFORGE) -script $(TOPSRCDIR)/fonts/genttf.ff $< $@
195
196 .man.in.man:
197 LC_ALL=C sed -e 's,@bindir\@,$(bindir),g' -e 's,@dlldir\@,$(dlldir),g' -e 's,@PACKAGE_STRING\@,@PACKAGE_STRING@,g' $< >$@ || ($(RM) $@ && false)
198
199 .svg.ico:
200 $(RSVG) -w 16 -h 16 -f png $< $*-16.png
201 $(RSVG) -w 32 -h 32 -f png $< $*-32.png
202 $(RSVG) -w 48 -h 48 -f png $< $*-48.png
203 $(ICOTOOL) -c -o $@ $*-16.png $*-32.png $*-48.png
204 $(RM) $*-16.png $*-32.png $*-48.png
205
206 # Rules for IDL files
207
208 dlldata.c: $(WIDL) Makefile.in
209 $(WIDL) $(IDLFLAGS) --dlldata-only --dlldata=$@ $(IDL_P_SRCS)
210
211 # Rule for linting
212
213 $(MODULE).ln : $(LINTS)
214 if test "$(LINTS)" ; \
215 then \
216 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
217 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
218 else \
219 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
220 fi
221
222 lint:: $(MODULE).ln
223
224 # Rules for Windows API checking
225
226 winapi_check:: dummy
227 $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
228
229 .PHONY: winapi_check
230
231 # Rules for dependencies
232
233 DEPEND_SRCS = $(C_SRCS) $(C_SRCS16) $(RC_SRCS) $(RC_SRCS16) $(MC_SRCS) \
234 $(IDL_H_SRCS) $(IDL_C_SRCS) $(IDL_I_SRCS) $(IDL_P_SRCS) $(IDL_S_SRCS) \
235 $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) \
236 $(BISON_SRCS) $(LEX_SRCS) $(EXTRA_SRCS)
237
238 $(SUBDIRS:%=%/__depend__): dummy
239 @cd `dirname $@` && $(MAKE) depend
240
241 depend: $(SUBDIRS:%=%/__depend__) dummy
242 $(MAKEDEP) -C$(SRCDIR) -S$(TOPSRCDIR) -T$(TOPOBJDIR) $(EXTRAINCL) $(DEPEND_SRCS)
243
244 .PHONY: depend $(SUBDIRS:%=%/__depend__)
245
246 # Rules for cleaning
247
248 $(SUBDIRS:%=%/__clean__): dummy
249 @cd `dirname $@` && $(MAKE) clean
250
251 $(EXTRASUBDIRS:%=%/__clean__): dummy
252 -cd `dirname $@` && $(RM) $(CLEAN_FILES)
253
254 clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
255 $(RM) $(CLEAN_FILES) $(CLEAN_TARGETS) $(PROGRAMS) $(MANPAGES)
256
257 .PHONY: clean $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
258
259 # Rules for installing
260
261 $(SUBDIRS:%=%/__install__): dummy
262 @cd `dirname $@` && $(MAKE) install
263
264 $(SUBDIRS:%=%/__install-lib__): dummy
265 @cd `dirname $@` && $(MAKE) install-lib
266
267 $(SUBDIRS:%=%/__install-dev__): dummy
268 @cd `dirname $@` && $(MAKE) install-dev
269
270 $(SUBDIRS:%=%/__uninstall__): dummy
271 @cd `dirname $@` && $(MAKE) uninstall
272
273 install:: $(INSTALLSUBDIRS:%=%/__install__)
274 install-lib:: $(INSTALLSUBDIRS:%=%/__install-lib__)
275 install-dev:: $(INSTALLSUBDIRS:%=%/__install-dev__)
276 uninstall:: $(INSTALLSUBDIRS:%=%/__uninstall__)
277
278 $(INSTALLDIRS):
279 $(MKINSTALLDIRS) $@
280
281 .PHONY: install install-lib install-dev uninstall \
282 $(SUBDIRS:%=%/__install__) $(SUBDIRS:%=%/__uninstall__) \
283 $(SUBDIRS:%=%/__install-lib__) $(SUBDIRS:%=%/__install-dev__)
284
285 # Rules for testing
286
287 $(TESTSUBDIRS:%=%/__test__): dummy
288 @cd `dirname $@` && $(MAKE) test
289
290 $(TESTSUBDIRS:%=%/__crosstest__): dummy
291 @cd `dirname $@` && $(MAKE) crosstest
292
293 $(TESTSUBDIRS:%=%/__testclean__): dummy
294 @cd `dirname $@` && $(MAKE) testclean
295
296 check test:: $(TESTSUBDIRS:%=%/__test__)
297
298 crosstest:: $(TESTSUBDIRS:%=%/__crosstest__)
299
300 testclean:: $(TESTSUBDIRS:%=%/__testclean__)
301
302 .PHONY: check test testclean crosstest $(TESTSUBDIRS:%=%/__test__) $(TESTSUBDIRS:%=%/__crosstest__) $(TESTSUBDIRS:%=%/__testclean__)
303
304 # Rules for auto documentation
305
306 $(DOCSUBDIRS:%=%/__man__): dummy
307 @cd `dirname $@` && $(MAKE) man
308
309 $(DOCSUBDIRS:%=%/__doc_html__): dummy
310 @cd `dirname $@` && $(MAKE) doc-html
311
312 $(DOCSUBDIRS:%=%/__doc_sgml__): dummy
313 @cd `dirname $@` && $(MAKE) doc-sgml
314
315 man: $(DOCSUBDIRS:%=%/__man__)
316 doc-html: $(DOCSUBDIRS:%=%/__doc_html__)
317 doc-sgml: $(DOCSUBDIRS:%=%/__doc_sgml__)
318
319 .PHONY: man doc-html doc-sgml $(DOCSUBDIRS:%=%/__man__) $(DOCSUBDIRS:%=%/__doc_html__) $(DOCSUBDIRS:%=%/__doc_sgml__)
320
321 # Misc. rules
322
323 $(MC_SRCS:.mc=.mc.rc): $(WMC)
324
325 $(IDL_GEN_HEADERS) $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS:.idl=.tlb): $(WIDL)
326
327 $(RC_SRCS:.rc=.res) $(RC_SRCS16:.rc=.res): $(WRC)
328
329 $(SUBDIRS): dummy
330 @cd $@ && $(MAKE)
331
332 dummy:
333
334 .PHONY: dummy $(SUBDIRS)
335
336 # End of global rules
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.