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)
130 .SUFFIXES: .mc .rc .mc.rc .res .res.o .spec .spec.o .idl .tlb .h .y .l .tab.c .tab.h .yy.c .ok .sfd .ttf .man.in .man _c.c _i.c _p.c _s.c @MAINTAINER_MODE@ .svg .ico
133 $(CC) -c $(ALLCFLAGS) -o $@ $<
139 $(BISON) $(BISONFLAGS) -p $*_ -o $@ $<
142 $(BISON) $(BISONFLAGS) -p $*_ -o $*.tab.c -d $<
145 $(FLEX) $(LEXFLAGS) -o$@ $<
148 $(LDPATH) $(WMC) -i -U -H /dev/null -o $@ $<
151 $(LDPATH) $(RC) $(RCFLAGS) -fo$@ $<
154 $(WINDRES) -i $< -o $@
157 $(WINEBUILD) $(WINEBUILDFLAGS) --dll -o $@ --main-module $(MODULE) --export $<
160 $(WIDL) $(IDLFLAGS) -h -H $@ $<
163 $(WIDL) $(IDLFLAGS) -c -C $@ $<
166 $(WIDL) $(IDLFLAGS) -u -U $@ $<
169 $(WIDL) $(IDLFLAGS) -p -P $@ $<
172 $(WIDL) $(IDLFLAGS) -s -S $@ $<
175 $(WIDL) $(IDLFLAGS) -t -T $@ $<
178 $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
181 $(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
184 $(FONTFORGE) -script $(TOPSRCDIR)/fonts/genttf.ff $< $@
187 LC_ALL=C sed -e 's,@bindir\@,$(bindir),g' -e 's,@dlldir\@,$(dlldir),g' -e 's,@PACKAGE_STRING\@,@PACKAGE_STRING@,g' $< >$@ || ($(RM) $@ && false)
190 $(RSVG) -w 16 -h 16 -f png $< $*-16.png
191 $(RSVG) -w 32 -h 32 -f png $< $*-32.png
192 $(RSVG) -w 48 -h 48 -f png $< $*-48.png
193 $(ICOTOOL) -c -o $@ $*-16.png $*-32.png $*-48.png
194 $(RM) $*-16.png $*-32.png $*-48.png
196 # 'all' target first in case the enclosing Makefile didn't define any target
201 @$(TOPSRCDIR)/tools/winapi/make_filter --make $(MAKE) all
205 # Rules for IDL files
207 dlldata.c: $(WIDL) Makefile.in
208 $(WIDL) $(IDLFLAGS) --dlldata-only --dlldata=$@ $(IDL_P_SRCS)
210 # Rules for resources
212 $(RC_SRCS:.rc=.res) $(RC_SRCS16:.rc=.res): $(WRC) $(IDL_TLB_SRCS:.idl=.tlb)
216 $(MODULE).ln : $(LINTS)
217 if test "$(LINTS)" ; \
219 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
220 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
222 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
227 # Rules for Windows API checking
230 $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
234 # Rules for dependencies
236 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) $(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__)
275 uninstall:: $(INSTALLSUBDIRS:%=%/__uninstall__)
280 .PHONY: install install-lib install-dev uninstall \
281 $(SUBDIRS:%=%/__install__) $(SUBDIRS:%=%/__uninstall__) \
282 $(SUBDIRS:%=%/__install-lib__) $(SUBDIRS:%=%/__install-dev__)
286 $(TESTSUBDIRS:%=%/__test__): dummy
287 @cd `dirname $@` && $(MAKE) test
289 $(TESTSUBDIRS:%=%/__crosstest__): dummy
290 @cd `dirname $@` && $(MAKE) crosstest
292 $(TESTSUBDIRS:%=%/__testclean__): dummy
293 @cd `dirname $@` && $(MAKE) testclean
295 check test:: $(TESTSUBDIRS:%=%/__test__)
297 crosstest:: $(TESTSUBDIRS:%=%/__crosstest__)
299 testclean:: $(TESTSUBDIRS:%=%/__testclean__)
301 .PHONY: check test testclean crosstest $(TESTSUBDIRS:%=%/__test__) $(TESTSUBDIRS:%=%/__crosstest__) $(TESTSUBDIRS:%=%/__testclean__)
303 # Rules for auto documentation
305 $(DOCSUBDIRS:%=%/__man__): dummy
306 @cd `dirname $@` && $(MAKE) man
308 $(DOCSUBDIRS:%=%/__doc_html__): dummy
309 @cd `dirname $@` && $(MAKE) doc-html
311 $(DOCSUBDIRS:%=%/__doc_sgml__): dummy
312 @cd `dirname $@` && $(MAKE) doc-sgml
314 man: $(DOCSUBDIRS:%=%/__man__)
315 doc-html: $(DOCSUBDIRS:%=%/__doc_html__)
316 doc-sgml: $(DOCSUBDIRS:%=%/__doc_sgml__)
318 .PHONY: man doc-html doc-sgml $(DOCSUBDIRS:%=%/__man__) $(DOCSUBDIRS:%=%/__doc_html__) $(DOCSUBDIRS:%=%/__doc_sgml__)
322 $(MC_SRCS:.mc=.mc.rc): $(WMC)
324 $(IDL_GEN_HEADERS) $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS:.idl=.tlb): $(WIDL)
331 .PHONY: dummy $(SUBDIRS)
333 # End of global rules