blob: cd9c22e50d4bf6a5500ffbb44a46cdcb9a9e2e4d [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 Julliarddcf55482011-01-04 11:20:30 +010020RCFLAGS = --nostdinc --po-dir=$(top_srcdir)/po $(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 Julliard81b8ee82010-09-19 12:36:48 +020027CLEAN_FILES = *.o *.a *.so *.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) \
30 $(PO_SRCS:%=rsrc.pot) $(MC_SRCS:%=msg.pot)
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 Julliard9771ad82011-01-18 16:56:02 +010033 $(IDL_R_SRCS:.idl=_r.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 Julliard9771ad82011-01-18 16:56:02 +010045.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 .cross.o @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
Patrik Stridvalla9be64e1999-07-31 17:39:44 +000089.c.ln:
90 $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
91
Alexandre Julliardcaa03382002-02-20 19:03:59 +000092.c.ok:
Alexandre Julliardedeee892002-08-09 01:22:40 +000093 $(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
Alexandre Julliardcaa03382002-02-20 19:03:59 +000094
Huw Davies00acb5f2004-08-17 22:33:14 +000095.sfd.ttf:
Alexandre Julliardbd9852c2010-09-19 12:40:12 +020096 $(FONTFORGE) -script $(top_srcdir)/fonts/genttf.ff $< $@
Huw Davies00acb5f2004-08-17 22:33:14 +000097
Alexandre Julliard664e4102005-10-06 16:06:04 +000098.man.in.man:
Alexandre Julliard1716f032007-12-12 14:39:54 +010099 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 +0000100
Alexandre Julliarddc4a4752008-03-20 16:09:18 +0100101.svg.ico:
Joel Holdsworth465e6532010-05-16 23:07:57 +0100102 CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
Alexandre Julliarddc4a4752008-03-20 16:09:18 +0100103
Joel Holdsworth66bd5f72010-04-24 14:06:11 +0100104.svg.bmp:
Joel Holdsworth465e6532010-05-16 23:07:57 +0100105 CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
Joel Holdsworth66bd5f72010-04-24 14:06:11 +0100106
Alexandre Julliardb0585bf2007-12-10 14:26:13 +0100107# Rules for IDL files
108
109dlldata.c: $(WIDL) Makefile.in
Alexandre Julliard233814c2010-11-27 12:33:05 +0100110 $(WIDL) $(IDLFLAGS) --dlldata-only -o $@ $(IDL_P_SRCS)
Alexandre Julliardb0585bf2007-12-10 14:26:13 +0100111
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000112# Rule for linting
113
Patrik Stridvalla9be64e1999-07-31 17:39:44 +0000114$(MODULE).ln : $(LINTS)
115 if test "$(LINTS)" ; \
116 then \
117 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
118 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
119 else \
120 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
121 fi
122
123lint:: $(MODULE).ln
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000124
Patrik Stridvall385dc181999-09-29 10:24:19 +0000125# Rules for Windows API checking
126
Alexandre Julliardf673b712002-06-14 23:48:27 +0000127winapi_check:: dummy
Patrik Stridvall385dc181999-09-29 10:24:19 +0000128 $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
129
Alexandre Julliardf673b712002-06-14 23:48:27 +0000130.PHONY: winapi_check
131
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000132# Rules for dependencies
133
Alexandre Julliardc6ae9a32009-12-29 12:45:37 +0100134DEPEND_SRCS = $(C_SRCS) $(RC_SRCS) $(MC_SRCS) \
Alexandre Julliardda191222008-04-24 22:13:57 +0200135 $(IDL_H_SRCS) $(IDL_C_SRCS) $(IDL_I_SRCS) $(IDL_P_SRCS) $(IDL_S_SRCS) \
Alexandre Julliard1a2837a2010-11-30 11:53:52 +0100136 $(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 +0200137 $(BISON_SRCS) $(LEX_SRCS) $(EXTRA_SRCS)
Alexandre Julliard9c085cb2006-09-09 13:16:22 +0200138
Alexandre Julliard93f03392010-02-10 20:27:52 +0100139depend: dummy
Alexandre Julliardbd9852c2010-09-19 12:40:12 +0200140 $(MAKEDEP) $(MAKEDEPFLAGS) -C$(srcdir) -S$(top_srcdir) -T$(top_builddir) $(EXTRAINCL) $(DEPEND_SRCS)
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000141
Alexandre Julliard93f03392010-02-10 20:27:52 +0100142.PHONY: depend
Alexandre Julliardf673b712002-06-14 23:48:27 +0000143
Alexandre Julliard15ccabc2010-12-05 16:17:42 +0100144# Rules for man pages
145
146MANPAGES = $(MANPAGE) $(EXTRA_MANPAGES)
147
148all: $(MANPAGES)
149
150install-man-pages:: $(MANPAGE) $(DESTDIR)$(mandir)/man$(prog_manext)
151 $(INSTALL_DATA) $(MANPAGE) $(DESTDIR)$(mandir)/man$(prog_manext)/$(MANPAGE:.man=).$(prog_manext)
152
153uninstall-man-pages::
154 $(RM) $(DESTDIR)$(mandir)/man$(prog_manext)/$(MANPAGE:.man=).$(prog_manext)
155
156install:: @WOW64_DISABLE@ $(MANPAGE:%=install-man-pages)
157uninstall:: @WOW64_DISABLE@ $(MANPAGE:%=uninstall-man-pages)
158
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000159# Rules for cleaning
160
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000161$(EXTRASUBDIRS:%=%/__clean__): dummy
162 -cd `dirname $@` && $(RM) $(CLEAN_FILES)
163
Alexandre Julliard93f03392010-02-10 20:27:52 +0100164clean:: $(EXTRASUBDIRS:%=%/__clean__)
Alexandre Julliardb64ceef2007-09-18 13:29:07 +0200165 $(RM) $(CLEAN_FILES) $(CLEAN_TARGETS) $(PROGRAMS) $(MANPAGES)
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000166
Alexandre Julliard93f03392010-02-10 20:27:52 +0100167.PHONY: clean $(EXTRASUBDIRS:%=%/__clean__)
Alexandre Julliardf673b712002-06-14 23:48:27 +0000168
Alexandre Julliard2f158c22000-06-14 21:45:38 +0000169# Rules for installing
170
Alexandre Julliard2886e9b2006-08-07 17:48:18 +0200171$(INSTALLDIRS):
172 $(MKINSTALLDIRS) $@
173
Alexandre Julliard93f03392010-02-10 20:27:52 +0100174install install-lib install-dev uninstall::
Alexandre Julliardf673b712002-06-14 23:48:27 +0000175
Alexandre Julliard93f03392010-02-10 20:27:52 +0100176.PHONY: install install-lib install-dev uninstall
Alexandre Julliardf673b712002-06-14 23:48:27 +0000177
Alexandre Julliard367fd222011-01-04 17:05:21 +0100178# Rules for resources
179
Alexandre Julliard417b70b2011-01-24 21:23:03 +0100180all: @MAINTAINER_MODE@ $(PO_SRCS:%=rsrc.pot) $(MC_SRCS:%=msg.pot)
Alexandre Julliard367fd222011-01-04 17:05:21 +0100181
Alexandre Julliard7e6c75f2011-01-08 12:23:48 +0100182rsrc.pot: $(WRC)
Alexandre Julliard367fd222011-01-04 17:05:21 +0100183 $(LDPATH) $(WRC) $(RCFLAGS) -O pot -o $@ $(PO_SRCS)
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000184
Alexandre Julliard417b70b2011-01-24 21:23:03 +0100185msg.pot: $(WMC)
186 $(LDPATH) $(WMC) -O pot -o $@ $(MC_SRCS)
187
188$(MC_SRCS:.mc=.res): $(WMC) $(ALL_PO_FILES)
Alexandre Julliard9771ad82011-01-18 16:56:02 +0100189$(RC_SRCS:.rc=.res): $(WRC)
Alexandre Julliard7c2a4bf2011-01-04 16:55:54 +0100190$(PO_SRCS:.rc=.res): $(ALL_PO_FILES)
Alexandre Julliardda191222008-04-24 22:13:57 +0200191
Alexandre Julliard367fd222011-01-04 17:05:21 +0100192# Misc. rules
193
194$(IDL_GEN_HEADERS) $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) $(IDL_R_SRCS:.idl=_r.res): $(WIDL)
195
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000196dummy:
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000197
Alexandre Julliard93f03392010-02-10 20:27:52 +0100198.PHONY: dummy
Alexandre Julliardf673b712002-06-14 23:48:27 +0000199
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000200# End of global rules