Alexandre Julliard | 139a4b1 | 1996-11-02 14:24:07 +0000 | [diff] [blame] | 1 | # Global rules shared by all makefiles -*-Makefile-*- |
Alexandre Julliard | bf9130a | 1996-10-13 17:45:47 +0000 | [diff] [blame] | 2 | # |
Alexandre Julliard | 81b8ee8 | 2010-09-19 12:36:48 +0200 | [diff] [blame] | 3 | # Each individual makefile may define the following variables: |
Alexandre Julliard | c53ceba | 2000-04-09 18:19:59 +0000 | [diff] [blame] | 4 | # C_SRCS : C sources for the module |
Alexandre Julliard | c53ceba | 2000-04-09 18:19:59 +0000 | [diff] [blame] | 5 | # RC_SRCS : resource source files |
Alexandre Julliard | c53ceba | 2000-04-09 18:19:59 +0000 | [diff] [blame] | 6 | # EXTRA_SRCS : extra source files for make depend |
| 7 | # EXTRA_OBJS : extra object files |
Alexandre Julliard | 3245991 | 2002-05-09 00:05:48 +0000 | [diff] [blame] | 8 | # IMPORTS : dlls to import |
| 9 | # DELAYIMPORTS : dlls to import in delayed mode |
Alexandre Julliard | c53ceba | 2000-04-09 18:19:59 +0000 | [diff] [blame] | 10 | # EXTRASUBDIRS : subdirectories that do not contain a Makefile |
Mike McCormack | b744372 | 2005-08-11 17:12:18 +0000 | [diff] [blame] | 11 | # MODCFLAGS : extra CFLAGS for this module |
Alexandre Julliard | ff8331e | 1995-09-18 11:19:54 +0000 | [diff] [blame] | 12 | |
Alexandre Julliard | d7d4fdf | 1995-12-26 15:05:24 +0000 | [diff] [blame] | 13 | # First some useful definitions |
| 14 | |
Alexandre Julliard | 81b8ee8 | 2010-09-19 12:36:48 +0200 | [diff] [blame] | 15 | LDSHARED = @LDSHARED@ |
Alexandre Julliard | bd9852c | 2010-09-19 12:40:12 +0200 | [diff] [blame] | 16 | INCLUDES = -I$(srcdir) -I. -I$(top_srcdir)/include -I$(top_builddir)/include $(EXTRAINCL) |
Mike McCormack | b744372 | 2005-08-11 17:12:18 +0000 | [diff] [blame] | 17 | ALLCFLAGS = $(INCLUDES) $(DEFS) $(DLLFLAGS) $(EXTRACFLAGS) $(CPPFLAGS) $(CFLAGS) $(MODCFLAGS) |
Alexandre Julliard | fc09423 | 2003-04-14 21:46:41 +0000 | [diff] [blame] | 18 | ALLLINTFLAGS = $(INCLUDES) $(DEFS) $(LINTFLAGS) |
Alexandre Julliard | 16cd861 | 2003-09-24 19:01:44 +0000 | [diff] [blame] | 19 | IDLFLAGS = $(INCLUDES) $(DEFS) $(EXTRAIDLFLAGS) |
Alexandre Julliard | c685b99 | 2010-09-29 20:13:44 +0200 | [diff] [blame^] | 20 | RCFLAGS = --nostdinc $(TARGETFLAGS) $(INCLUDES) $(DEFS) $(EXTRARCFLAGS) |
Alexandre Julliard | 641ee76 | 1997-08-04 16:34:36 +0000 | [diff] [blame] | 21 | |
Alexandre Julliard | 1df72cc | 2007-02-09 14:32:36 +0100 | [diff] [blame] | 22 | IDL_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) |
| 24 | IDL_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 Julliard | ce25156 | 2006-12-29 12:42:25 +0100 | [diff] [blame] | 26 | |
Alexandre Julliard | 81b8ee8 | 2010-09-19 12:36:48 +0200 | [diff] [blame] | 27 | CLEAN_FILES = *.o *.a *.so *.ln *.res *.fake *.$(LIBEXT) \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej *.flc core |
Alexandre Julliard | b0585bf | 2007-12-10 14:26:13 +0100 | [diff] [blame] | 28 | CLEAN_TARGETS = $(IDL_GEN_C_SRCS) $(IDL_GEN_HEADERS) $(IDL_TLB_SRCS:.idl=.tlb) $(IDL_P_SRCS:%=dlldata.c) \ |
Alexandre Julliard | 1137f4b | 2008-03-13 11:47:23 +0100 | [diff] [blame] | 29 | $(BISON_SRCS:.y=.tab.c) $(BISON_SRCS:.y=.tab.h) $(LEX_SRCS:.l=.yy.c) $(MC_SRCS:.mc=.mc.rc) |
Alexandre Julliard | ce25156 | 2006-12-29 12:42:25 +0100 | [diff] [blame] | 30 | |
Alexandre Julliard | d6cc6ca | 2009-07-03 15:47:43 +0200 | [diff] [blame] | 31 | OBJS = $(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 Julliard | d7d4fdf | 1995-12-26 15:05:24 +0000 | [diff] [blame] | 33 | |
Alexandre Julliard | cce4387 | 2010-01-23 18:00:54 +0100 | [diff] [blame] | 34 | CROSSOBJS = $(OBJS:.o=.cross.o) |
Steven Edwards | 9138fbb | 2002-07-29 23:28:09 +0000 | [diff] [blame] | 35 | LINTS = $(C_SRCS:.c=.ln) |
Patrik Stridvall | a9be64e | 1999-07-31 17:39:44 +0000 | [diff] [blame] | 36 | |
Alexandre Julliard | d8e3d18 | 2008-04-24 12:46:43 +0200 | [diff] [blame] | 37 | filter: dummy |
Alexandre Julliard | bd9852c | 2010-09-19 12:40:12 +0200 | [diff] [blame] | 38 | @$(top_srcdir)/tools/winapi/make_filter --make $(MAKE) all |
Alexandre Julliard | d8e3d18 | 2008-04-24 12:46:43 +0200 | [diff] [blame] | 39 | |
| 40 | .PHONY: all filter |
| 41 | |
Alexandre Julliard | d7d4fdf | 1995-12-26 15:05:24 +0000 | [diff] [blame] | 42 | # Implicit rules |
| 43 | |
Joel Holdsworth | 66bd5f7 | 2010-04-24 14:06:11 +0100 | [diff] [blame] | 44 | .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 Julliard | ff8331e | 1995-09-18 11:19:54 +0000 | [diff] [blame] | 45 | |
| 46 | .c.o: |
François Gouget | 1c3a242 | 2001-11-09 19:15:51 +0000 | [diff] [blame] | 47 | $(CC) -c $(ALLCFLAGS) -o $@ $< |
Alexandre Julliard | ff8331e | 1995-09-18 11:19:54 +0000 | [diff] [blame] | 48 | |
Alexandre Julliard | cce4387 | 2010-01-23 18:00:54 +0100 | [diff] [blame] | 49 | .c.cross.o: |
Alexandre Julliard | 5d2b8e7 | 2010-04-08 17:29:11 +0200 | [diff] [blame] | 50 | $(CROSSCC) -c $(INCLUDES) $(DEFS) -DWINE_CROSSTEST $(CPPFLAGS) $(CFLAGS) -o $@ $< |
Alexandre Julliard | cce4387 | 2010-01-23 18:00:54 +0100 | [diff] [blame] | 51 | |
Alexandre Julliard | 9c085cb | 2006-09-09 13:16:22 +0200 | [diff] [blame] | 52 | .y.tab.c: |
Alexandre Julliard | bcdc5fb | 2006-09-11 21:47:49 +0200 | [diff] [blame] | 53 | $(BISON) $(BISONFLAGS) -p $*_ -o $@ $< |
Alexandre Julliard | 9c085cb | 2006-09-09 13:16:22 +0200 | [diff] [blame] | 54 | |
| 55 | .y.tab.h: |
Alexandre Julliard | bcdc5fb | 2006-09-11 21:47:49 +0200 | [diff] [blame] | 56 | $(BISON) $(BISONFLAGS) -p $*_ -o $*.tab.c -d $< |
Alexandre Julliard | 9c085cb | 2006-09-09 13:16:22 +0200 | [diff] [blame] | 57 | |
| 58 | .l.yy.c: |
Alexandre Julliard | 4091627 | 2007-03-08 13:19:50 +0100 | [diff] [blame] | 59 | $(FLEX) $(LEXFLAGS) -o$@ $< |
Alexandre Julliard | 9c085cb | 2006-09-09 13:16:22 +0200 | [diff] [blame] | 60 | |
Alexandre Julliard | 017a61e | 2000-11-06 05:30:48 +0000 | [diff] [blame] | 61 | .mc.mc.rc: |
Martin Fuchs | 3f44167 | 2002-10-19 17:15:00 +0000 | [diff] [blame] | 62 | $(LDPATH) $(WMC) -i -U -H /dev/null -o $@ $< |
Alexandre Julliard | f5aee67 | 2000-07-25 17:52:08 +0000 | [diff] [blame] | 63 | |
Alexandre Julliard | a845b88 | 1998-06-01 10:44:35 +0000 | [diff] [blame] | 64 | .rc.res: |
Alexandre Julliard | c685b99 | 2010-09-29 20:13:44 +0200 | [diff] [blame^] | 65 | $(LDPATH) $(WRC) $(RCFLAGS) -o $@ $< |
Alexandre Julliard | a845b88 | 1998-06-01 10:44:35 +0000 | [diff] [blame] | 66 | |
Alexandre Julliard | 233766a | 2004-09-20 21:48:42 +0000 | [diff] [blame] | 67 | .idl.h: |
Alexandre Julliard | d062924 | 2004-10-05 04:44:20 +0000 | [diff] [blame] | 68 | $(WIDL) $(IDLFLAGS) -h -H $@ $< |
Alexandre Julliard | 233766a | 2004-09-20 21:48:42 +0000 | [diff] [blame] | 69 | |
Alexandre Julliard | 4e67a45 | 2006-08-09 12:38:15 +0200 | [diff] [blame] | 70 | .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 Davies | 4046846 | 2005-01-28 14:13:08 +0000 | [diff] [blame] | 82 | .idl.tlb: |
Alexandre Julliard | f914b57 | 2009-05-21 11:37:34 +0200 | [diff] [blame] | 83 | $(WIDL) $(TARGETFLAGS) $(IDLFLAGS) -t -T $@ $< |
Huw Davies | 4046846 | 2005-01-28 14:13:08 +0000 | [diff] [blame] | 84 | |
Patrik Stridvall | a9be64e | 1999-07-31 17:39:44 +0000 | [diff] [blame] | 85 | .c.ln: |
| 86 | $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 ) |
| 87 | |
Alexandre Julliard | caa0338 | 2002-02-20 19:03:59 +0000 | [diff] [blame] | 88 | .c.ok: |
Alexandre Julliard | edeee89 | 2002-08-09 01:22:40 +0000 | [diff] [blame] | 89 | $(RUNTEST) $(RUNTESTFLAGS) $< && touch $@ |
Alexandre Julliard | caa0338 | 2002-02-20 19:03:59 +0000 | [diff] [blame] | 90 | |
Huw Davies | 00acb5f | 2004-08-17 22:33:14 +0000 | [diff] [blame] | 91 | .sfd.ttf: |
Alexandre Julliard | bd9852c | 2010-09-19 12:40:12 +0200 | [diff] [blame] | 92 | $(FONTFORGE) -script $(top_srcdir)/fonts/genttf.ff $< $@ |
Huw Davies | 00acb5f | 2004-08-17 22:33:14 +0000 | [diff] [blame] | 93 | |
Alexandre Julliard | 664e410 | 2005-10-06 16:06:04 +0000 | [diff] [blame] | 94 | .man.in.man: |
Alexandre Julliard | 1716f03 | 2007-12-12 14:39:54 +0100 | [diff] [blame] | 95 | LC_ALL=C sed -e 's,@bindir\@,$(bindir),g' -e 's,@dlldir\@,$(dlldir),g' -e 's,@PACKAGE_STRING\@,@PACKAGE_STRING@,g' $< >$@ || ($(RM) $@ && false) |
Alexandre Julliard | 664e410 | 2005-10-06 16:06:04 +0000 | [diff] [blame] | 96 | |
Alexandre Julliard | dc4a475 | 2008-03-20 16:09:18 +0100 | [diff] [blame] | 97 | .svg.ico: |
Joel Holdsworth | 465e653 | 2010-05-16 23:07:57 +0100 | [diff] [blame] | 98 | CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@ |
Alexandre Julliard | dc4a475 | 2008-03-20 16:09:18 +0100 | [diff] [blame] | 99 | |
Joel Holdsworth | 66bd5f7 | 2010-04-24 14:06:11 +0100 | [diff] [blame] | 100 | .svg.bmp: |
Joel Holdsworth | 465e653 | 2010-05-16 23:07:57 +0100 | [diff] [blame] | 101 | CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@ |
Joel Holdsworth | 66bd5f7 | 2010-04-24 14:06:11 +0100 | [diff] [blame] | 102 | |
Alexandre Julliard | b0585bf | 2007-12-10 14:26:13 +0100 | [diff] [blame] | 103 | # Rules for IDL files |
| 104 | |
| 105 | dlldata.c: $(WIDL) Makefile.in |
| 106 | $(WIDL) $(IDLFLAGS) --dlldata-only --dlldata=$@ $(IDL_P_SRCS) |
| 107 | |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 108 | # Rule for linting |
| 109 | |
Patrik Stridvall | a9be64e | 1999-07-31 17:39:44 +0000 | [diff] [blame] | 110 | $(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 | |
| 119 | lint:: $(MODULE).ln |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 120 | |
Patrik Stridvall | 385dc18 | 1999-09-29 10:24:19 +0000 | [diff] [blame] | 121 | # Rules for Windows API checking |
| 122 | |
Alexandre Julliard | f673b71 | 2002-06-14 23:48:27 +0000 | [diff] [blame] | 123 | winapi_check:: dummy |
Patrik Stridvall | 385dc18 | 1999-09-29 10:24:19 +0000 | [diff] [blame] | 124 | $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) . |
| 125 | |
Alexandre Julliard | f673b71 | 2002-06-14 23:48:27 +0000 | [diff] [blame] | 126 | .PHONY: winapi_check |
| 127 | |
Alexandre Julliard | c53ceba | 2000-04-09 18:19:59 +0000 | [diff] [blame] | 128 | # Rules for dependencies |
| 129 | |
Alexandre Julliard | c6ae9a3 | 2009-12-29 12:45:37 +0100 | [diff] [blame] | 130 | DEPEND_SRCS = $(C_SRCS) $(RC_SRCS) $(MC_SRCS) \ |
Alexandre Julliard | da19122 | 2008-04-24 22:13:57 +0200 | [diff] [blame] | 131 | $(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 Julliard | 9c085cb | 2006-09-09 13:16:22 +0200 | [diff] [blame] | 134 | |
Alexandre Julliard | 93f0339 | 2010-02-10 20:27:52 +0100 | [diff] [blame] | 135 | depend: dummy |
Alexandre Julliard | bd9852c | 2010-09-19 12:40:12 +0200 | [diff] [blame] | 136 | $(MAKEDEP) $(MAKEDEPFLAGS) -C$(srcdir) -S$(top_srcdir) -T$(top_builddir) $(EXTRAINCL) $(DEPEND_SRCS) |
Alexandre Julliard | c53ceba | 2000-04-09 18:19:59 +0000 | [diff] [blame] | 137 | |
Alexandre Julliard | 93f0339 | 2010-02-10 20:27:52 +0100 | [diff] [blame] | 138 | .PHONY: depend |
Alexandre Julliard | f673b71 | 2002-06-14 23:48:27 +0000 | [diff] [blame] | 139 | |
Alexandre Julliard | c53ceba | 2000-04-09 18:19:59 +0000 | [diff] [blame] | 140 | # Rules for cleaning |
| 141 | |
Alexandre Julliard | c53ceba | 2000-04-09 18:19:59 +0000 | [diff] [blame] | 142 | $(EXTRASUBDIRS:%=%/__clean__): dummy |
| 143 | -cd `dirname $@` && $(RM) $(CLEAN_FILES) |
| 144 | |
Alexandre Julliard | 93f0339 | 2010-02-10 20:27:52 +0100 | [diff] [blame] | 145 | clean:: $(EXTRASUBDIRS:%=%/__clean__) |
Alexandre Julliard | b64ceef | 2007-09-18 13:29:07 +0200 | [diff] [blame] | 146 | $(RM) $(CLEAN_FILES) $(CLEAN_TARGETS) $(PROGRAMS) $(MANPAGES) |
Alexandre Julliard | c53ceba | 2000-04-09 18:19:59 +0000 | [diff] [blame] | 147 | |
Alexandre Julliard | 93f0339 | 2010-02-10 20:27:52 +0100 | [diff] [blame] | 148 | .PHONY: clean $(EXTRASUBDIRS:%=%/__clean__) |
Alexandre Julliard | f673b71 | 2002-06-14 23:48:27 +0000 | [diff] [blame] | 149 | |
Alexandre Julliard | 2f158c2 | 2000-06-14 21:45:38 +0000 | [diff] [blame] | 150 | # Rules for installing |
| 151 | |
Alexandre Julliard | 2886e9b | 2006-08-07 17:48:18 +0200 | [diff] [blame] | 152 | $(INSTALLDIRS): |
| 153 | $(MKINSTALLDIRS) $@ |
| 154 | |
Alexandre Julliard | 93f0339 | 2010-02-10 20:27:52 +0100 | [diff] [blame] | 155 | install install-lib install-dev uninstall:: |
Alexandre Julliard | f673b71 | 2002-06-14 23:48:27 +0000 | [diff] [blame] | 156 | |
Alexandre Julliard | 93f0339 | 2010-02-10 20:27:52 +0100 | [diff] [blame] | 157 | .PHONY: install install-lib install-dev uninstall |
Alexandre Julliard | f673b71 | 2002-06-14 23:48:27 +0000 | [diff] [blame] | 158 | |
Alexandre Julliard | d7d4fdf | 1995-12-26 15:05:24 +0000 | [diff] [blame] | 159 | # Misc. rules |
| 160 | |
Alexandre Julliard | 017a61e | 2000-11-06 05:30:48 +0000 | [diff] [blame] | 161 | $(MC_SRCS:.mc=.mc.rc): $(WMC) |
Alexandre Julliard | f5aee67 | 2000-07-25 17:52:08 +0000 | [diff] [blame] | 162 | |
Alexandre Julliard | 1df72cc | 2007-02-09 14:32:36 +0100 | [diff] [blame] | 163 | $(IDL_GEN_HEADERS) $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS:.idl=.tlb): $(WIDL) |
Vincent Béron | 860c84b | 2005-02-08 12:13:10 +0000 | [diff] [blame] | 164 | |
Alexandre Julliard | c6ae9a3 | 2009-12-29 12:45:37 +0100 | [diff] [blame] | 165 | $(RC_SRCS:.rc=.res) $(MC_SRCS:.mc=.mc.res): $(WRC) |
Alexandre Julliard | da19122 | 2008-04-24 22:13:57 +0200 | [diff] [blame] | 166 | |
Alexandre Julliard | ff8331e | 1995-09-18 11:19:54 +0000 | [diff] [blame] | 167 | dummy: |
Alexandre Julliard | d7d4fdf | 1995-12-26 15:05:24 +0000 | [diff] [blame] | 168 | |
Alexandre Julliard | 93f0339 | 2010-02-10 20:27:52 +0100 | [diff] [blame] | 169 | .PHONY: dummy |
Alexandre Julliard | f673b71 | 2002-06-14 23:48:27 +0000 | [diff] [blame] | 170 | |
Alexandre Julliard | d7d4fdf | 1995-12-26 15:05:24 +0000 | [diff] [blame] | 171 | # End of global rules |