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 DEFS = -D__WINESRC__ $(EXTRADEFS)
15 ALLCFLAGS = $(DEFS) $(DLLFLAGS) $(EXTRACFLAGS) $(CPPFLAGS) $(CFLAGS) $(MODCFLAGS)
16 IDLFLAGS = $(DEFS) $(EXTRAIDLFLAGS)
17 RCFLAGS = --nostdinc $(PORCFLAGS) $(TARGETFLAGS) $(DEFS) $(EXTRARCFLAGS)
19 IDL_GEN_C_SRCS = $(IDL_C_SRCS:.idl=_c.c) $(IDL_I_SRCS:.idl=_i.c) \
20 $(IDL_P_SRCS:.idl=_p.c) $(IDL_S_SRCS:.idl=_s.c)
22 CLEAN_FILES = *.o *.a *.so *.res *.fake *.ok *.tab.[ch] *.yy.c
23 CLEAN_TARGETS = $(MODULE) $(IMPORTLIB:%=lib%.@IMPLIBEXT@) $(XTEMPLATE_SRCS:.x=.h) \
24 $(TESTMODULE) $(TESTMODULE_STRIPPED) $(CROSSTESTMODULE)
26 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) \
27 $(IDL_R_SRCS:.idl=_r.res) $(IDL_TLB_RES) $(RC_SRCS:.rc=.res) $(MC_SRCS:.mc=.res) $(EXTRA_OBJS)
29 CROSSOBJS = $(OBJS:.o=.cross.o)
30 ALLCROSSCFLAGS = $(DEFS) -DWINE_CROSSTEST $(CPPFLAGS) $(CFLAGS)
34 @MAINTAINER_MODE@.SUFFIXES: .sfd .ttf .svg .ico .bmp
37 $(FONTFORGE) -script $(top_srcdir)/fonts/genttf.ff $< $@
40 CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
43 CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
45 # Rules for main module
47 $(MODULE) $(MODULE:%=%.so) $(MODULE:%=%.fake): $(MAINSPEC) $(OBJS)
48 $(WINEGCC) $(APPMODE) $(MODULEFLAGS) $(OBJS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(DELAYIMPORTS:%=-Wb,-d%) -lwine $(LIBPORT) $(EXTRALIBS) $(LDFLAGS) $(LIBS)
50 # Rules for static libraries
56 $(AR) $(ARFLAGS) $@ $(OBJS)
59 $(STATICLIB:.a=.cross.a): $(CROSSOBJS)
61 $(CROSSAR) $(ARFLAGS) $@ $(CROSSOBJS)
64 # Rules for import libraries
66 $(IMPORTLIB:%=lib%.def.a): $(IMPLIB_SRCS:.c=.o)
68 $(AR) $(ARFLAGS) $@ $(IMPLIB_SRCS:.c=.o)
71 $(IMPORTLIB:%=lib%.a): $(MAINSPEC) $(IMPLIB_SRCS:.c=.o)
72 $(WINEBUILD) $(TARGETFLAGS) -w --implib -o $@ --export $(srcdir)/$(MAINSPEC) $(IMPLIB_SRCS:.c=.o)
74 $(IMPORTLIB:%=lib%.cross.a): $(MAINSPEC) $(IMPLIB_SRCS:.c=.cross.o)
75 $(WINEBUILD) $(CROSSTARGET:%=-b %) -w --implib -o $@ --export $(srcdir)/$(MAINSPEC) $(IMPLIB_SRCS:.c=.cross.o)
77 # Rules for dependencies
79 DEPEND_SRCS = $(C_SRCS) $(OBJC_SRCS) $(RC_SRCS) $(MC_SRCS) \
80 $(IDL_H_SRCS) $(IDL_C_SRCS) $(IDL_I_SRCS) $(IDL_P_SRCS) $(IDL_S_SRCS) $(IDL_R_SRCS) $(IDL_TLB_SRCS) \
81 $(BISON_SRCS) $(LEX_SRCS) $(EXTRA_OBJS) $(MANPAGES)
84 $(MAKEDEP) $(MAKEDEPFLAGS) -C$(srcdir) -S$(top_srcdir) -T$(top_builddir) $(PARENTSRC:%=-P%) $(EXTRAINCL) $(DEPEND_SRCS)
90 $(TESTMODULE) $(TESTMODULE:%=%.so): $(OBJS)
91 $(WINEGCC) $(APPMODE) $(OBJS) -o $@ $(IMPORTS:%=-l%) $(LDFLAGS) $(LIBS)
93 $(TESTMODULE_STRIPPED): $(OBJS)
94 $(WINEGCC) -s -Wb,-F,$(TESTMODULE) $(APPMODE) $(OBJS) -o $@ $(IMPORTS:%=-l%) $(LDFLAGS) $(LIBS)
96 $(CROSSTESTMODULE): $(CROSSOBJS)
97 $(CROSSWINEGCC) $(CROSSOBJS) -o $@ $(IMPORTS:%=-l%) $(LDFLAGS) $(LIBS)
99 $(WINETEST_RES): $(TESTMODULE_STRIPPED)
100 echo "$(TESTMODULE) TESTRES \"$(TESTMODULE_STRIPPED)\"" | $(WRC) $(RCFLAGS) -o $@
102 # Rules for man pages
104 all: $(MANPAGES:.man.in=.man)
106 .PHONY: install-man-pages
111 $(RM) $(CLEAN_FILES) $(CLEAN_TARGETS) $(PROGRAMS)
115 # Rules for installing
120 install install-lib install-dev uninstall::
122 .PHONY: install install-lib install-dev uninstall
124 # End of global rules