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