1 # Global rules shared by all makefiles -*-Makefile-*-
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
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
22 # First some useful definitions
35 IMPLIBEXT = @IMPLIBEXT@
55 LINTFLAGS = @LINTFLAGS@
56 FONTFORGE = @FONTFORGE@
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
82 RCFLAGS = --nostdinc $(INCLUDES) $(DEFS) $(EXTRARCFLAGS)
83 RC16FLAGS = -O res16 $(RCFLAGS)
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@
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)
101 exec_prefix = @exec_prefix@
104 datarootdir = @datarootdir@
108 sysconfdir = @sysconfdir@
109 includedir = @includedir@/wine
110 dlldir = @libdir@/wine
114 CLEAN_FILES = *.o *.a *.so *.ln *.res *.$(LIBEXT) \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej *.flc core
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)
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)
124 OBJS = $(C_SRCS:.c=.o) $(BISON_SRCS:.y=.tab.o) $(LEX_SRCS:.l=.yy.o) $(IDL_GEN_C_SRCS:.c=.o) $(EXTRA_OBJS)
126 RCOBJS = $(RC_SRCS:.rc=.res.o)
127 LINTS = $(C_SRCS:.c=.ln)
129 # 'all' target first in case the enclosing Makefile didn't define any target
134 @$(TOPSRCDIR)/tools/winapi/make_filter --make $(MAKE) all
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
143 $(CC) -c $(ALLCFLAGS) -o $@ $<
149 $(BISON) $(BISONFLAGS) -p $*_ -o $@ $<
152 $(BISON) $(BISONFLAGS) -p $*_ -o $*.tab.c -d $<
155 $(FLEX) $(LEXFLAGS) -o$@ $<
158 $(LDPATH) $(WMC) -i -U -H /dev/null -o $@ $<
161 $(LDPATH) $(RC) $(RCFLAGS) -fo$@ $<
164 $(WINDRES) -i $< -o $@
167 $(WINEBUILD) $(WINEBUILDFLAGS) --dll -o $@ --main-module $(MODULE) --export $<
170 $(WIDL) $(IDLFLAGS) -h -H $@ $<
173 $(WIDL) $(IDLFLAGS) -c -C $@ $<
176 $(WIDL) $(IDLFLAGS) -u -U $@ $<
179 $(WIDL) $(IDLFLAGS) -p -P $@ $<
182 $(WIDL) $(IDLFLAGS) -s -S $@ $<
185 $(WIDL) $(IDLFLAGS) -t -T $@ $<
188 $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
191 $(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
194 $(FONTFORGE) -script $(TOPSRCDIR)/fonts/genttf.ff $< $@
197 LC_ALL=C sed -e 's,@bindir\@,$(bindir),g' -e 's,@dlldir\@,$(dlldir),g' -e 's,@PACKAGE_STRING\@,@PACKAGE_STRING@,g' $< >$@ || ($(RM) $@ && false)
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
206 # Rules for IDL files
208 dlldata.c: $(WIDL) Makefile.in
209 $(WIDL) $(IDLFLAGS) --dlldata-only --dlldata=$@ $(IDL_P_SRCS)
213 $(MODULE).ln : $(LINTS)
214 if test "$(LINTS)" ; \
216 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
217 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
219 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
224 # Rules for Windows API checking
227 $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
231 # Rules for dependencies
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)
238 $(SUBDIRS:%=%/__depend__): dummy
239 @cd `dirname $@` && $(MAKE) depend
241 depend: $(SUBDIRS:%=%/__depend__) dummy
242 $(MAKEDEP) -C$(SRCDIR) -S$(TOPSRCDIR) -T$(TOPOBJDIR) $(EXTRAINCL) $(DEPEND_SRCS)
244 .PHONY: depend $(SUBDIRS:%=%/__depend__)
248 $(SUBDIRS:%=%/__clean__): dummy
249 @cd `dirname $@` && $(MAKE) clean
251 $(EXTRASUBDIRS:%=%/__clean__): dummy
252 -cd `dirname $@` && $(RM) $(CLEAN_FILES)
254 clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
255 $(RM) $(CLEAN_FILES) $(CLEAN_TARGETS) $(PROGRAMS) $(MANPAGES)
257 .PHONY: clean $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
259 # Rules for installing
261 $(SUBDIRS:%=%/__install__): dummy
262 @cd `dirname $@` && $(MAKE) install
264 $(SUBDIRS:%=%/__install-lib__): dummy
265 @cd `dirname $@` && $(MAKE) install-lib
267 $(SUBDIRS:%=%/__install-dev__): dummy
268 @cd `dirname $@` && $(MAKE) install-dev
270 $(SUBDIRS:%=%/__uninstall__): dummy
271 @cd `dirname $@` && $(MAKE) uninstall
273 install:: $(INSTALLSUBDIRS:%=%/__install__)
274 install-lib:: $(INSTALLSUBDIRS:%=%/__install-lib__)
275 install-dev:: $(INSTALLSUBDIRS:%=%/__install-dev__)
276 uninstall:: $(INSTALLSUBDIRS:%=%/__uninstall__)
281 .PHONY: install install-lib install-dev uninstall \
282 $(SUBDIRS:%=%/__install__) $(SUBDIRS:%=%/__uninstall__) \
283 $(SUBDIRS:%=%/__install-lib__) $(SUBDIRS:%=%/__install-dev__)
287 $(TESTSUBDIRS:%=%/__test__): dummy
288 @cd `dirname $@` && $(MAKE) test
290 $(TESTSUBDIRS:%=%/__crosstest__): dummy
291 @cd `dirname $@` && $(MAKE) crosstest
293 $(TESTSUBDIRS:%=%/__testclean__): dummy
294 @cd `dirname $@` && $(MAKE) testclean
296 check test:: $(TESTSUBDIRS:%=%/__test__)
298 crosstest:: $(TESTSUBDIRS:%=%/__crosstest__)
300 testclean:: $(TESTSUBDIRS:%=%/__testclean__)
302 .PHONY: check test testclean crosstest $(TESTSUBDIRS:%=%/__test__) $(TESTSUBDIRS:%=%/__crosstest__) $(TESTSUBDIRS:%=%/__testclean__)
304 # Rules for auto documentation
306 $(DOCSUBDIRS:%=%/__man__): dummy
307 @cd `dirname $@` && $(MAKE) man
309 $(DOCSUBDIRS:%=%/__doc_html__): dummy
310 @cd `dirname $@` && $(MAKE) doc-html
312 $(DOCSUBDIRS:%=%/__doc_sgml__): dummy
313 @cd `dirname $@` && $(MAKE) doc-sgml
315 man: $(DOCSUBDIRS:%=%/__man__)
316 doc-html: $(DOCSUBDIRS:%=%/__doc_html__)
317 doc-sgml: $(DOCSUBDIRS:%=%/__doc_sgml__)
319 .PHONY: man doc-html doc-sgml $(DOCSUBDIRS:%=%/__man__) $(DOCSUBDIRS:%=%/__doc_html__) $(DOCSUBDIRS:%=%/__doc_sgml__)
323 $(MC_SRCS:.mc=.mc.rc): $(WMC)
325 $(IDL_GEN_HEADERS) $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS:.idl=.tlb): $(WIDL)
327 $(RC_SRCS:.rc=.res) $(RC_SRCS16:.rc=.res): $(WRC)
334 .PHONY: dummy $(SUBDIRS)
336 # End of global rules