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_TARGETS = $(MODULE) $(IMPORTLIB:%=lib%.@IMPLIBEXT@) \
23 $(TESTMODULE) $(TESTMODULE_STRIPPED) $(CROSSTESTMODULE)
25 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) \
26 $(IDL_R_SRCS:.idl=_r.res) $(IDL_TLB_RES) $(RC_SRCS:.rc=.res) $(MC_SRCS:.mc=.res) $(EXTRA_OBJS)
28 CROSSOBJS = $(OBJS:.o=.cross.o)
29 ALLCROSSCFLAGS = $(DEFS) -DWINE_CROSSTEST $(CPPFLAGS) $(CFLAGS)
33 @MAINTAINER_MODE@.SUFFIXES: .sfd .ttf .svg .ico .bmp
36 $(FONTFORGE) -script $(top_srcdir)/fonts/genttf.ff $< $@
39 CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
42 CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
44 # Rules for main module
46 $(MODULE) $(MODULE:%=%.so) $(MODULE:%=%.fake): $(MAINSPEC) $(OBJS)
47 $(WINEGCC) $(APPMODE) $(MODULEFLAGS) $(OBJS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(DELAYIMPORTS:%=-Wb,-d%) -lwine $(LIBPORT) $(EXTRALIBS) $(LDFLAGS) $(LIBS)
49 # Rules for static libraries
55 $(AR) $(ARFLAGS) $@ $(OBJS)
58 $(STATICLIB:.a=.cross.a): $(CROSSOBJS)
60 $(CROSSAR) $(ARFLAGS) $@ $(CROSSOBJS)
63 # Rules for import libraries
65 $(IMPORTLIB:%=lib%.def.a): $(IMPLIB_SRCS:.c=.o)
67 $(AR) $(ARFLAGS) $@ $(IMPLIB_SRCS:.c=.o)
70 $(IMPORTLIB:%=lib%.a): $(MAINSPEC) $(IMPLIB_SRCS:.c=.o)
71 $(WINEBUILD) $(TARGETFLAGS) -w --implib -o $@ --export $(MAINSPEC) $(IMPLIB_SRCS:.c=.o)
73 $(IMPORTLIB:%=lib%.cross.a): $(MAINSPEC) $(IMPLIB_SRCS:.c=.cross.o)
74 $(WINEBUILD) $(CROSSTARGET:%=-b %) -w --implib -o $@ --export $(MAINSPEC) $(IMPLIB_SRCS:.c=.cross.o)
76 # Rules for dependencies
85 $(TESTMODULE) $(TESTMODULE:%=%.so): $(OBJS)
86 $(WINEGCC) $(APPMODE) $(OBJS) -o $@ $(IMPORTS:%=-l%) $(LDFLAGS) $(LIBS)
88 $(TESTMODULE_STRIPPED): $(OBJS)
89 $(WINEGCC) -s -Wb,-F,$(TESTMODULE) $(APPMODE) $(OBJS) -o $@ $(IMPORTS:%=-l%) $(LDFLAGS) $(LIBS)
91 $(CROSSTESTMODULE): $(CROSSOBJS)
92 $(CROSSWINEGCC) $(CROSSOBJS) -o $@ $(IMPORTS:%=-l%) $(LDFLAGS) $(LIBS)
94 $(WINETEST_RES): $(TESTMODULE_STRIPPED)
95 echo "$(TESTMODULE) TESTRES \"$(TESTMODULE_STRIPPED)\"" | $(WRC) $(RCFLAGS) -o $@
99 all: $(MANPAGES:.man.in=.man)
101 .PHONY: install-man-pages
106 $(RM) $(CLEAN_FILES) $(CLEAN_TARGETS) $(PROGRAMS)
110 # Rules for installing
115 install install-lib install-dev uninstall::
117 .PHONY: install install-lib install-dev uninstall
119 # End of global rules