blob: c5518c1bae65edbedabb9e03dd6e0c54d1291716 [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 Julliardc685b992010-09-29 20:13:44 +020020RCFLAGS = --nostdinc $(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 Julliard1137f4b2008-03-13 11:47:23 +010029 $(BISON_SRCS:.y=.tab.c) $(BISON_SRCS:.y=.tab.h) $(LEX_SRCS:.l=.yy.c) $(MC_SRCS:.mc=.mc.rc)
Alexandre Julliardce251562006-12-29 12:42:25 +010030
Alexandre Julliardd6cc6ca2009-07-03 15:47:43 +020031OBJS = $(C_SRCS:.c=.o) $(BISON_SRCS:.y=.tab.o) $(LEX_SRCS:.l=.yy.o) $(IDL_GEN_C_SRCS:.c=.o) \
32 $(RC_SRCS:.rc=.res) $(MC_SRCS:.mc=.mc.res) $(EXTRA_OBJS)
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +000033
Alexandre Julliardcce43872010-01-23 18:00:54 +010034CROSSOBJS = $(OBJS:.o=.cross.o)
Steven Edwards9138fbb2002-07-29 23:28:09 +000035LINTS = $(C_SRCS:.c=.ln)
Patrik Stridvalla9be64e1999-07-31 17:39:44 +000036
Alexandre Julliardd8e3d182008-04-24 12:46:43 +020037filter: dummy
Alexandre Julliardbd9852c2010-09-19 12:40:12 +020038 @$(top_srcdir)/tools/winapi/make_filter --make $(MAKE) all
Alexandre Julliardd8e3d182008-04-24 12:46:43 +020039
40.PHONY: all filter
41
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +000042# Implicit rules
43
Joel Holdsworth66bd5f72010-04-24 14:06:11 +010044.SUFFIXES: .mc .rc .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 .cross.o @MAINTAINER_MODE@ .sfd .ttf .svg .ico .bmp
Alexandre Julliardff8331e1995-09-18 11:19:54 +000045
46.c.o:
François Gouget1c3a2422001-11-09 19:15:51 +000047 $(CC) -c $(ALLCFLAGS) -o $@ $<
Alexandre Julliardff8331e1995-09-18 11:19:54 +000048
Alexandre Julliardcce43872010-01-23 18:00:54 +010049.c.cross.o:
Alexandre Julliard5d2b8e72010-04-08 17:29:11 +020050 $(CROSSCC) -c $(INCLUDES) $(DEFS) -DWINE_CROSSTEST $(CPPFLAGS) $(CFLAGS) -o $@ $<
Alexandre Julliardcce43872010-01-23 18:00:54 +010051
Alexandre Julliard9c085cb2006-09-09 13:16:22 +020052.y.tab.c:
Alexandre Julliardbcdc5fb2006-09-11 21:47:49 +020053 $(BISON) $(BISONFLAGS) -p $*_ -o $@ $<
Alexandre Julliard9c085cb2006-09-09 13:16:22 +020054
55.y.tab.h:
Alexandre Julliardbcdc5fb2006-09-11 21:47:49 +020056 $(BISON) $(BISONFLAGS) -p $*_ -o $*.tab.c -d $<
Alexandre Julliard9c085cb2006-09-09 13:16:22 +020057
58.l.yy.c:
Alexandre Julliard40916272007-03-08 13:19:50 +010059 $(FLEX) $(LEXFLAGS) -o$@ $<
Alexandre Julliard9c085cb2006-09-09 13:16:22 +020060
Alexandre Julliard017a61e2000-11-06 05:30:48 +000061.mc.mc.rc:
Martin Fuchs3f441672002-10-19 17:15:00 +000062 $(LDPATH) $(WMC) -i -U -H /dev/null -o $@ $<
Alexandre Julliardf5aee672000-07-25 17:52:08 +000063
Alexandre Julliarda845b881998-06-01 10:44:35 +000064.rc.res:
Alexandre Julliardc685b992010-09-29 20:13:44 +020065 $(LDPATH) $(WRC) $(RCFLAGS) -o $@ $<
Alexandre Julliarda845b881998-06-01 10:44:35 +000066
Alexandre Julliard233766a2004-09-20 21:48:42 +000067.idl.h:
Alexandre Julliardd0629242004-10-05 04:44:20 +000068 $(WIDL) $(IDLFLAGS) -h -H $@ $<
Alexandre Julliard233766a2004-09-20 21:48:42 +000069
Alexandre Julliard4e67a452006-08-09 12:38:15 +020070.idl_c.c:
71 $(WIDL) $(IDLFLAGS) -c -C $@ $<
72
73.idl_i.c:
74 $(WIDL) $(IDLFLAGS) -u -U $@ $<
75
76.idl_p.c:
77 $(WIDL) $(IDLFLAGS) -p -P $@ $<
78
79.idl_s.c:
80 $(WIDL) $(IDLFLAGS) -s -S $@ $<
81
Huw Davies40468462005-01-28 14:13:08 +000082.idl.tlb:
Alexandre Julliardf914b572009-05-21 11:37:34 +020083 $(WIDL) $(TARGETFLAGS) $(IDLFLAGS) -t -T $@ $<
Huw Davies40468462005-01-28 14:13:08 +000084
Patrik Stridvalla9be64e1999-07-31 17:39:44 +000085.c.ln:
86 $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
87
Alexandre Julliardcaa03382002-02-20 19:03:59 +000088.c.ok:
Alexandre Julliardedeee892002-08-09 01:22:40 +000089 $(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
Alexandre Julliardcaa03382002-02-20 19:03:59 +000090
Huw Davies00acb5f2004-08-17 22:33:14 +000091.sfd.ttf:
Alexandre Julliardbd9852c2010-09-19 12:40:12 +020092 $(FONTFORGE) -script $(top_srcdir)/fonts/genttf.ff $< $@
Huw Davies00acb5f2004-08-17 22:33:14 +000093
Alexandre Julliard664e4102005-10-06 16:06:04 +000094.man.in.man:
Alexandre Julliard1716f032007-12-12 14:39:54 +010095 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 +000096
Alexandre Julliarddc4a4752008-03-20 16:09:18 +010097.svg.ico:
Joel Holdsworth465e6532010-05-16 23:07:57 +010098 CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
Alexandre Julliarddc4a4752008-03-20 16:09:18 +010099
Joel Holdsworth66bd5f72010-04-24 14:06:11 +0100100.svg.bmp:
Joel Holdsworth465e6532010-05-16 23:07:57 +0100101 CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
Joel Holdsworth66bd5f72010-04-24 14:06:11 +0100102
Alexandre Julliardb0585bf2007-12-10 14:26:13 +0100103# Rules for IDL files
104
105dlldata.c: $(WIDL) Makefile.in
106 $(WIDL) $(IDLFLAGS) --dlldata-only --dlldata=$@ $(IDL_P_SRCS)
107
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000108# Rule for linting
109
Patrik Stridvalla9be64e1999-07-31 17:39:44 +0000110$(MODULE).ln : $(LINTS)
111 if test "$(LINTS)" ; \
112 then \
113 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
114 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
115 else \
116 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
117 fi
118
119lint:: $(MODULE).ln
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000120
Patrik Stridvall385dc181999-09-29 10:24:19 +0000121# Rules for Windows API checking
122
Alexandre Julliardf673b712002-06-14 23:48:27 +0000123winapi_check:: dummy
Patrik Stridvall385dc181999-09-29 10:24:19 +0000124 $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
125
Alexandre Julliardf673b712002-06-14 23:48:27 +0000126.PHONY: winapi_check
127
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000128# Rules for dependencies
129
Alexandre Julliardc6ae9a32009-12-29 12:45:37 +0100130DEPEND_SRCS = $(C_SRCS) $(RC_SRCS) $(MC_SRCS) \
Alexandre Julliardda191222008-04-24 22:13:57 +0200131 $(IDL_H_SRCS) $(IDL_C_SRCS) $(IDL_I_SRCS) $(IDL_P_SRCS) $(IDL_S_SRCS) \
132 $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) \
133 $(BISON_SRCS) $(LEX_SRCS) $(EXTRA_SRCS)
Alexandre Julliard9c085cb2006-09-09 13:16:22 +0200134
Alexandre Julliard93f03392010-02-10 20:27:52 +0100135depend: dummy
Alexandre Julliardbd9852c2010-09-19 12:40:12 +0200136 $(MAKEDEP) $(MAKEDEPFLAGS) -C$(srcdir) -S$(top_srcdir) -T$(top_builddir) $(EXTRAINCL) $(DEPEND_SRCS)
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000137
Alexandre Julliard93f03392010-02-10 20:27:52 +0100138.PHONY: depend
Alexandre Julliardf673b712002-06-14 23:48:27 +0000139
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000140# Rules for cleaning
141
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000142$(EXTRASUBDIRS:%=%/__clean__): dummy
143 -cd `dirname $@` && $(RM) $(CLEAN_FILES)
144
Alexandre Julliard93f03392010-02-10 20:27:52 +0100145clean:: $(EXTRASUBDIRS:%=%/__clean__)
Alexandre Julliardb64ceef2007-09-18 13:29:07 +0200146 $(RM) $(CLEAN_FILES) $(CLEAN_TARGETS) $(PROGRAMS) $(MANPAGES)
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000147
Alexandre Julliard93f03392010-02-10 20:27:52 +0100148.PHONY: clean $(EXTRASUBDIRS:%=%/__clean__)
Alexandre Julliardf673b712002-06-14 23:48:27 +0000149
Alexandre Julliard2f158c22000-06-14 21:45:38 +0000150# Rules for installing
151
Alexandre Julliard2886e9b2006-08-07 17:48:18 +0200152$(INSTALLDIRS):
153 $(MKINSTALLDIRS) $@
154
Alexandre Julliard93f03392010-02-10 20:27:52 +0100155install install-lib install-dev uninstall::
Alexandre Julliardf673b712002-06-14 23:48:27 +0000156
Alexandre Julliard93f03392010-02-10 20:27:52 +0100157.PHONY: install install-lib install-dev uninstall
Alexandre Julliardf673b712002-06-14 23:48:27 +0000158
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000159# Misc. rules
160
Alexandre Julliard017a61e2000-11-06 05:30:48 +0000161$(MC_SRCS:.mc=.mc.rc): $(WMC)
Alexandre Julliardf5aee672000-07-25 17:52:08 +0000162
Alexandre Julliard1df72cc2007-02-09 14:32:36 +0100163$(IDL_GEN_HEADERS) $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS:.idl=.tlb): $(WIDL)
Vincent Béron860c84b2005-02-08 12:13:10 +0000164
Alexandre Julliardc6ae9a32009-12-29 12:45:37 +0100165$(RC_SRCS:.rc=.res) $(MC_SRCS:.mc=.mc.res): $(WRC)
Alexandre Julliardda191222008-04-24 22:13:57 +0200166
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000167dummy:
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000168
Alexandre Julliard93f03392010-02-10 20:27:52 +0100169.PHONY: dummy
Alexandre Julliardf673b712002-06-14 23:48:27 +0000170
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000171# End of global rules