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_OBJS : extra object files
8 # IMPORTS : dlls to import
9 # DELAYIMPORTS : dlls to import in delayed mode
10 # MODCFLAGS : extra CFLAGS for this module
12 # First some useful definitions
14 INCLUDES = -I$(srcdir) -I. -I$(top_srcdir)/include -I$(top_builddir)/include $(EXTRAINCL)
15 DEFS = -D__WINESRC__ $(EXTRADEFS)
16 ALLCFLAGS = $(INCLUDES) $(DEFS) $(DLLFLAGS) $(EXTRACFLAGS) $(CPPFLAGS) $(CFLAGS) $(MODCFLAGS)
17 IDLFLAGS = $(INCLUDES) $(DEFS) $(EXTRAIDLFLAGS)
18 RCFLAGS = --nostdinc $(PORCFLAGS) $(TARGETFLAGS) $(INCLUDES) $(DEFS) $(EXTRARCFLAGS)
20 IDL_GEN_C_SRCS = $(IDL_C_SRCS:.idl=_c.c) $(IDL_I_SRCS:.idl=_i.c) \
21 $(IDL_P_SRCS:.idl=_p.c) $(IDL_S_SRCS:.idl=_s.c)
23 CLEAN_FILES = *.o *.a *.so *.mo *.res *.fake *.ok *.tab.[ch] *.yy.c
24 CLEAN_TARGETS = $(MODULE) $(IMPORTLIB:%=lib%.@IMPLIBEXT@) $(XTEMPLATE_SRCS:.x=.h) \
25 $(TESTMODULE) $(TESTMODULE_STRIPPED) $(CROSSTESTMODULE)
27 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) \
28 $(IDL_R_SRCS:.idl=_r.res) $(IDL_TLB_RES) $(RC_SRCS:.rc=.res) $(MC_SRCS:.mc=.res) $(EXTRA_OBJS)
30 CROSSOBJS = $(OBJS:.o=.cross.o)
31 ALLCROSSCFLAGS = $(INCLUDES) $(DEFS) -DWINE_CROSSTEST $(CPPFLAGS) $(CFLAGS)
35 .SUFFIXES: .ok .man.in .man .po .mo @MAINTAINER_MODE@ .sfd .ttf .svg .ico .bmp
38 $(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
41 $(FONTFORGE) -script $(top_srcdir)/fonts/genttf.ff $< $@
44 LC_ALL=C sed -e 's,@bindir\@,$(bindir),g' -e 's,@dlldir\@,$(dlldir),g' -e 's,@PACKAGE_STRING\@,@PACKAGE_STRING@,g' $< >$@ || ($(RM) $@ && false)
47 CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
50 CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
55 # Rules for main module
57 $(MODULE) $(MODULE:%=%.so) $(MODULE:%=%.fake): $(MAINSPEC) $(OBJS) Makefile.in
58 $(WINEGCC) $(APPMODE) $(MODULEFLAGS) $(OBJS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(DELAYIMPORTS:%=-Wb,-d%) -lwine $(LIBPORT) $(EXTRALIBS) $(LDFLAGS) $(LIBS)
60 # Rules for static libraries
64 $(STATICLIB): $(OBJS) Makefile.in
66 $(AR) $(ARFLAGS) $@ $(OBJS)
69 $(STATICLIB:.a=.cross.a): $(CROSSOBJS) Makefile.in
71 $(CROSSAR) $(ARFLAGS) $@ $(CROSSOBJS)
74 # Rules for import libraries
76 $(IMPORTLIB:%=lib%.def.a): $(IMPLIB_SRCS:.c=.o)
78 $(AR) $(ARFLAGS) $@ $(IMPLIB_SRCS:.c=.o)
81 $(IMPORTLIB:%=lib%.a): $(MAINSPEC) $(IMPLIB_SRCS:.c=.o)
82 $(WINEBUILD) $(TARGETFLAGS) -w --implib -o $@ --export $(srcdir)/$(MAINSPEC) $(IMPLIB_SRCS:.c=.o)
84 $(IMPORTLIB:%=lib%.cross.a): $(MAINSPEC) $(IMPLIB_SRCS:.c=.cross.o)
85 $(WINEBUILD) $(CROSSTARGET:%=-b %) -w --implib -o $@ --export $(srcdir)/$(MAINSPEC) $(IMPLIB_SRCS:.c=.cross.o)
87 # Rules for dependencies
89 DEPEND_SRCS = $(C_SRCS) $(OBJC_SRCS) $(RC_SRCS) $(MC_SRCS) \
90 $(IDL_H_SRCS) $(IDL_C_SRCS) $(IDL_I_SRCS) $(IDL_P_SRCS) $(IDL_S_SRCS) $(IDL_R_SRCS) $(IDL_TLB_SRCS) \
91 $(BISON_SRCS) $(LEX_SRCS) $(EXTRA_OBJS)
94 $(MAKEDEP) $(MAKEDEPFLAGS) -C$(srcdir) -S$(top_srcdir) -T$(top_builddir) $(EXTRAINCL) $(DEPEND_SRCS)
100 $(TESTMODULE) $(TESTMODULE:%=%.so): $(OBJS) Makefile.in
101 $(WINEGCC) $(APPMODE) $(OBJS) -o $@ $(IMPORTS:%=-l%) $(LDFLAGS) $(LIBS)
103 $(TESTMODULE_STRIPPED): $(OBJS) Makefile.in
104 $(WINEGCC) -s -Wb,-F,$(TESTMODULE) $(APPMODE) $(OBJS) -o $@ $(IMPORTS:%=-l%) $(LDFLAGS) $(LIBS)
106 $(CROSSTESTMODULE): $(CROSSOBJS) Makefile.in
107 $(CROSSWINEGCC) $(CROSSOBJS) -o $@ $(IMPORTS:%=-l%) $(LDFLAGS) $(LIBS)
109 $(WINETEST_RES): $(TESTMODULE_STRIPPED)
110 echo "$(TESTMODULE) TESTRES \"$(TESTMODULE_STRIPPED)\"" | $(WRC) $(RCFLAGS) -o $@
115 .PHONY: check test testclean
117 # Rules for man pages
119 MANPAGES = $(MANPAGE) $(EXTRA_MANPAGES)
123 install-man-pages:: $(MANPAGE) $(DESTDIR)$(mandir)/man$(prog_manext)
124 $(INSTALL_DATA) $(MANPAGE) $(DESTDIR)$(mandir)/man$(prog_manext)/$(MANPAGE:.man=).$(prog_manext)
126 uninstall-man-pages::
127 $(RM) $(DESTDIR)$(mandir)/man$(prog_manext)/$(MANPAGE:.man=).$(prog_manext)
129 .PHONY: install-man-pages uninstall-man-pages
131 # Rules for auto documentation
133 manpages:: $(C_SRCS) dummy
134 $(C2MAN) -o $(top_builddir)/documentation/man$(api_manext) -R$(top_builddir) -C$(srcdir) $(INCLUDES) -S$(api_manext) $(MAINSPEC:%=-w %) $(C_SRCS)
136 htmlpages:: $(C_SRCS) dummy
137 $(C2MAN) -o $(top_builddir)/documentation/html -R$(top_builddir) -C$(srcdir) $(INCLUDES) -Th $(MAINSPEC:%=-w %) $(C_SRCS)
139 sgmlpages:: $(C_SRCS) dummy
140 $(C2MAN) -o $(top_builddir)/documentation/api-guide -R$(top_builddir) -C$(srcdir) $(INCLUDES) -Ts $(MAINSPEC:%=-w %) $(C_SRCS)
142 xmlpages:: $(C_SRCS) dummy
143 $(C2MAN) -o $(top_builddir)/documentation/api-guide-xml -R$(top_builddir) -C$(srcdir) $(INCLUDES) -Tx $(MAINSPEC:%=-w %) $(C_SRCS)
148 $(RM) $(CLEAN_FILES) $(CLEAN_TARGETS) $(PROGRAMS) $(MANPAGES)
152 # Rules for installing
157 install install-lib install-dev uninstall::
159 .PHONY: install install-lib install-dev uninstall
161 # End of global rules