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 $(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 $(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 .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) -fo$@ $<
68 $(WIDL) $(IDLFLAGS) -h -H $@ $<
71 $(WIDL) $(IDLFLAGS) -c -C $@ $<
74 $(WIDL) $(IDLFLAGS) -u -U $@ $<
77 $(WIDL) $(IDLFLAGS) -p -P $@ $<
80 $(WIDL) $(IDLFLAGS) -s -S $@ $<
83 $(WIDL) $(TARGETFLAGS) $(IDLFLAGS) -t -T $@ $<
86 $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
89 $(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
92 $(FONTFORGE) -script $(top_srcdir)/fonts/genttf.ff $< $@
95 LC_ALL=C sed -e 's,@bindir\@,$(bindir),g' -e 's,@dlldir\@,$(dlldir),g' -e 's,@PACKAGE_STRING\@,@PACKAGE_STRING@,g' $< >$@ || ($(RM) $@ && false)
98 CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
101 CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
103 # Rules for IDL files
105 dlldata.c: $(WIDL) Makefile.in
106 $(WIDL) $(IDLFLAGS) --dlldata-only --dlldata=$@ $(IDL_P_SRCS)
110 $(MODULE).ln : $(LINTS)
111 if test "$(LINTS)" ; \
113 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
114 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
116 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
121 # Rules for Windows API checking
124 $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
128 # Rules for dependencies
130 DEPEND_SRCS = $(C_SRCS) $(RC_SRCS) $(MC_SRCS) \
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)
136 $(MAKEDEP) $(MAKEDEPFLAGS) -C$(srcdir) -S$(top_srcdir) -T$(top_builddir) $(EXTRAINCL) $(DEPEND_SRCS)
142 $(EXTRASUBDIRS:%=%/__clean__): dummy
143 -cd `dirname $@` && $(RM) $(CLEAN_FILES)
145 clean:: $(EXTRASUBDIRS:%=%/__clean__)
146 $(RM) $(CLEAN_FILES) $(CLEAN_TARGETS) $(PROGRAMS) $(MANPAGES)
148 .PHONY: clean $(EXTRASUBDIRS:%=%/__clean__)
150 # Rules for installing
155 install install-lib install-dev uninstall::
157 .PHONY: install install-lib install-dev uninstall
161 $(MC_SRCS:.mc=.mc.rc): $(WMC)
163 $(IDL_GEN_HEADERS) $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS:.idl=.tlb): $(WIDL)
165 $(RC_SRCS:.rc=.res) $(MC_SRCS:.mc=.mc.res): $(WRC)
171 # End of global rules