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@
54 LINTFLAGS = @LINTFLAGS@
55 FONTFORGE = @FONTFORGE@
58 INCLUDES = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include $(EXTRAINCL)
59 EXTRACFLAGS = @EXTRACFLAGS@
60 ALLCFLAGS = $(INCLUDES) $(DEFS) $(DLLFLAGS) $(EXTRACFLAGS) $(CPPFLAGS) $(CFLAGS) $(MODCFLAGS)
61 ALLLINTFLAGS = $(INCLUDES) $(DEFS) $(LINTFLAGS)
62 IDLFLAGS = $(INCLUDES) $(DEFS) $(EXTRAIDLFLAGS)
63 WINEBUILDFLAGS = $(DLLFLAGS) --as-cmd "$(AS)"
64 MKINSTALLDIRS= $(TOPSRCDIR)/tools/mkinstalldirs -m 755
65 WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi/winapi_check
66 WINEWRAPPER = $(TOPSRCDIR)/tools/winewrapper
67 C2MAN = $(TOPSRCDIR)/tools/c2man.pl
68 RUNTEST = $(TOPSRCDIR)/tools/runtest
69 WINEBUILD = $(TOOLSDIR)/tools/winebuild/winebuild
70 MAKEDEP = $(TOOLSDIR)/tools/makedep
71 MAKECTESTS = $(TOOLSDIR)/tools/make_ctests
72 WRC = $(TOOLSDIR)/tools/wrc/wrc
73 WMC = $(TOOLSDIR)/tools/wmc/wmc
74 WIDL = $(TOOLSDIR)/tools/widl/widl
75 WINEGCC = $(TOOLSDIR)/tools/winegcc/winegcc
76 RELPATH = $(TOOLSDIR)/tools/relpath
77 SFNT2FNT = $(TOOLSDIR)/tools/sfnt2fnt
78 FNT2FON = $(TOOLSDIR)/tools/fnt2fon
81 RCFLAGS = --nostdinc $(INCLUDES) $(DEFS) $(EXTRARCFLAGS)
82 RC16FLAGS = -O res16 $(RCFLAGS)
84 DLLDIR = $(TOPOBJDIR)/dlls
85 LIBPORT = $(TOPOBJDIR)/libs/port/libwine_port.a
86 LIBWPP = $(TOPOBJDIR)/libs/wpp/libwpp.a
87 LIBWINE = -L$(TOPOBJDIR)/libs/wine -lwine
88 LDRPATH_INSTALL = @LDRPATH_INSTALL@
89 LDRPATH_LOCAL = @LDRPATH_LOCAL@
95 INSTALL = @INSTALL@ $(INSTALL_FLAGS)
96 INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(INSTALL_PROGRAM_FLAGS)
97 INSTALL_SCRIPT = @INSTALL_SCRIPT@ $(INSTALL_SCRIPT_FLAGS)
98 INSTALL_DATA = @INSTALL_DATA@ $(INSTALL_DATA_FLAGS)
100 exec_prefix = @exec_prefix@
103 datarootdir = @datarootdir@
107 sysconfdir = @sysconfdir@
108 includedir = @includedir@/wine
109 dlldir = @libdir@/wine
113 CLEAN_FILES = *.o *.a *.so *.ln *.res *.$(LIBEXT) \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej *.flc core
115 IDL_GEN_C_SRCS = $(IDL_C_SRCS:.idl=_c.c) $(IDL_I_SRCS:.idl=_i.c) \
116 $(IDL_P_SRCS:.idl=_p.c) $(IDL_S_SRCS:.idl=_s.c)
117 IDL_GEN_HEADERS = $(IDL_H_SRCS:.idl=.h) $(IDL_C_SRCS:.idl=.h) $(IDL_I_SRCS:.idl=.h) \
118 $(IDL_P_SRCS:.idl=.h) $(IDL_S_SRCS:.idl=.h)
120 CLEAN_TARGETS = $(IDL_GEN_C_SRCS) $(IDL_GEN_HEADERS) $(IDL_TLB_SRCS:.idl=.tlb) $(IDL_P_SRCS:%=dlldata.c) \
121 $(BISON_SRCS:.y=.tab.c) $(BISON_SRCS:.y=.tab.h) $(LEX_SRCS:.l=.yy.c) $(MC_SRCS:.mc=.mc.rc)
123 OBJS = $(C_SRCS:.c=.o) $(BISON_SRCS:.y=.tab.o) $(LEX_SRCS:.l=.yy.o) $(IDL_GEN_C_SRCS:.c=.o) $(EXTRA_OBJS)
125 RCOBJS = $(RC_SRCS:.rc=.res.o)
126 LINTS = $(C_SRCS:.c=.ln)
128 # 'all' target first in case the enclosing Makefile didn't define any target
133 @$(TOPSRCDIR)/tools/winapi/make_filter --make $(MAKE) all
139 .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
142 $(CC) -c $(ALLCFLAGS) -o $@ $<
148 $(BISON) $(BISONFLAGS) -p $*_ -o $@ $<
151 $(BISON) $(BISONFLAGS) -p $*_ -o $*.tab.c -d $<
154 $(FLEX) $(LEXFLAGS) -o$@ $<
157 $(LDPATH) $(WMC) -i -U -H /dev/null -o $@ $<
160 $(LDPATH) $(RC) $(RCFLAGS) -fo$@ $<
163 $(WINDRES) -i $< -o $@
166 $(WINEBUILD) $(WINEBUILDFLAGS) --dll -o $@ --main-module $(MODULE) --export $<
169 $(WIDL) $(IDLFLAGS) -h -H $@ $<
172 $(WIDL) $(IDLFLAGS) -c -C $@ $<
175 $(WIDL) $(IDLFLAGS) -u -U $@ $<
178 $(WIDL) $(IDLFLAGS) -p -P $@ $<
181 $(WIDL) $(IDLFLAGS) -s -S $@ $<
184 $(WIDL) $(IDLFLAGS) -t -T $@ $<
187 $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
190 $(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
193 $(FONTFORGE) -script $(TOPSRCDIR)/fonts/genttf.ff $< $@
196 LC_ALL=C sed -e 's,@bindir\@,$(bindir),g' -e 's,@dlldir\@,$(dlldir),g' -e 's,@PACKAGE_STRING\@,@PACKAGE_STRING@,g' $< >$@ || ($(RM) $@ && false)
199 $(RSVG) -w 16 -h 16 -f png $< $*-16.png
200 $(RSVG) -w 32 -h 32 -f png $< $*-32.png
201 $(RSVG) -w 48 -h 48 -f png $< $*-48.png
202 $(ICOTOOL) -c -o $@ $*-16.png $*-32.png $*-48.png
203 $(RM) $*-16.png $*-32.png $*-48.png
205 # Rules for IDL files
207 dlldata.c: $(WIDL) Makefile.in
208 $(WIDL) $(IDLFLAGS) --dlldata-only --dlldata=$@ $(IDL_P_SRCS)
212 $(MODULE).ln : $(LINTS)
213 if test "$(LINTS)" ; \
215 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
216 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
218 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
223 # Rules for Windows API checking
226 $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
230 # Rules for dependencies
232 DEPEND_SRCS = $(C_SRCS) $(C_SRCS16) $(RC_SRCS) $(RC_SRCS16) $(MC_SRCS) \
233 $(IDL_H_SRCS) $(IDL_C_SRCS) $(IDL_I_SRCS) $(IDL_P_SRCS) $(IDL_S_SRCS) \
234 $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) \
235 $(BISON_SRCS) $(LEX_SRCS) $(EXTRA_SRCS)
237 $(SUBDIRS:%=%/__depend__): dummy
238 @cd `dirname $@` && $(MAKE) depend
240 depend: $(SUBDIRS:%=%/__depend__) dummy
241 $(MAKEDEP) -C$(SRCDIR) -S$(TOPSRCDIR) -T$(TOPOBJDIR) $(EXTRAINCL) $(DEPEND_SRCS)
243 .PHONY: depend $(SUBDIRS:%=%/__depend__)
247 $(SUBDIRS:%=%/__clean__): dummy
248 @cd `dirname $@` && $(MAKE) clean
250 $(EXTRASUBDIRS:%=%/__clean__): dummy
251 -cd `dirname $@` && $(RM) $(CLEAN_FILES)
253 clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
254 $(RM) $(CLEAN_FILES) $(CLEAN_TARGETS) $(PROGRAMS) $(MANPAGES)
256 .PHONY: clean $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
258 # Rules for installing
260 $(SUBDIRS:%=%/__install__): dummy
261 @cd `dirname $@` && $(MAKE) install
263 $(SUBDIRS:%=%/__install-lib__): dummy
264 @cd `dirname $@` && $(MAKE) install-lib
266 $(SUBDIRS:%=%/__install-dev__): dummy
267 @cd `dirname $@` && $(MAKE) install-dev
269 $(SUBDIRS:%=%/__uninstall__): dummy
270 @cd `dirname $@` && $(MAKE) uninstall
272 install:: $(INSTALLSUBDIRS:%=%/__install__)
274 uninstall:: $(INSTALLSUBDIRS:%=%/__uninstall__)
279 .PHONY: install install-lib install-dev uninstall \
280 $(SUBDIRS:%=%/__install__) $(SUBDIRS:%=%/__uninstall__) \
281 $(SUBDIRS:%=%/__install-lib__) $(SUBDIRS:%=%/__install-dev__)
285 $(TESTSUBDIRS:%=%/__test__): dummy
286 @cd `dirname $@` && $(MAKE) test
288 $(TESTSUBDIRS:%=%/__crosstest__): dummy
289 @cd `dirname $@` && $(MAKE) crosstest
291 $(TESTSUBDIRS:%=%/__testclean__): dummy
292 @cd `dirname $@` && $(MAKE) testclean
294 check test:: $(TESTSUBDIRS:%=%/__test__)
296 crosstest:: $(TESTSUBDIRS:%=%/__crosstest__)
298 testclean:: $(TESTSUBDIRS:%=%/__testclean__)
300 .PHONY: check test testclean crosstest $(TESTSUBDIRS:%=%/__test__) $(TESTSUBDIRS:%=%/__crosstest__) $(TESTSUBDIRS:%=%/__testclean__)
302 # Rules for auto documentation
304 $(DOCSUBDIRS:%=%/__man__): dummy
305 @cd `dirname $@` && $(MAKE) man
307 $(DOCSUBDIRS:%=%/__doc_html__): dummy
308 @cd `dirname $@` && $(MAKE) doc-html
310 $(DOCSUBDIRS:%=%/__doc_sgml__): dummy
311 @cd `dirname $@` && $(MAKE) doc-sgml
313 man: $(DOCSUBDIRS:%=%/__man__)
314 doc-html: $(DOCSUBDIRS:%=%/__doc_html__)
315 doc-sgml: $(DOCSUBDIRS:%=%/__doc_sgml__)
317 .PHONY: man doc-html doc-sgml $(DOCSUBDIRS:%=%/__man__) $(DOCSUBDIRS:%=%/__doc_html__) $(DOCSUBDIRS:%=%/__doc_sgml__)
321 $(MC_SRCS:.mc=.mc.rc): $(WMC)
323 $(IDL_GEN_HEADERS) $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS:.idl=.tlb): $(WIDL)
325 $(RC_SRCS:.rc=.res) $(RC_SRCS16:.rc=.res): $(WRC)
332 .PHONY: dummy $(SUBDIRS)
334 # End of global rules