mshtml: Better timer handling.
[wine/wine-jacek.git] / Make.rules.in
blob1d038416b40291d153a4efff0aab4c0722d5921a
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
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 LDFLAGS   = @LDFLAGS@
50 PRELINK   = @PRELINK@
51 RM        = rm -f
52 MV        = mv
53 LINT      = @LINT@
54 LINTFLAGS = @LINTFLAGS@
55 FONTFORGE = @FONTFORGE@
56 RSVG      = @RSVG@
57 ICOTOOL   = @ICOTOOL@
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
79 RC           = $(WRC)
80 RC16         = $(WRC)
81 RCFLAGS      = --nostdinc $(INCLUDES) $(DEFS) $(EXTRARCFLAGS)
82 RC16FLAGS    = -O res16 $(RCFLAGS)
83 LDPATH       = @LDPATH@
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@
91 @SET_MAKE@
93 # Installation infos
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)
99 prefix          = @prefix@
100 exec_prefix     = @exec_prefix@
101 bindir          = @bindir@
102 libdir          = @libdir@
103 datarootdir     = @datarootdir@
104 datadir         = @datadir@
105 infodir         = @infodir@
106 mandir          = @mandir@
107 sysconfdir      = @sysconfdir@
108 includedir      = @includedir@/wine
109 dlldir          = @libdir@/wine
110 prog_manext     = 1
111 api_manext      = 3w
112 conf_manext     = 5
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
130 all:
132 filter: dummy
133         @$(TOPSRCDIR)/tools/winapi/make_filter --make $(MAKE) all
135 .PHONY: all filter
137 # Implicit rules
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
141 .c.o:
142         $(CC) -c $(ALLCFLAGS) -o $@ $<
144 .s.o:
145         $(AS) -o $@ $<
147 .y.tab.c:
148         $(BISON) $(BISONFLAGS) -p $*_ -o $@ $<
150 .y.tab.h:
151         $(BISON) $(BISONFLAGS) -p $*_ -o $*.tab.c -d $<
153 .l.yy.c:
154         $(FLEX) $(LEXFLAGS) -o$@ $<
156 .mc.mc.rc:
157         $(LDPATH) $(WMC) -i -U -H /dev/null -o $@ $<
159 .rc.res:
160         $(LDPATH) $(RC) $(RCFLAGS) -fo$@ $<
162 .res.res.o:
163         $(WINDRES) -i $< -o $@
165 .spec.spec.o:
166         $(WINEBUILD) $(WINEBUILDFLAGS) --dll -o $@ --main-module $(MODULE) --export $<
168 .idl.h:
169         $(WIDL) $(IDLFLAGS) -h -H $@ $<
171 .idl_c.c:
172         $(WIDL) $(IDLFLAGS) -c -C $@ $<
174 .idl_i.c:
175         $(WIDL) $(IDLFLAGS) -u -U $@ $<
177 .idl_p.c:
178         $(WIDL) $(IDLFLAGS) -p -P $@ $<
180 .idl_s.c:
181         $(WIDL) $(IDLFLAGS) -s -S $@ $<
183 .idl.tlb:
184         $(WIDL) $(IDLFLAGS) -t -T $@ $<
186 .c.ln:
187         $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
189 .c.ok:
190         $(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
192 .sfd.ttf:
193         $(FONTFORGE) -script $(TOPSRCDIR)/fonts/genttf.ff $< $@
195 .man.in.man:
196         LC_ALL=C sed -e 's,@bindir\@,$(bindir),g' -e 's,@dlldir\@,$(dlldir),g' -e 's,@PACKAGE_STRING\@,@PACKAGE_STRING@,g' $< >$@ || ($(RM) $@ && false)
198 .svg.ico:
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)
210 # Rule for linting
212 $(MODULE).ln : $(LINTS)
213         if test "$(LINTS)" ; \
214         then \
215                 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
216                 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
217         else \
218                 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
219         fi
221 lint:: $(MODULE).ln
223 # Rules for Windows API checking
225 winapi_check:: dummy
226         $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
228 .PHONY: winapi_check
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__)
245 # Rules for cleaning
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__)
276 $(INSTALLDIRS):
277         $(MKINSTALLDIRS) $@
279 .PHONY: install install-lib install-dev uninstall \
280         $(SUBDIRS:%=%/__install__) $(SUBDIRS:%=%/__uninstall__) \
281         $(SUBDIRS:%=%/__install-lib__) $(SUBDIRS:%=%/__install-dev__)
283 # Rules for testing
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__)
319 # Misc. rules
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)
327 $(SUBDIRS): dummy
328         @cd $@ && $(MAKE)
330 dummy:
332 .PHONY: dummy $(SUBDIRS)
334 # End of global rules