blob: 7c4a65c4aa6c3e502126884d90a4b29d457a54fe [file] [log] [blame]
Alexandre Julliard139a4b11996-11-02 14:24:07 +00001# Global rules shared by all makefiles -*-Makefile-*-
Alexandre Julliardbf9130a1996-10-13 17:45:47 +00002#
Alexandre Julliard81b8ee82010-09-19 12:36:48 +02003# Each individual makefile may define the following variables:
Alexandre Julliardc53ceba2000-04-09 18:19:59 +00004# C_SRCS : C sources for the module
Alexandre Julliardc53ceba2000-04-09 18:19:59 +00005# RC_SRCS : resource source files
Alexandre Julliardc53ceba2000-04-09 18:19:59 +00006# EXTRA_SRCS : extra source files for make depend
7# EXTRA_OBJS : extra object files
Alexandre Julliard32459912002-05-09 00:05:48 +00008# IMPORTS : dlls to import
9# DELAYIMPORTS : dlls to import in delayed mode
Alexandre Julliardc53ceba2000-04-09 18:19:59 +000010# EXTRASUBDIRS : subdirectories that do not contain a Makefile
Mike McCormackb7443722005-08-11 17:12:18 +000011# MODCFLAGS : extra CFLAGS for this module
Alexandre Julliardff8331e1995-09-18 11:19:54 +000012
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +000013# First some useful definitions
14
Alexandre Julliard81b8ee82010-09-19 12:36:48 +020015LDSHARED = @LDSHARED@
Alexandre Julliardbd9852c2010-09-19 12:40:12 +020016INCLUDES = -I$(srcdir) -I. -I$(top_srcdir)/include -I$(top_builddir)/include $(EXTRAINCL)
Mike McCormackb7443722005-08-11 17:12:18 +000017ALLCFLAGS = $(INCLUDES) $(DEFS) $(DLLFLAGS) $(EXTRACFLAGS) $(CPPFLAGS) $(CFLAGS) $(MODCFLAGS)
Alexandre Julliardfc094232003-04-14 21:46:41 +000018ALLLINTFLAGS = $(INCLUDES) $(DEFS) $(LINTFLAGS)
Alexandre Julliard16cd8612003-09-24 19:01:44 +000019IDLFLAGS = $(INCLUDES) $(DEFS) $(EXTRAIDLFLAGS)
Alexandre Julliardf4ec0972011-10-22 18:21:04 +020020RCFLAGS = --nostdinc $(PORCFLAGS) $(TARGETFLAGS) $(INCLUDES) $(DEFS) $(EXTRARCFLAGS)
Alexandre Julliard641ee761997-08-04 16:34:36 +000021
Alexandre Julliard1df72cc2007-02-09 14:32:36 +010022IDL_GEN_C_SRCS = $(IDL_C_SRCS:.idl=_c.c) $(IDL_I_SRCS:.idl=_i.c) \
23 $(IDL_P_SRCS:.idl=_p.c) $(IDL_S_SRCS:.idl=_s.c)
24IDL_GEN_HEADERS = $(IDL_H_SRCS:.idl=.h) $(IDL_C_SRCS:.idl=.h) $(IDL_I_SRCS:.idl=.h) \
25 $(IDL_P_SRCS:.idl=.h) $(IDL_S_SRCS:.idl=.h)
Alexandre Julliardce251562006-12-29 12:42:25 +010026
Alexandre Julliard268976b2011-10-22 15:23:14 +020027CLEAN_FILES = *.o *.a *.so *.mo *.ln *.res *.fake *.$(LIBEXT) \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej *.flc core
Alexandre Julliardb0585bf2007-12-10 14:26:13 +010028CLEAN_TARGETS = $(IDL_GEN_C_SRCS) $(IDL_GEN_HEADERS) $(IDL_TLB_SRCS:.idl=.tlb) $(IDL_P_SRCS:%=dlldata.c) \
Alexandre Julliard417b70b2011-01-24 21:23:03 +010029 $(BISON_SRCS:.y=.tab.c) $(BISON_SRCS:.y=.tab.h) $(LEX_SRCS:.l=.yy.c) \
Alexandre Julliard0435b582011-05-05 15:02:25 +020030 $(PO_SRCS:%=rsrc.pot) $(MC_SRCS:%=msg.pot) $(XTEMPLATE_SRCS:.x=.h)
Alexandre Julliardce251562006-12-29 12:42:25 +010031
Alexandre Julliardd6cc6ca2009-07-03 15:47:43 +020032OBJS = $(C_SRCS:.c=.o) $(BISON_SRCS:.y=.tab.o) $(LEX_SRCS:.l=.yy.o) $(IDL_GEN_C_SRCS:.c=.o) \
Alexandre Julliard729afa62011-08-01 22:14:36 +020033 $(IDL_R_SRCS:.idl=_r.res) $(IDL_TLB_RES) $(RC_SRCS:.rc=.res) $(MC_SRCS:.mc=.res) $(EXTRA_OBJS)
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +000034
Alexandre Julliardcce43872010-01-23 18:00:54 +010035CROSSOBJS = $(OBJS:.o=.cross.o)
Steven Edwards9138fbb2002-07-29 23:28:09 +000036LINTS = $(C_SRCS:.c=.ln)
Patrik Stridvalla9be64e1999-07-31 17:39:44 +000037
Alexandre Julliardd8e3d182008-04-24 12:46:43 +020038filter: dummy
Alexandre Julliardbd9852c2010-09-19 12:40:12 +020039 @$(top_srcdir)/tools/winapi/make_filter --make $(MAKE) all
Alexandre Julliardd8e3d182008-04-24 12:46:43 +020040
41.PHONY: all filter
42
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +000043# Implicit rules
44
Alexandre Julliard268976b2011-10-22 15:23:14 +020045.SUFFIXES: .mc .rc .res .idl .tlb .h .y .l .tab.c .tab.h .yy.c .ok .man.in .man _c.c _i.c _p.c _s.c _r.res _t.res .cross.o .po .mo @MAINTAINER_MODE@ .sfd .ttf .svg .ico .bmp
Alexandre Julliardff8331e1995-09-18 11:19:54 +000046
47.c.o:
François Gouget1c3a2422001-11-09 19:15:51 +000048 $(CC) -c $(ALLCFLAGS) -o $@ $<
Alexandre Julliardff8331e1995-09-18 11:19:54 +000049
Alexandre Julliardcce43872010-01-23 18:00:54 +010050.c.cross.o:
Alexandre Julliard5d2b8e72010-04-08 17:29:11 +020051 $(CROSSCC) -c $(INCLUDES) $(DEFS) -DWINE_CROSSTEST $(CPPFLAGS) $(CFLAGS) -o $@ $<
Alexandre Julliardcce43872010-01-23 18:00:54 +010052
Alexandre Julliard9c085cb2006-09-09 13:16:22 +020053.y.tab.c:
Alexandre Julliardbcdc5fb2006-09-11 21:47:49 +020054 $(BISON) $(BISONFLAGS) -p $*_ -o $@ $<
Alexandre Julliard9c085cb2006-09-09 13:16:22 +020055
56.y.tab.h:
Alexandre Julliardbcdc5fb2006-09-11 21:47:49 +020057 $(BISON) $(BISONFLAGS) -p $*_ -o $*.tab.c -d $<
Alexandre Julliard9c085cb2006-09-09 13:16:22 +020058
59.l.yy.c:
Alexandre Julliard40916272007-03-08 13:19:50 +010060 $(FLEX) $(LEXFLAGS) -o$@ $<
Alexandre Julliard9c085cb2006-09-09 13:16:22 +020061
Alexandre Julliard9771ad82011-01-18 16:56:02 +010062.mc.res:
Alexandre Julliard417b70b2011-01-24 21:23:03 +010063 $(LDPATH) $(WMC) -U -O res -P $(top_srcdir)/po -o $@ $<
Alexandre Julliardf5aee672000-07-25 17:52:08 +000064
Alexandre Julliarda845b881998-06-01 10:44:35 +000065.rc.res:
Alexandre Julliardc685b992010-09-29 20:13:44 +020066 $(LDPATH) $(WRC) $(RCFLAGS) -o $@ $<
Alexandre Julliarda845b881998-06-01 10:44:35 +000067
Alexandre Julliard233766a2004-09-20 21:48:42 +000068.idl.h:
Alexandre Julliard233814c2010-11-27 12:33:05 +010069 $(WIDL) $(IDLFLAGS) -h -o $@ $<
Alexandre Julliard233766a2004-09-20 21:48:42 +000070
Alexandre Julliard4e67a452006-08-09 12:38:15 +020071.idl_c.c:
Alexandre Julliard233814c2010-11-27 12:33:05 +010072 $(WIDL) $(IDLFLAGS) -c -o $@ $<
Alexandre Julliard4e67a452006-08-09 12:38:15 +020073
74.idl_i.c:
Alexandre Julliard233814c2010-11-27 12:33:05 +010075 $(WIDL) $(IDLFLAGS) -u -o $@ $<
Alexandre Julliard4e67a452006-08-09 12:38:15 +020076
77.idl_p.c:
Alexandre Julliard233814c2010-11-27 12:33:05 +010078 $(WIDL) $(IDLFLAGS) -p -o $@ $<
Alexandre Julliard4e67a452006-08-09 12:38:15 +020079
Alexandre Julliard1a2837a2010-11-30 11:53:52 +010080.idl_r.res:
81 $(WIDL) $(IDLFLAGS) -r -o $@ $<
82
Alexandre Julliard4e67a452006-08-09 12:38:15 +020083.idl_s.c:
Alexandre Julliard233814c2010-11-27 12:33:05 +010084 $(WIDL) $(IDLFLAGS) -s -o $@ $<
Alexandre Julliard4e67a452006-08-09 12:38:15 +020085
Huw Davies40468462005-01-28 14:13:08 +000086.idl.tlb:
Alexandre Julliard233814c2010-11-27 12:33:05 +010087 $(WIDL) $(TARGETFLAGS) $(IDLFLAGS) -t -o $@ $<
Huw Davies40468462005-01-28 14:13:08 +000088
Alexandre Julliard729afa62011-08-01 22:14:36 +020089.idl_t.res:
90 $(WIDL) $(TARGETFLAGS) $(IDLFLAGS) -t -o $@ $<
91
Patrik Stridvalla9be64e1999-07-31 17:39:44 +000092.c.ln:
93 $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
94
Alexandre Julliardcaa03382002-02-20 19:03:59 +000095.c.ok:
Alexandre Julliardedeee892002-08-09 01:22:40 +000096 $(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
Alexandre Julliardcaa03382002-02-20 19:03:59 +000097
Huw Davies00acb5f2004-08-17 22:33:14 +000098.sfd.ttf:
Alexandre Julliardbd9852c2010-09-19 12:40:12 +020099 $(FONTFORGE) -script $(top_srcdir)/fonts/genttf.ff $< $@
Huw Davies00acb5f2004-08-17 22:33:14 +0000100
Alexandre Julliard664e4102005-10-06 16:06:04 +0000101.man.in.man:
Alexandre Julliard1716f032007-12-12 14:39:54 +0100102 LC_ALL=C sed -e 's,@bindir\@,$(bindir),g' -e 's,@dlldir\@,$(dlldir),g' -e 's,@PACKAGE_STRING\@,@PACKAGE_STRING@,g' $< >$@ || ($(RM) $@ && false)
Alexandre Julliard664e4102005-10-06 16:06:04 +0000103
Alexandre Julliarddc4a4752008-03-20 16:09:18 +0100104.svg.ico:
Joel Holdsworth465e6532010-05-16 23:07:57 +0100105 CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
Alexandre Julliarddc4a4752008-03-20 16:09:18 +0100106
Joel Holdsworth66bd5f72010-04-24 14:06:11 +0100107.svg.bmp:
Joel Holdsworth465e6532010-05-16 23:07:57 +0100108 CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
Joel Holdsworth66bd5f72010-04-24 14:06:11 +0100109
Alexandre Julliard268976b2011-10-22 15:23:14 +0200110.po.mo:
111 $(MSGFMT) -o $@ $<
112
Alexandre Julliardb0585bf2007-12-10 14:26:13 +0100113# Rules for IDL files
114
115dlldata.c: $(WIDL) Makefile.in
Alexandre Julliard233814c2010-11-27 12:33:05 +0100116 $(WIDL) $(IDLFLAGS) --dlldata-only -o $@ $(IDL_P_SRCS)
Alexandre Julliardb0585bf2007-12-10 14:26:13 +0100117
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000118# Rule for linting
119
Patrik Stridvalla9be64e1999-07-31 17:39:44 +0000120$(MODULE).ln : $(LINTS)
121 if test "$(LINTS)" ; \
122 then \
123 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
124 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
125 else \
126 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
127 fi
128
129lint:: $(MODULE).ln
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000130
Patrik Stridvall385dc181999-09-29 10:24:19 +0000131# Rules for Windows API checking
132
Alexandre Julliardf673b712002-06-14 23:48:27 +0000133winapi_check:: dummy
Patrik Stridvall385dc181999-09-29 10:24:19 +0000134 $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
135
Alexandre Julliardf673b712002-06-14 23:48:27 +0000136.PHONY: winapi_check
137
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000138# Rules for dependencies
139
Alexandre Julliardc6ae9a32009-12-29 12:45:37 +0100140DEPEND_SRCS = $(C_SRCS) $(RC_SRCS) $(MC_SRCS) \
Alexandre Julliardda191222008-04-24 22:13:57 +0200141 $(IDL_H_SRCS) $(IDL_C_SRCS) $(IDL_I_SRCS) $(IDL_P_SRCS) $(IDL_S_SRCS) \
Alexandre Julliard1a2837a2010-11-30 11:53:52 +0100142 $(IDL_GEN_C_SRCS) $(IDL_R_SRCS:.idl=_r.res) $(IDL_TLB_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) \
Alexandre Julliardda191222008-04-24 22:13:57 +0200143 $(BISON_SRCS) $(LEX_SRCS) $(EXTRA_SRCS)
Alexandre Julliard9c085cb2006-09-09 13:16:22 +0200144
Alexandre Julliard93f03392010-02-10 20:27:52 +0100145depend: dummy
Alexandre Julliardbd9852c2010-09-19 12:40:12 +0200146 $(MAKEDEP) $(MAKEDEPFLAGS) -C$(srcdir) -S$(top_srcdir) -T$(top_builddir) $(EXTRAINCL) $(DEPEND_SRCS)
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000147
Alexandre Julliard93f03392010-02-10 20:27:52 +0100148.PHONY: depend
Alexandre Julliardf673b712002-06-14 23:48:27 +0000149
Alexandre Julliard15ccabc2010-12-05 16:17:42 +0100150# Rules for man pages
151
152MANPAGES = $(MANPAGE) $(EXTRA_MANPAGES)
153
154all: $(MANPAGES)
155
156install-man-pages:: $(MANPAGE) $(DESTDIR)$(mandir)/man$(prog_manext)
157 $(INSTALL_DATA) $(MANPAGE) $(DESTDIR)$(mandir)/man$(prog_manext)/$(MANPAGE:.man=).$(prog_manext)
158
159uninstall-man-pages::
160 $(RM) $(DESTDIR)$(mandir)/man$(prog_manext)/$(MANPAGE:.man=).$(prog_manext)
161
162install:: @WOW64_DISABLE@ $(MANPAGE:%=install-man-pages)
163uninstall:: @WOW64_DISABLE@ $(MANPAGE:%=uninstall-man-pages)
164
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000165# Rules for cleaning
166
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000167$(EXTRASUBDIRS:%=%/__clean__): dummy
168 -cd `dirname $@` && $(RM) $(CLEAN_FILES)
169
Alexandre Julliard93f03392010-02-10 20:27:52 +0100170clean:: $(EXTRASUBDIRS:%=%/__clean__)
Alexandre Julliardb64ceef2007-09-18 13:29:07 +0200171 $(RM) $(CLEAN_FILES) $(CLEAN_TARGETS) $(PROGRAMS) $(MANPAGES)
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000172
Alexandre Julliard93f03392010-02-10 20:27:52 +0100173.PHONY: clean $(EXTRASUBDIRS:%=%/__clean__)
Alexandre Julliardf673b712002-06-14 23:48:27 +0000174
Alexandre Julliard2f158c22000-06-14 21:45:38 +0000175# Rules for installing
176
Alexandre Julliard2886e9b2006-08-07 17:48:18 +0200177$(INSTALLDIRS):
178 $(MKINSTALLDIRS) $@
179
Alexandre Julliard93f03392010-02-10 20:27:52 +0100180install install-lib install-dev uninstall::
Alexandre Julliardf673b712002-06-14 23:48:27 +0000181
Alexandre Julliard93f03392010-02-10 20:27:52 +0100182.PHONY: install install-lib install-dev uninstall
Alexandre Julliardf673b712002-06-14 23:48:27 +0000183
Alexandre Julliard367fd222011-01-04 17:05:21 +0100184# Rules for resources
185
Alexandre Julliard7e6c75f2011-01-08 12:23:48 +0100186rsrc.pot: $(WRC)
Alexandre Julliard367fd222011-01-04 17:05:21 +0100187 $(LDPATH) $(WRC) $(RCFLAGS) -O pot -o $@ $(PO_SRCS)
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000188
Alexandre Julliard417b70b2011-01-24 21:23:03 +0100189msg.pot: $(WMC)
190 $(LDPATH) $(WMC) -O pot -o $@ $(MC_SRCS)
191
Alexandre Julliardf4ec0972011-10-22 18:21:04 +0200192$(MC_SRCS:.mc=.res): $(WMC) $(ALL_MO_FILES)
Alexandre Julliard9771ad82011-01-18 16:56:02 +0100193$(RC_SRCS:.rc=.res): $(WRC)
Alexandre Julliardf4ec0972011-10-22 18:21:04 +0200194$(PO_SRCS:.rc=.res): $(ALL_MO_FILES)
Alexandre Julliardda191222008-04-24 22:13:57 +0200195
Alexandre Julliard367fd222011-01-04 17:05:21 +0100196# Misc. rules
197
Alexandre Julliard729afa62011-08-01 22:14:36 +0200198$(IDL_GEN_HEADERS) $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) $(IDL_TLB_RES) $(IDL_R_SRCS:.idl=_r.res): $(WIDL)
Alexandre Julliard367fd222011-01-04 17:05:21 +0100199
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000200dummy:
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000201
Alexandre Julliard93f03392010-02-10 20:27:52 +0100202.PHONY: dummy
Alexandre Julliardf673b712002-06-14 23:48:27 +0000203
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000204# End of global rules