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 DEFS = -D__WINESRC__ $(EXTRADEFS)
18 ALLCFLAGS = $(INCLUDES) $(DEFS) $(DLLFLAGS) $(EXTRACFLAGS) $(CPPFLAGS) $(CFLAGS) $(MODCFLAGS)
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 *.res *.fake *.ok *.tab.[ch] *.yy.c
28 CLEAN_TARGETS = $(MODULE) $(IMPORTLIB:%=lib%.@IMPLIBEXT@) $(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) \
31 $(TESTMODULE:%=% testlist.c) $(CROSSTESTMODULE)
33 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) \
34 $(IDL_R_SRCS:.idl=_r.res) $(IDL_TLB_RES) $(RC_SRCS:.rc=.res) $(MC_SRCS:.mc=.res) $(EXTRA_OBJS)
36 CROSSOBJS = $(OBJS:.o=.cross.o)
40 .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
43 $(CC) -c $(ALLCFLAGS) -o $@ $<
46 $(CC) -c $(ALLCFLAGS) -o $@ $<
49 $(CROSSCC) -c $(INCLUDES) $(DEFS) -DWINE_CROSSTEST $(CPPFLAGS) $(CFLAGS) -o $@ $<
52 $(BISON) $(BISONFLAGS) -p $*_ -o $@ $<
55 $(BISON) $(BISONFLAGS) -p $*_ -o $*.tab.c -d $<
58 $(FLEX) $(LEXFLAGS) -o$@ $<
61 $(WMC) -U -O res $(PORCFLAGS) -o $@ $<
64 $(WRC) $(RCFLAGS) -o $@ $<
67 $(WIDL) $(IDLFLAGS) -h -o $@ $<
70 $(WIDL) $(IDLFLAGS) -c -o $@ $<
73 $(WIDL) $(IDLFLAGS) -u -o $@ $<
76 $(WIDL) $(IDLFLAGS) -p -o $@ $<
79 $(WIDL) $(IDLFLAGS) -r -o $@ $<
82 $(WIDL) $(IDLFLAGS) -s -o $@ $<
85 $(WIDL) $(TARGETFLAGS) $(IDLFLAGS) -t -o $@ $<
88 $(WIDL) $(TARGETFLAGS) $(IDLFLAGS) -t -o $@ $<
91 $(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
94 $(FONTFORGE) -script $(top_srcdir)/fonts/genttf.ff $< $@
97 LC_ALL=C sed -e 's,@bindir\@,$(bindir),g' -e 's,@dlldir\@,$(dlldir),g' -e 's,@PACKAGE_STRING\@,@PACKAGE_STRING@,g' $< >$@ || ($(RM) $@ && false)
100 CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
103 CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
108 # Rules for IDL files
110 dlldata.c: $(WIDL) Makefile.in
111 $(WIDL) $(IDLFLAGS) --dlldata-only -o $@ $(IDL_P_SRCS)
113 # Rules for main module
115 $(MODULE) $(MODULE:%=%.so) $(MODULE:%=%.fake): $(MAINSPEC) $(OBJS) Makefile.in
116 $(WINEGCC) $(APPMODE) $(MODULEFLAGS) $(OBJS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(DELAYIMPORTS:%=-Wb,-d%) -lwine $(LIBPORT) $(EXTRALIBS) $(LDFLAGS) $(LIBS)
118 # Rules for static libraries
122 $(STATICLIB): $(OBJS) Makefile.in
124 $(AR) $(ARFLAGS) $@ $(OBJS)
127 $(STATICLIB:.a=.cross.a): $(CROSSOBJS) Makefile.in
129 $(CROSSAR) $(ARFLAGS) $@ $(CROSSOBJS)
132 # Rules for import libraries
134 $(IMPORTLIB:%=lib%.def.a): $(IMPLIB_SRCS:.c=.o)
136 $(AR) $(ARFLAGS) $@ $(IMPLIB_SRCS:.c=.o)
139 $(IMPORTLIB:%=lib%.a): $(MAINSPEC) $(IMPLIB_SRCS:.c=.o)
140 $(WINEBUILD) $(TARGETFLAGS) -w --implib -o $@ --export $(srcdir)/$(MAINSPEC) $(IMPLIB_SRCS:.c=.o)
142 $(IMPORTLIB:%=lib%.cross.a): $(MAINSPEC) $(IMPLIB_SRCS:.c=.cross.o)
143 $(WINEBUILD) $(CROSSTARGET:%=-b %) -w --implib -o $@ --export $(srcdir)/$(MAINSPEC) $(IMPLIB_SRCS:.c=.cross.o)
145 # Rules for dependencies
147 DEPEND_SRCS = $(C_SRCS) $(OBJC_SRCS) $(RC_SRCS) $(MC_SRCS) \
148 $(IDL_H_SRCS) $(IDL_C_SRCS) $(IDL_I_SRCS) $(IDL_P_SRCS) $(IDL_S_SRCS) \
149 $(IDL_GEN_C_SRCS) $(IDL_R_SRCS:.idl=_r.res) $(IDL_TLB_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) \
150 $(BISON_SRCS) $(LEX_SRCS) $(EXTRA_SRCS)
153 $(MAKEDEP) $(MAKEDEPFLAGS) -C$(srcdir) -S$(top_srcdir) -T$(top_builddir) $(EXTRAINCL) $(DEPEND_SRCS)
159 $(TESTMODULE) $(TESTMODULE:%=%.so): $(OBJS) Makefile.in
160 $(WINEGCC) $(APPMODE) $(OBJS) -o $@ $(IMPORTS:%=-l%) $(LDFLAGS) $(LIBS)
162 $(TESTMODULE_STRIPPED): $(OBJS) Makefile.in
163 $(WINEGCC) -s -Wb,-F,$(TESTMODULE) $(APPMODE) $(OBJS) -o $@ $(IMPORTS:%=-l%) $(LDFLAGS) $(LIBS)
165 $(CROSSTESTMODULE): $(CROSSOBJS) Makefile.in
166 $(CROSSWINEGCC) $(CROSSOBJS) -o $@ $(IMPORTS:%=-l%) $(LDFLAGS) $(LIBS)
168 $(WINETEST_RES): $(TESTMODULE_STRIPPED)
169 echo "$(TESTMODULE) TESTRES \"$(TESTMODULE_STRIPPED)\"" | $(WRC) $(RCFLAGS) -o $@
171 testlist.c: Makefile.in $(MAKECTESTS)
172 $(MAKECTESTS) -o $@ $(C_SRCS)
174 testlist.o testlist.cross.o: testlist.c $(top_srcdir)/include/wine/test.h
179 .PHONY: check test testclean
181 # Rules for man pages
183 MANPAGES = $(MANPAGE) $(EXTRA_MANPAGES)
187 install-man-pages:: $(MANPAGE) $(DESTDIR)$(mandir)/man$(prog_manext)
188 $(INSTALL_DATA) $(MANPAGE) $(DESTDIR)$(mandir)/man$(prog_manext)/$(MANPAGE:.man=).$(prog_manext)
190 uninstall-man-pages::
191 $(RM) $(DESTDIR)$(mandir)/man$(prog_manext)/$(MANPAGE:.man=).$(prog_manext)
193 .PHONY: install-man-pages uninstall-man-pages
195 # Rules for auto documentation
197 manpages:: $(C_SRCS) dummy
198 $(C2MAN) -o $(top_builddir)/documentation/man$(api_manext) -R$(top_builddir) -C$(srcdir) $(INCLUDES) -S$(api_manext) $(MAINSPEC:%=-w %) $(C_SRCS)
200 htmlpages:: $(C_SRCS) dummy
201 $(C2MAN) -o $(top_builddir)/documentation/html -R$(top_builddir) -C$(srcdir) $(INCLUDES) -Th $(MAINSPEC:%=-w %) $(C_SRCS)
203 sgmlpages:: $(C_SRCS) dummy
204 $(C2MAN) -o $(top_builddir)/documentation/api-guide -R$(top_builddir) -C$(srcdir) $(INCLUDES) -Ts $(MAINSPEC:%=-w %) $(C_SRCS)
206 xmlpages:: $(C_SRCS) dummy
207 $(C2MAN) -o $(top_builddir)/documentation/api-guide-xml -R$(top_builddir) -C$(srcdir) $(INCLUDES) -Tx $(MAINSPEC:%=-w %) $(C_SRCS)
211 $(EXTRASUBDIRS:%=%/clean): dummy
212 -cd `dirname $@` && $(RM) $(CLEAN_FILES)
214 clean:: $(EXTRASUBDIRS:%=%/clean)
215 $(RM) $(CLEAN_FILES) $(CLEAN_TARGETS) $(PROGRAMS) $(MANPAGES)
217 .PHONY: clean $(EXTRASUBDIRS:%=%/clean)
219 # Rules for installing
224 install install-lib install-dev uninstall::
226 .PHONY: install install-lib install-dev uninstall
228 # Rules for resources
231 $(WRC) $(RCFLAGS) -O pot -o $@ $(PO_SRCS)
234 $(WMC) -O pot -o $@ $(MC_SRCS)
236 $(MC_SRCS:.mc=.res): $(WMC) $(ALL_MO_FILES)
237 $(RC_SRCS:.rc=.res): $(WRC)
238 $(PO_SRCS:.rc=.res): $(ALL_MO_FILES)
242 $(IDL_GEN_HEADERS) $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) $(IDL_TLB_RES) $(IDL_R_SRCS:.idl=_r.res): $(WIDL)
244 # End of global rules