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 $(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) $(MC_SRCS:.mc=.mc.rc)
31 OBJS = $(C_SRCS:.c=.o) $(BISON_SRCS:.y=.tab.o) $(LEX_SRCS:.l=.yy.o) $(IDL_GEN_C_SRCS:.c=.o) \
32 $(IDL_R_SRCS:.idl=_r.res) $(RC_SRCS:.rc=.res) $(MC_SRCS:.mc=.mc.res) $(EXTRA_OBJS)
34 CROSSOBJS = $(OBJS:.o=.cross.o)
35 LINTS = $(C_SRCS:.c=.ln)
38 @$(top_srcdir)/tools/winapi/make_filter --make $(MAKE) all
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 _r.res .cross.o @MAINTAINER_MODE@ .sfd .ttf .svg .ico .bmp
47 $(CC) -c $(ALLCFLAGS) -o $@ $<
50 $(CROSSCC) -c $(INCLUDES) $(DEFS) -DWINE_CROSSTEST $(CPPFLAGS) $(CFLAGS) -o $@ $<
53 $(BISON) $(BISONFLAGS) -p $*_ -o $@ $<
56 $(BISON) $(BISONFLAGS) -p $*_ -o $*.tab.c -d $<
59 $(FLEX) $(LEXFLAGS) -o$@ $<
62 $(LDPATH) $(WMC) -i -U -H /dev/null -o $@ $<
65 $(LDPATH) $(WRC) $(RCFLAGS) -o $@ $<
68 $(WIDL) $(IDLFLAGS) -h -o $@ $<
71 $(WIDL) $(IDLFLAGS) -c -o $@ $<
74 $(WIDL) $(IDLFLAGS) -u -o $@ $<
77 $(WIDL) $(IDLFLAGS) -p -o $@ $<
80 $(WIDL) $(IDLFLAGS) -r -o $@ $<
83 $(WIDL) $(IDLFLAGS) -s -o $@ $<
86 $(WIDL) $(TARGETFLAGS) $(IDLFLAGS) -t -o $@ $<
89 $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
92 $(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
95 $(FONTFORGE) -script $(top_srcdir)/fonts/genttf.ff $< $@
98 LC_ALL=C sed -e 's,@bindir\@,$(bindir),g' -e 's,@dlldir\@,$(dlldir),g' -e 's,@PACKAGE_STRING\@,@PACKAGE_STRING@,g' $< >$@ || ($(RM) $@ && false)
101 CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
104 CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
106 # Rules for IDL files
108 dlldata.c: $(WIDL) Makefile.in
109 $(WIDL) $(IDLFLAGS) --dlldata-only -o $@ $(IDL_P_SRCS)
113 $(MODULE).ln : $(LINTS)
114 if test "$(LINTS)" ; \
116 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
117 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
119 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
124 # Rules for Windows API checking
127 $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
131 # Rules for dependencies
133 DEPEND_SRCS = $(C_SRCS) $(RC_SRCS) $(MC_SRCS) \
134 $(IDL_H_SRCS) $(IDL_C_SRCS) $(IDL_I_SRCS) $(IDL_P_SRCS) $(IDL_S_SRCS) \
135 $(IDL_GEN_C_SRCS) $(IDL_R_SRCS:.idl=_r.res) $(IDL_TLB_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) \
136 $(BISON_SRCS) $(LEX_SRCS) $(EXTRA_SRCS)
139 $(MAKEDEP) $(MAKEDEPFLAGS) -C$(srcdir) -S$(top_srcdir) -T$(top_builddir) $(EXTRAINCL) $(DEPEND_SRCS)
145 $(EXTRASUBDIRS:%=%/__clean__): dummy
146 -cd `dirname $@` && $(RM) $(CLEAN_FILES)
148 clean:: $(EXTRASUBDIRS:%=%/__clean__)
149 $(RM) $(CLEAN_FILES) $(CLEAN_TARGETS) $(PROGRAMS) $(MANPAGES)
151 .PHONY: clean $(EXTRASUBDIRS:%=%/__clean__)
153 # Rules for installing
158 install install-lib install-dev uninstall::
160 .PHONY: install install-lib install-dev uninstall
164 $(MC_SRCS:.mc=.mc.rc): $(WMC)
166 $(IDL_GEN_HEADERS) $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) $(IDL_R_SRCS:.idl=_r.res): $(WIDL)
168 $(RC_SRCS:.rc=.res) $(MC_SRCS:.mc=.mc.res): $(WRC)
174 # End of global rules