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 *.tab.[ch] *.yy.c
28 CLEAN_TARGETS = $(IDL_GEN_C_SRCS) $(IDL_GEN_HEADERS) \
29 $(IDL_TLB_SRCS:.idl=.tlb) $(IDL_P_SRCS:.idl=_p.c dlldata.c) \
30 $(PO_SRCS:.rc=.res rsrc.pot) $(MC_SRCS:.mc=.res 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)
39 @$(top_srcdir)/tools/winapi/make_filter --make $(MAKE) all
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
48 $(CC) -c $(ALLCFLAGS) -o $@ $<
51 $(CC) -c $(ALLCFLAGS) -o $@ $<
54 $(CROSSCC) -c $(INCLUDES) $(DEFS) -DWINE_CROSSTEST $(CPPFLAGS) $(CFLAGS) -o $@ $<
57 $(BISON) $(BISONFLAGS) -p $*_ -o $@ $<
60 $(BISON) $(BISONFLAGS) -p $*_ -o $*.tab.c -d $<
63 $(FLEX) $(LEXFLAGS) -o$@ $<
66 $(LDPATH) $(WMC) -U -O res -P $(top_srcdir)/po -o $@ $<
69 $(LDPATH) $(WRC) $(RCFLAGS) -o $@ $<
72 $(WIDL) $(IDLFLAGS) -h -o $@ $<
75 $(WIDL) $(IDLFLAGS) -c -o $@ $<
78 $(WIDL) $(IDLFLAGS) -u -o $@ $<
81 $(WIDL) $(IDLFLAGS) -p -o $@ $<
84 $(WIDL) $(IDLFLAGS) -r -o $@ $<
87 $(WIDL) $(IDLFLAGS) -s -o $@ $<
90 $(WIDL) $(TARGETFLAGS) $(IDLFLAGS) -t -o $@ $<
93 $(WIDL) $(TARGETFLAGS) $(IDLFLAGS) -t -o $@ $<
96 $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
99 $(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
102 $(FONTFORGE) -script $(top_srcdir)/fonts/genttf.ff $< $@
105 LC_ALL=C sed -e 's,@bindir\@,$(bindir),g' -e 's,@dlldir\@,$(dlldir),g' -e 's,@PACKAGE_STRING\@,@PACKAGE_STRING@,g' $< >$@ || ($(RM) $@ && false)
108 CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
111 CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
116 # Rules for IDL files
118 dlldata.c: $(WIDL) Makefile.in
119 $(WIDL) $(IDLFLAGS) --dlldata-only -o $@ $(IDL_P_SRCS)
123 $(MODULE).ln : $(LINTS)
124 if test "$(LINTS)" ; \
126 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
127 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
129 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
134 # Rules for Windows API checking
137 $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
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)
149 $(MAKEDEP) $(MAKEDEPFLAGS) -C$(srcdir) -S$(top_srcdir) -T$(top_builddir) $(EXTRAINCL) $(DEPEND_SRCS)
153 # Rules for man pages
155 MANPAGES = $(MANPAGE) $(EXTRA_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:.man=.man.in install-man-pages)
166 uninstall:: @WOW64_DISABLE@ $(MANPAGE:.man=.man.in uninstall-man-pages)
168 .PHONY: install-man-pages uninstall-man-pages
172 $(EXTRASUBDIRS:%=%/__clean__): dummy
173 -cd `dirname $@` && $(RM) $(CLEAN_FILES)
175 clean:: $(EXTRASUBDIRS:%=%/__clean__)
176 $(RM) $(CLEAN_FILES) $(CLEAN_TARGETS) $(PROGRAMS) $(MANPAGES)
178 .PHONY: clean $(EXTRASUBDIRS:%=%/__clean__)
180 # Rules for installing
185 install install-lib install-dev uninstall::
187 .PHONY: install install-lib install-dev uninstall
189 # Rules for resources
192 $(LDPATH) $(WRC) $(RCFLAGS) -O pot -o $@ $(PO_SRCS)
195 $(LDPATH) $(WMC) -O pot -o $@ $(MC_SRCS)
197 $(MC_SRCS:.mc=.res): $(WMC) $(ALL_MO_FILES)
198 $(RC_SRCS:.rc=.res): $(WRC)
199 $(PO_SRCS:.rc=.res): $(ALL_MO_FILES)
203 $(IDL_GEN_HEADERS) $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) $(IDL_TLB_RES) $(IDL_R_SRCS:.idl=_r.res): $(WIDL)
209 # End of global rules