Release 1.6-rc1.
[wine/multimedia.git] / Make.rules.in
blob3bc86da976ee3b455deec8cf36fa05471e249c0a
1 # Global rules shared by all makefiles     -*-Makefile-*-
3 # Each individual makefile may define the following variables:
4 # C_SRCS       : C sources for the module
5 # OBJC_SRCS    : Objective-C sources for the module
6 # RC_SRCS      : resource source files
7 # EXTRA_SRCS   : extra source files for make depend
8 # EXTRA_OBJS   : extra object files
9 # IMPORTS      : dlls to import
10 # DELAYIMPORTS : dlls to import in delayed mode
11 # EXTRASUBDIRS : subdirectories that do not contain a Makefile
12 # MODCFLAGS    : extra CFLAGS for this module
14 # First some useful definitions
16 INCLUDES     = -I$(srcdir) -I. -I$(top_srcdir)/include -I$(top_builddir)/include $(EXTRAINCL)
17 ALLCFLAGS    = $(INCLUDES) $(DEFS) $(DLLFLAGS) $(EXTRACFLAGS) $(CPPFLAGS) $(CFLAGS) $(MODCFLAGS)
18 ALLLINTFLAGS = $(INCLUDES) $(DEFS) $(LINTFLAGS)
19 IDLFLAGS     = $(INCLUDES) $(DEFS) $(EXTRAIDLFLAGS)
20 RCFLAGS      = --nostdinc $(PORCFLAGS) $(TARGETFLAGS) $(INCLUDES) $(DEFS) $(EXTRARCFLAGS)
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)
27 CLEAN_FILES   = *.o *.a *.so *.mo *.ln *.res *.fake core
28 CLEAN_TARGETS = $(IDL_GEN_C_SRCS) $(IDL_GEN_HEADERS) $(IDL_TLB_SRCS:.idl=.tlb) $(IDL_P_SRCS:%=dlldata.c) \
29                 $(BISON_SRCS:.y=.tab.c) $(BISON_SRCS:.y=.tab.h) $(LEX_SRCS:.l=.yy.c) \
30                 $(PO_SRCS:%=rsrc.pot) $(MC_SRCS:%=msg.pot) $(XTEMPLATE_SRCS:.x=.h)
32 OBJS = $(C_SRCS:.c=.o) $(BISON_SRCS:.y=.tab.o) $(LEX_SRCS:.l=.yy.o) $(IDL_GEN_C_SRCS:.c=.o) $(OBJC_SRCS:.m=.o) \
33        $(IDL_R_SRCS:.idl=_r.res) $(IDL_TLB_RES) $(RC_SRCS:.rc=.res) $(MC_SRCS:.mc=.res) $(EXTRA_OBJS)
35 CROSSOBJS = $(OBJS:.o=.cross.o)
36 LINTS  = $(C_SRCS:.c=.ln)
38 filter: dummy
39         @$(top_srcdir)/tools/winapi/make_filter --make $(MAKE) all
41 .PHONY: all filter
43 # Implicit rules
45 .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
47 .c.o:
48         $(CC) -c $(ALLCFLAGS) -o $@ $<
50 .m.o:
51         $(CC) -c $(ALLCFLAGS) -o $@ $<
53 .c.cross.o:
54         $(CROSSCC) -c $(INCLUDES) $(DEFS) -DWINE_CROSSTEST $(CPPFLAGS) $(CFLAGS) -o $@ $<
56 .y.tab.c:
57         $(BISON) $(BISONFLAGS) -p $*_ -o $@ $<
59 .y.tab.h:
60         $(BISON) $(BISONFLAGS) -p $*_ -o $*.tab.c -d $<
62 .l.yy.c:
63         $(FLEX) $(LEXFLAGS) -o$@ $<
65 .mc.res:
66         $(LDPATH) $(WMC) -U -O res -P $(top_srcdir)/po -o $@ $<
68 .rc.res:
69         $(LDPATH) $(WRC) $(RCFLAGS) -o $@ $<
71 .idl.h:
72         $(WIDL) $(IDLFLAGS) -h -o $@ $<
74 .idl_c.c:
75         $(WIDL) $(IDLFLAGS) -c -o $@ $<
77 .idl_i.c:
78         $(WIDL) $(IDLFLAGS) -u -o $@ $<
80 .idl_p.c:
81         $(WIDL) $(IDLFLAGS) -p -o $@ $<
83 .idl_r.res:
84         $(WIDL) $(IDLFLAGS) -r -o $@ $<
86 .idl_s.c:
87         $(WIDL) $(IDLFLAGS) -s -o $@ $<
89 .idl.tlb:
90         $(WIDL) $(TARGETFLAGS) $(IDLFLAGS) -t -o $@ $<
92 .idl_t.res:
93         $(WIDL) $(TARGETFLAGS) $(IDLFLAGS) -t -o $@ $<
95 .c.ln:
96         $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
98 .c.ok:
99         $(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
101 .sfd.ttf:
102         $(FONTFORGE) -script $(top_srcdir)/fonts/genttf.ff $< $@
104 .man.in.man:
105         LC_ALL=C sed -e 's,@bindir\@,$(bindir),g' -e 's,@dlldir\@,$(dlldir),g' -e 's,@PACKAGE_STRING\@,@PACKAGE_STRING@,g' $< >$@ || ($(RM) $@ && false)
107 .svg.ico:
108         CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
110 .svg.bmp:
111         CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
113 .po.mo:
114         $(MSGFMT) -o $@ $<
116 # Rules for IDL files
118 dlldata.c: $(WIDL) Makefile.in
119         $(WIDL) $(IDLFLAGS) --dlldata-only -o $@ $(IDL_P_SRCS)
121 # Rule for linting
123 $(MODULE).ln : $(LINTS)
124         if test "$(LINTS)" ; \
125         then \
126                 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
127                 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
128         else \
129                 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
130         fi
132 lint:: $(MODULE).ln
134 # Rules for Windows API checking
136 winapi_check:: dummy
137         $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
139 .PHONY: winapi_check
141 # Rules for dependencies
143 DEPEND_SRCS = $(C_SRCS) $(OBJC_SRCS) $(RC_SRCS) $(MC_SRCS) \
144               $(IDL_H_SRCS) $(IDL_C_SRCS) $(IDL_I_SRCS) $(IDL_P_SRCS) $(IDL_S_SRCS) \
145               $(IDL_GEN_C_SRCS) $(IDL_R_SRCS:.idl=_r.res) $(IDL_TLB_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) \
146               $(BISON_SRCS) $(LEX_SRCS) $(EXTRA_SRCS)
148 depend: dummy
149         $(MAKEDEP) $(MAKEDEPFLAGS) -C$(srcdir) -S$(top_srcdir) -T$(top_builddir) $(EXTRAINCL) $(DEPEND_SRCS)
151 .PHONY: depend
153 # Rules for man pages
155 MANPAGES = $(MANPAGE) $(EXTRA_MANPAGES)
157 all: $(MANPAGES)
159 install-man-pages:: $(MANPAGE) $(DESTDIR)$(mandir)/man$(prog_manext)
160         $(INSTALL_DATA) $(MANPAGE) $(DESTDIR)$(mandir)/man$(prog_manext)/$(MANPAGE:.man=).$(prog_manext)
162 uninstall-man-pages::
163         $(RM) $(DESTDIR)$(mandir)/man$(prog_manext)/$(MANPAGE:.man=).$(prog_manext)
165 install:: @WOW64_DISABLE@ $(MANPAGE:%=install-man-pages)
166 uninstall:: @WOW64_DISABLE@ $(MANPAGE:%=uninstall-man-pages)
168 # Rules for cleaning
170 $(EXTRASUBDIRS:%=%/__clean__): dummy
171         -cd `dirname $@` && $(RM) $(CLEAN_FILES)
173 clean:: $(EXTRASUBDIRS:%=%/__clean__)
174         $(RM) $(CLEAN_FILES) $(CLEAN_TARGETS) $(PROGRAMS) $(MANPAGES)
176 .PHONY: clean $(EXTRASUBDIRS:%=%/__clean__)
178 # Rules for installing
180 $(INSTALLDIRS):
181         $(MKINSTALLDIRS) $@
183 install install-lib install-dev uninstall::
185 .PHONY: install install-lib install-dev uninstall
187 # Rules for resources
189 rsrc.pot: $(WRC)
190         $(LDPATH) $(WRC) $(RCFLAGS) -O pot -o $@ $(PO_SRCS)
192 msg.pot: $(WMC)
193         $(LDPATH) $(WMC) -O pot -o $@ $(MC_SRCS)
195 $(MC_SRCS:.mc=.res): $(WMC) $(ALL_MO_FILES)
196 $(RC_SRCS:.rc=.res): $(WRC)
197 $(PO_SRCS:.rc=.res): $(ALL_MO_FILES)
199 # Misc. rules
201 $(IDL_GEN_HEADERS) $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) $(IDL_TLB_RES) $(IDL_R_SRCS:.idl=_r.res): $(WIDL)
203 dummy:
205 .PHONY: dummy
207 # End of global rules