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)
31 # Rules for main module
33 $(MODULE) $(MODULE:%=%.so) $(MODULE:%=%.fake): $(MAINSPEC) $(OBJS)
34 $(WINEGCC) $(APPMODE) $(MODULEFLAGS) $(OBJS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(DELAYIMPORTS:%=-Wb,-d%) -lwine $(LIBPORT) $(EXTRALIBS) $(LDFLAGS) $(LIBS)
36 # Rules for static libraries
42 $(AR) $(ARFLAGS) $@ $(OBJS)
45 $(STATICLIB:.a=.cross.a): $(CROSSOBJS)
47 $(CROSSAR) $(ARFLAGS) $@ $(CROSSOBJS)
50 # Rules for import libraries
52 $(IMPORTLIB:%=lib%.def.a): $(IMPLIB_SRCS:.c=.o)
54 $(AR) $(ARFLAGS) $@ $(IMPLIB_SRCS:.c=.o)
57 $(IMPORTLIB:%=lib%.a): $(MAINSPEC) $(IMPLIB_SRCS:.c=.o)
58 $(WINEBUILD) $(TARGETFLAGS) -w --implib -o $@ --export $(MAINSPEC) $(IMPLIB_SRCS:.c=.o)
60 $(IMPORTLIB:%=lib%.cross.a): $(MAINSPEC) $(IMPLIB_SRCS:.c=.cross.o)
61 $(WINEBUILD) $(CROSSTARGET:%=-b %) -w --implib -o $@ --export $(MAINSPEC) $(IMPLIB_SRCS:.c=.cross.o)
63 # Rules for dependencies
72 $(TESTMODULE) $(TESTMODULE:%=%.so): $(OBJS)
73 $(WINEGCC) $(APPMODE) $(OBJS) -o $@ $(IMPORTS:%=-l%) $(LDFLAGS) $(LIBS)
75 $(TESTMODULE_STRIPPED): $(OBJS)
76 $(WINEGCC) -s -Wb,-F,$(TESTMODULE) $(APPMODE) $(OBJS) -o $@ $(IMPORTS:%=-l%) $(LDFLAGS) $(LIBS)
78 $(CROSSTESTMODULE): $(CROSSOBJS)
79 $(CROSSWINEGCC) $(CROSSOBJS) -o $@ $(IMPORTS:%=-l%) $(LDFLAGS) $(LIBS)
81 $(WINETEST_RES): $(TESTMODULE_STRIPPED)
82 echo "$(TESTMODULE) TESTRES \"$(TESTMODULE_STRIPPED)\"" | $(WRC) $(RCFLAGS) -o $@
86 all: $(MANPAGES:.man.in=.man)
91 $(RM) $(CLEAN_FILES) $(CLEAN_TARGETS) $(PROGRAMS)
95 # Rules for installing
97 install install-lib install-dev uninstall::
99 .PHONY: install install-lib install-dev uninstall
101 # End of global rules