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 # RC_SRCS : resource source files
6 # EXTRA_SRCS : extra source files for make depend
7 # EXTRA_OBJS : extra object files
8 # IMPORTS : dlls to import
9 # DELAYIMPORTS : dlls to import in delayed mode
10 # EXTRASUBDIRS : subdirectories that do not contain a Makefile
11 # MODCFLAGS : extra CFLAGS for this module
13 # 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 --po-dir=$(top_srcdir)/po $(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 *.ln *.res *.fake *.$(LIBEXT) \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej *.flc 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) \
33 $(IDL_R_SRCS:.idl=_r.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 .cross.o @MAINTAINER_MODE@ .sfd .ttf .svg .ico .bmp
48 $(CC) -c $(ALLCFLAGS) -o $@ $<
51 $(CROSSCC) -c $(INCLUDES) $(DEFS) -DWINE_CROSSTEST $(CPPFLAGS) $(CFLAGS) -o $@ $<
54 $(BISON) $(BISONFLAGS) -p $*_ -o $@ $<
57 $(BISON) $(BISONFLAGS) -p $*_ -o $*.tab.c -d $<
60 $(FLEX) $(LEXFLAGS) -o$@ $<
63 $(LDPATH) $(WMC) -U -O res -P $(top_srcdir)/po -o $@ $<
66 $(LDPATH) $(WRC) $(RCFLAGS) -o $@ $<
69 $(WIDL) $(IDLFLAGS) -h -o $@ $<
72 $(WIDL) $(IDLFLAGS) -c -o $@ $<
75 $(WIDL) $(IDLFLAGS) -u -o $@ $<
78 $(WIDL) $(IDLFLAGS) -p -o $@ $<
81 $(WIDL) $(IDLFLAGS) -r -o $@ $<
84 $(WIDL) $(IDLFLAGS) -s -o $@ $<
87 $(WIDL) $(TARGETFLAGS) $(IDLFLAGS) -t -o $@ $<
90 $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
93 $(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
96 $(FONTFORGE) -script $(top_srcdir)/fonts/genttf.ff $< $@
99 LC_ALL=C sed -e 's,@bindir\@,$(bindir),g' -e 's,@dlldir\@,$(dlldir),g' -e 's,@PACKAGE_STRING\@,@PACKAGE_STRING@,g' $< >$@ || ($(RM) $@ && false)
102 CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
105 CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
107 # Rules for IDL files
109 dlldata.c: $(WIDL) Makefile.in
110 $(WIDL) $(IDLFLAGS) --dlldata-only -o $@ $(IDL_P_SRCS)
114 $(MODULE).ln : $(LINTS)
115 if test "$(LINTS)" ; \
117 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
118 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
120 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
125 # Rules for Windows API checking
128 $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
132 # Rules for dependencies
134 DEPEND_SRCS = $(C_SRCS) $(RC_SRCS) $(MC_SRCS) \
135 $(IDL_H_SRCS) $(IDL_C_SRCS) $(IDL_I_SRCS) $(IDL_P_SRCS) $(IDL_S_SRCS) \
136 $(IDL_GEN_C_SRCS) $(IDL_R_SRCS:.idl=_r.res) $(IDL_TLB_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) \
137 $(BISON_SRCS) $(LEX_SRCS) $(EXTRA_SRCS)
140 $(MAKEDEP) $(MAKEDEPFLAGS) -C$(srcdir) -S$(top_srcdir) -T$(top_builddir) $(EXTRAINCL) $(DEPEND_SRCS)
144 # Rules for man pages
146 MANPAGES = $(MANPAGE) $(EXTRA_MANPAGES)
150 install-man-pages:: $(MANPAGE) $(DESTDIR)$(mandir)/man$(prog_manext)
151 $(INSTALL_DATA) $(MANPAGE) $(DESTDIR)$(mandir)/man$(prog_manext)/$(MANPAGE:.man=).$(prog_manext)
153 uninstall-man-pages::
154 $(RM) $(DESTDIR)$(mandir)/man$(prog_manext)/$(MANPAGE:.man=).$(prog_manext)
156 install:: @WOW64_DISABLE@ $(MANPAGE:%=install-man-pages)
157 uninstall:: @WOW64_DISABLE@ $(MANPAGE:%=uninstall-man-pages)
161 $(EXTRASUBDIRS:%=%/__clean__): dummy
162 -cd `dirname $@` && $(RM) $(CLEAN_FILES)
164 clean:: $(EXTRASUBDIRS:%=%/__clean__)
165 $(RM) $(CLEAN_FILES) $(CLEAN_TARGETS) $(PROGRAMS) $(MANPAGES)
167 .PHONY: clean $(EXTRASUBDIRS:%=%/__clean__)
169 # Rules for installing
174 install install-lib install-dev uninstall::
176 .PHONY: install install-lib install-dev uninstall
178 # Rules for resources
180 all: @MAINTAINER_MODE@ $(PO_SRCS:%=rsrc.pot) $(MC_SRCS:%=msg.pot)
183 $(LDPATH) $(WRC) $(RCFLAGS) -O pot -o $@ $(PO_SRCS)
186 $(LDPATH) $(WMC) -O pot -o $@ $(MC_SRCS)
188 $(MC_SRCS:.mc=.res): $(WMC) $(ALL_PO_FILES)
189 $(RC_SRCS:.rc=.res): $(WRC)
190 $(PO_SRCS:.rc=.res): $(ALL_PO_FILES)
194 $(IDL_GEN_HEADERS) $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) $(IDL_R_SRCS:.idl=_r.res): $(WIDL)
200 # End of global rules