1 # Global rules shared by all makefiles -*-Makefile-*-
3 # Each individual makefile must define the following variables:
4 # TOPSRCDIR : top-level source directory
5 # TOPOBJDIR : top-level object directory
6 # SRCDIR : source directory for this module
7 # MODULE : name of the module being built
9 # Each individual makefile may define the following additional variables:
10 # C_SRCS : C sources for the module
11 # RC_SRCS : resource source files
12 # EXTRA_SRCS : extra source files for make depend
13 # EXTRA_OBJS : extra object files
14 # IMPORTS : dlls to import
15 # DELAYIMPORTS : dlls to import in delayed mode
16 # EXTRASUBDIRS : subdirectories that do not contain a Makefile
17 # MODCFLAGS : extra CFLAGS for this module
19 # First some useful definitions
33 IMPLIBEXT = @IMPLIBEXT@
48 LINTFLAGS = @LINTFLAGS@
49 FONTFORGE = @FONTFORGE@
53 CROSSTARGET = @CROSSTARGET@
54 CROSSAR = $(CROSSTARGET)-ar
55 CROSSRANLIB = $(CROSSTARGET)-ranlib
56 FAKEEXT = $(DLLEXT:.so=.fake)
57 INCLUDES = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include $(EXTRAINCL)
58 EXTRACFLAGS = @EXTRACFLAGS@
59 ALLCFLAGS = $(INCLUDES) $(DEFS) $(DLLFLAGS) $(EXTRACFLAGS) $(CPPFLAGS) $(CFLAGS) $(MODCFLAGS)
60 ALLLINTFLAGS = $(INCLUDES) $(DEFS) $(LINTFLAGS)
61 IDLFLAGS = $(INCLUDES) $(DEFS) $(EXTRAIDLFLAGS)
62 TARGETFLAGS = @TARGETFLAGS@
63 WINEBUILDFLAGS = $(TARGETFLAGS) $(DLLFLAGS)
64 MKINSTALLDIRS= $(TOPSRCDIR)/tools/mkinstalldirs -m 755
65 WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi/winapi_check
66 C2MAN = $(TOPSRCDIR)/tools/c2man.pl
67 RUNTEST = $(TOPSRCDIR)/tools/runtest
68 WINEBUILD = $(TOOLSDIR)/tools/winebuild/winebuild$(TOOLSEXT)
69 MAKEDEP = $(TOOLSDIR)/tools/makedep$(TOOLSEXT)
70 MAKECTESTS = $(TOOLSDIR)/tools/make_ctests$(TOOLSEXT)
71 WRC = $(TOOLSDIR)/tools/wrc/wrc$(TOOLSEXT)
72 WMC = $(TOOLSDIR)/tools/wmc/wmc$(TOOLSEXT)
73 WIDL = $(TOOLSDIR)/tools/widl/widl$(TOOLSEXT)
74 WINEGCC = $(TOOLSDIR)/tools/winegcc/winegcc $(TARGETFLAGS) -B$(TOOLSDIR)/tools/winebuild --sysroot=$(TOPOBJDIR)
75 CROSSWINEGCC = $(TOOLSDIR)/tools/winegcc/winegcc $(CROSSTARGET:%=-b %) -B$(TOOLSDIR)/tools/winebuild --sysroot=$(TOPOBJDIR) --lib-suffix=.cross.a
76 RELPATH = $(TOOLSDIR)/tools/relpath$(TOOLSEXT)
77 SFNT2FNT = $(TOOLSDIR)/tools/sfnt2fnt$(TOOLSEXT)
79 RCFLAGS = --nostdinc $(INCLUDES) $(DEFS) $(EXTRARCFLAGS)
81 DLLDIR = $(TOPOBJDIR)/dlls
82 LIBPORT = $(TOPOBJDIR)/libs/port/libwine_port.a
83 LIBWPP = $(TOPOBJDIR)/libs/wpp/libwpp.a
84 LIBWINE = -L$(TOPOBJDIR)/libs/wine -lwine
85 LDRPATH_INSTALL = @LDRPATH_INSTALL@
86 LDRPATH_LOCAL = @LDRPATH_LOCAL@
92 INSTALL = @INSTALL@ $(INSTALL_FLAGS)
93 INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(INSTALL_PROGRAM_FLAGS)
94 INSTALL_SCRIPT = @INSTALL_SCRIPT@ $(INSTALL_SCRIPT_FLAGS)
95 INSTALL_DATA = @INSTALL_DATA@ $(INSTALL_DATA_FLAGS)
97 exec_prefix = @exec_prefix@
100 datarootdir = @datarootdir@
104 sysconfdir = @sysconfdir@
105 includedir = @includedir@/wine
106 dlldir = @libdir@/wine
107 fakedlldir = $(dlldir)/fakedlls
111 CLEAN_FILES = *.o *.a *.so *.ln *.res *.fake *.$(LIBEXT) \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej *.flc core
113 IDL_GEN_C_SRCS = $(IDL_C_SRCS:.idl=_c.c) $(IDL_I_SRCS:.idl=_i.c) \
114 $(IDL_P_SRCS:.idl=_p.c) $(IDL_S_SRCS:.idl=_s.c)
115 IDL_GEN_HEADERS = $(IDL_H_SRCS:.idl=.h) $(IDL_C_SRCS:.idl=.h) $(IDL_I_SRCS:.idl=.h) \
116 $(IDL_P_SRCS:.idl=.h) $(IDL_S_SRCS:.idl=.h)
118 CLEAN_TARGETS = $(IDL_GEN_C_SRCS) $(IDL_GEN_HEADERS) $(IDL_TLB_SRCS:.idl=.tlb) $(IDL_P_SRCS:%=dlldata.c) \
119 $(BISON_SRCS:.y=.tab.c) $(BISON_SRCS:.y=.tab.h) $(LEX_SRCS:.l=.yy.c) $(MC_SRCS:.mc=.mc.rc)
121 OBJS = $(C_SRCS:.c=.o) $(BISON_SRCS:.y=.tab.o) $(LEX_SRCS:.l=.yy.o) $(IDL_GEN_C_SRCS:.c=.o) \
122 $(RC_SRCS:.rc=.res) $(MC_SRCS:.mc=.mc.res) $(EXTRA_OBJS)
124 CROSSOBJS = $(OBJS:.o=.cross.o)
125 LINTS = $(C_SRCS:.c=.ln)
127 # 'all' target first in case the enclosing Makefile didn't define any target
132 @$(TOPSRCDIR)/tools/winapi/make_filter --make $(MAKE) all
138 .SUFFIXES: .mc .rc .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 .cross.o @MAINTAINER_MODE@ .sfd .ttf .svg .ico
141 $(CC) -c $(ALLCFLAGS) -o $@ $<
144 $(CROSSCC) -c $(INCLUDES) $(DEFS) $(CPPFLAGS) $(CFLAGS) -o $@ $<
147 $(BISON) $(BISONFLAGS) -p $*_ -o $@ $<
150 $(BISON) $(BISONFLAGS) -p $*_ -o $*.tab.c -d $<
153 $(FLEX) $(LEXFLAGS) -o$@ $<
156 $(LDPATH) $(WMC) -i -U -H /dev/null -o $@ $<
159 $(LDPATH) $(RC) $(RCFLAGS) -fo$@ $<
162 $(WIDL) $(IDLFLAGS) -h -H $@ $<
165 $(WIDL) $(IDLFLAGS) -c -C $@ $<
168 $(WIDL) $(IDLFLAGS) -u -U $@ $<
171 $(WIDL) $(IDLFLAGS) -p -P $@ $<
174 $(WIDL) $(IDLFLAGS) -s -S $@ $<
177 $(WIDL) $(TARGETFLAGS) $(IDLFLAGS) -t -T $@ $<
180 $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
183 $(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
186 $(FONTFORGE) -script $(TOPSRCDIR)/fonts/genttf.ff $< $@
189 LC_ALL=C sed -e 's,@bindir\@,$(bindir),g' -e 's,@dlldir\@,$(dlldir),g' -e 's,@PACKAGE_STRING\@,@PACKAGE_STRING@,g' $< >$@ || ($(RM) $@ && false)
192 $(RSVG) -w 16 -h 16 -f png $< $*-16.png
193 $(RSVG) -w 32 -h 32 -f png $< $*-32.png
194 $(RSVG) -w 48 -h 48 -f png $< $*-48.png
195 $(ICOTOOL) -c -o $@ $*-16.png $*-32.png $*-48.png
196 $(RM) $*-16.png $*-32.png $*-48.png
198 # Rules for IDL files
200 dlldata.c: $(WIDL) Makefile.in
201 $(WIDL) $(IDLFLAGS) --dlldata-only --dlldata=$@ $(IDL_P_SRCS)
205 $(MODULE).ln : $(LINTS)
206 if test "$(LINTS)" ; \
208 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
209 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
211 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
216 # Rules for Windows API checking
219 $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
223 # Rules for dependencies
225 DEPEND_SRCS = $(C_SRCS) $(RC_SRCS) $(MC_SRCS) \
226 $(IDL_H_SRCS) $(IDL_C_SRCS) $(IDL_I_SRCS) $(IDL_P_SRCS) $(IDL_S_SRCS) \
227 $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) \
228 $(BISON_SRCS) $(LEX_SRCS) $(EXTRA_SRCS)
231 $(MAKEDEP) $(MAKEDEPFLAGS) -C$(SRCDIR) -S$(TOPSRCDIR) -T$(TOPOBJDIR) $(EXTRAINCL) $(DEPEND_SRCS)
237 $(EXTRASUBDIRS:%=%/__clean__): dummy
238 -cd `dirname $@` && $(RM) $(CLEAN_FILES)
240 clean:: $(EXTRASUBDIRS:%=%/__clean__)
241 $(RM) $(CLEAN_FILES) $(CLEAN_TARGETS) $(PROGRAMS) $(MANPAGES)
243 .PHONY: clean $(EXTRASUBDIRS:%=%/__clean__)
245 # Rules for installing
250 install install-lib install-dev uninstall::
252 .PHONY: install install-lib install-dev uninstall
256 $(MC_SRCS:.mc=.mc.rc): $(WMC)
258 $(IDL_GEN_HEADERS) $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS:.idl=.tlb): $(WIDL)
260 $(RC_SRCS:.rc=.res) $(MC_SRCS:.mc=.mc.res): $(WRC)
266 # End of global rules