Make.rules.in 7.69 KB
Newer Older
Alexandre Julliard's avatar
Alexandre Julliard committed
1
# Global rules shared by all makefiles     -*-Makefile-*-
Alexandre Julliard's avatar
Alexandre Julliard committed
2
#
3
# Each individual makefile must define the following variables:
Alexandre Julliard's avatar
Alexandre Julliard committed
4 5 6 7
# TOPSRCDIR    : top-level source directory
# TOPOBJDIR    : top-level object directory
# SRCDIR       : source directory for this module
# MODULE       : name of the module being built
8 9 10 11 12 13
#
# Each individual makefile may define the following additional variables:
# C_SRCS       : C sources for the module
# RC_SRCS      : resource source files
# EXTRA_SRCS   : extra source files for make depend
# EXTRA_OBJS   : extra object files
14 15
# IMPORTS      : dlls to import
# DELAYIMPORTS : dlls to import in delayed mode
16
# EXTRASUBDIRS : subdirectories that do not contain a Makefile
17
# MODCFLAGS    : extra CFLAGS for this module
Alexandre Julliard's avatar
Alexandre Julliard committed
18

Alexandre Julliard's avatar
Alexandre Julliard committed
19 20
# First some useful definitions

Alexandre Julliard's avatar
Alexandre Julliard committed
21 22
SHELL     = /bin/sh
CC        = @CC@
23
CFLAGS    = @CFLAGS@
24
CPPFLAGS  = @CPPFLAGS@
Alexandre Julliard's avatar
Alexandre Julliard committed
25
LIBS      = @LIBS@
26
BISON     = @BISON@
27
FLEX      = @FLEX@
28 29
EXEEXT    = @EXEEXT@
OBJEXT    = @OBJEXT@
30
LIBEXT    = @LIBEXT@
31
DLLEXT    = @DLLEXT@
32
TOOLSEXT  = @TOOLSEXT@
33
IMPLIBEXT = @IMPLIBEXT@
34
LDSHARED  = @LDSHARED@
35
DLLTOOL   = @DLLTOOL@
36
DLLWRAP   = @DLLWRAP@
37 38
AR        = @AR@
ARFLAGS   = @ARFLAGS@
Alexandre Julliard's avatar
Alexandre Julliard committed
39
RANLIB    = @RANLIB@
40
STRIP     = @STRIP@
Alexandre Julliard's avatar
Alexandre Julliard committed
41
LN_S      = @LN_S@
42
TOOLSDIR  = @TOOLSDIR@
43
LDFLAGS   = @LDFLAGS@
44
PRELINK   = @PRELINK@
Alexandre Julliard's avatar
Alexandre Julliard committed
45
RM        = rm -f
46 47 48
MV        = mv
LINT      = @LINT@
LINTFLAGS = @LINTFLAGS@
49
FONTFORGE = @FONTFORGE@
50
RSVG      = @RSVG@
51
CONVERT   = @CONVERT@
52
ICOTOOL   = @ICOTOOL@
53
CROSSCC   = @CROSSCC@
54 55 56
CROSSTARGET = @CROSSTARGET@
CROSSAR     = $(CROSSTARGET)-ar
CROSSRANLIB = $(CROSSTARGET)-ranlib
57
FAKEEXT   = $(DLLEXT:.so=.fake)
58 59
INCLUDES     = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include $(EXTRAINCL)
EXTRACFLAGS  = @EXTRACFLAGS@
60
ALLCFLAGS    = $(INCLUDES) $(DEFS) $(DLLFLAGS) $(EXTRACFLAGS) $(CPPFLAGS) $(CFLAGS) $(MODCFLAGS)
61
ALLLINTFLAGS = $(INCLUDES) $(DEFS) $(LINTFLAGS)
62
IDLFLAGS     = $(INCLUDES) $(DEFS) $(EXTRAIDLFLAGS)
63
TARGETFLAGS  = @TARGETFLAGS@
64
MKINSTALLDIRS= $(TOPSRCDIR)/tools/mkinstalldirs -m 755
65
WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi/winapi_check
66
BUILDIMAGE   = $(TOPSRCDIR)/tools/buildimage
67
C2MAN        = $(TOPSRCDIR)/tools/c2man.pl
68
RUNTEST      = $(TOPSRCDIR)/tools/runtest
69 70 71 72 73 74
WINEBUILD    = $(TOOLSDIR)/tools/winebuild/winebuild$(TOOLSEXT)
MAKEDEP      = $(TOOLSDIR)/tools/makedep$(TOOLSEXT)
MAKECTESTS   = $(TOOLSDIR)/tools/make_ctests$(TOOLSEXT)
WRC          = $(TOOLSDIR)/tools/wrc/wrc$(TOOLSEXT)
WMC          = $(TOOLSDIR)/tools/wmc/wmc$(TOOLSEXT)
WIDL         = $(TOOLSDIR)/tools/widl/widl$(TOOLSEXT)
75
WINEGCC      = $(TOOLSDIR)/tools/winegcc/winegcc $(TARGETFLAGS) -B$(TOOLSDIR)/tools/winebuild --sysroot=$(TOPOBJDIR) @UNWINDFLAGS@
76
CROSSWINEGCC = $(TOOLSDIR)/tools/winegcc/winegcc $(CROSSTARGET:%=-b %) -B$(TOOLSDIR)/tools/winebuild --sysroot=$(TOPOBJDIR) --lib-suffix=.cross.a
77 78
RELPATH      = $(TOOLSDIR)/tools/relpath$(TOOLSEXT)
SFNT2FNT     = $(TOOLSDIR)/tools/sfnt2fnt$(TOOLSEXT)
79
RC           = $(WRC)
80
RCFLAGS      = --nostdinc $(INCLUDES) $(DEFS) $(EXTRARCFLAGS)
81 82
LDPATH       = @LDPATH@
DLLDIR       = $(TOPOBJDIR)/dlls
83 84
LIBPORT      = $(TOPOBJDIR)/libs/port/libwine_port.a
LIBWPP       = $(TOPOBJDIR)/libs/wpp/libwpp.a
85
LIBWINE      = -L$(TOPOBJDIR)/libs/wine -lwine
86 87
LDRPATH_INSTALL = @LDRPATH_INSTALL@
LDRPATH_LOCAL   = @LDRPATH_LOCAL@
88

Alexandre Julliard's avatar
Alexandre Julliard committed
89 90
@SET_MAKE@

Alexandre Julliard's avatar
Alexandre Julliard committed
91 92
# Installation infos

93 94 95 96
INSTALL         = @INSTALL@ $(INSTALL_FLAGS)
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(INSTALL_PROGRAM_FLAGS)
INSTALL_SCRIPT  = @INSTALL_SCRIPT@ $(INSTALL_SCRIPT_FLAGS)
INSTALL_DATA    = @INSTALL_DATA@ $(INSTALL_DATA_FLAGS)
Alexandre Julliard's avatar
Alexandre Julliard committed
97 98 99 100
prefix          = @prefix@
exec_prefix     = @exec_prefix@
bindir          = @bindir@
libdir          = @libdir@
101
datarootdir     = @datarootdir@
102
datadir         = @datadir@
Alexandre Julliard's avatar
Alexandre Julliard committed
103
infodir         = @infodir@
104
mandir          = @mandir@
105 106
sysconfdir      = @sysconfdir@
includedir      = @includedir@/wine
107
dlldir          = @libdir@/wine
108
fakedlldir      = $(dlldir)/fakedlls
109
prog_manext     = 1
110
api_manext      = 3w
111
conf_manext     = 5
112
CLEAN_FILES     = *.o *.a *.so *.ln *.res *.fake *.$(LIBEXT) \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej *.flc core
113

114 115 116 117
IDL_GEN_C_SRCS  = $(IDL_C_SRCS:.idl=_c.c) $(IDL_I_SRCS:.idl=_i.c) \
                  $(IDL_P_SRCS:.idl=_p.c) $(IDL_S_SRCS:.idl=_s.c)
IDL_GEN_HEADERS = $(IDL_H_SRCS:.idl=.h) $(IDL_C_SRCS:.idl=.h) $(IDL_I_SRCS:.idl=.h) \
                  $(IDL_P_SRCS:.idl=.h) $(IDL_S_SRCS:.idl=.h)
118

119
CLEAN_TARGETS = $(IDL_GEN_C_SRCS) $(IDL_GEN_HEADERS) $(IDL_TLB_SRCS:.idl=.tlb) $(IDL_P_SRCS:%=dlldata.c) \
120
                $(BISON_SRCS:.y=.tab.c) $(BISON_SRCS:.y=.tab.h) $(LEX_SRCS:.l=.yy.c) $(MC_SRCS:.mc=.mc.rc)
Alexandre Julliard's avatar
Alexandre Julliard committed
121

122 123
OBJS = $(C_SRCS:.c=.o) $(BISON_SRCS:.y=.tab.o) $(LEX_SRCS:.l=.yy.o) $(IDL_GEN_C_SRCS:.c=.o) \
       $(RC_SRCS:.rc=.res) $(MC_SRCS:.mc=.mc.res) $(EXTRA_OBJS)
Alexandre Julliard's avatar
Alexandre Julliard committed
124

125
CROSSOBJS = $(OBJS:.o=.cross.o)
126
LINTS  = $(C_SRCS:.c=.ln)
127

128 129 130 131 132 133 134 135 136
# 'all' target first in case the enclosing Makefile didn't define any target

all:

filter: dummy
	@$(TOPSRCDIR)/tools/winapi/make_filter --make $(MAKE) all

.PHONY: all filter

Alexandre Julliard's avatar
Alexandre Julliard committed
137 138
# Implicit rules

139
.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 .bmp
Alexandre Julliard's avatar
Alexandre Julliard committed
140 141

.c.o:
142
	$(CC) -c $(ALLCFLAGS) -o $@ $<
Alexandre Julliard's avatar
Alexandre Julliard committed
143

144
.c.cross.o:
145
	$(CROSSCC) -c $(INCLUDES) $(DEFS) -DWINE_CROSSTEST $(CPPFLAGS) $(CFLAGS) -o $@ $<
146

147
.y.tab.c:
148
	$(BISON) $(BISONFLAGS) -p $*_ -o $@ $<
149 150

.y.tab.h:
151
	$(BISON) $(BISONFLAGS) -p $*_ -o $*.tab.c -d $<
152 153

.l.yy.c:
154
	$(FLEX) $(LEXFLAGS) -o$@ $<
155

156
.mc.mc.rc:
157
	$(LDPATH) $(WMC) -i -U -H /dev/null -o $@ $<
158

Alexandre Julliard's avatar
Alexandre Julliard committed
159
.rc.res:
160
	$(LDPATH) $(RC) $(RCFLAGS) -fo$@ $<
Alexandre Julliard's avatar
Alexandre Julliard committed
161

162
.idl.h:
163
	$(WIDL) $(IDLFLAGS) -h -H $@ $<
164

165 166 167 168 169 170 171 172 173 174 175 176
.idl_c.c:
	$(WIDL) $(IDLFLAGS) -c -C $@ $<

.idl_i.c:
	$(WIDL) $(IDLFLAGS) -u -U $@ $<

.idl_p.c:
	$(WIDL) $(IDLFLAGS) -p -P $@ $<

.idl_s.c:
	$(WIDL) $(IDLFLAGS) -s -S $@ $<

Huw Davies's avatar
Huw Davies committed
177
.idl.tlb:
178
	$(WIDL) $(TARGETFLAGS) $(IDLFLAGS) -t -T $@ $<
Huw Davies's avatar
Huw Davies committed
179

180 181 182
.c.ln:
	$(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )

183
.c.ok:
184
	$(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
185

186
.sfd.ttf:
187
	$(FONTFORGE) -script $(TOPSRCDIR)/fonts/genttf.ff $< $@
188

189
.man.in.man:
190
	LC_ALL=C sed -e 's,@bindir\@,$(bindir),g' -e 's,@dlldir\@,$(dlldir),g' -e 's,@PACKAGE_STRING\@,@PACKAGE_STRING@,g' $< >$@ || ($(RM) $@ && false)
191

192
.svg.ico:
193
	CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
194

195
.svg.bmp:
196
	CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
197

198 199 200 201 202
# Rules for IDL files

dlldata.c: $(WIDL) Makefile.in
	$(WIDL) $(IDLFLAGS) --dlldata-only --dlldata=$@ $(IDL_P_SRCS)

Alexandre Julliard's avatar
Alexandre Julliard committed
203 204
# Rule for linting

205 206 207 208 209 210 211 212 213 214
$(MODULE).ln : $(LINTS)
	if test "$(LINTS)" ; \
	then \
		$(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
	        $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
	else \
		$(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
	fi

lint:: $(MODULE).ln
Alexandre Julliard's avatar
Alexandre Julliard committed
215

216 217
# Rules for Windows API checking

218
winapi_check:: dummy
219 220
	$(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .

221 222
.PHONY: winapi_check

223 224
# Rules for dependencies

225
DEPEND_SRCS = $(C_SRCS) $(RC_SRCS) $(MC_SRCS) \
226 227 228
              $(IDL_H_SRCS) $(IDL_C_SRCS) $(IDL_I_SRCS) $(IDL_P_SRCS) $(IDL_S_SRCS) \
              $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) \
              $(BISON_SRCS) $(LEX_SRCS) $(EXTRA_SRCS)
229

230
depend: dummy
231
	$(MAKEDEP) $(MAKEDEPFLAGS) -C$(SRCDIR) -S$(TOPSRCDIR) -T$(TOPOBJDIR) $(EXTRAINCL) $(DEPEND_SRCS)
232

233
.PHONY: depend
234

235 236 237 238 239
# Rules for cleaning

$(EXTRASUBDIRS:%=%/__clean__): dummy
	-cd `dirname $@` && $(RM) $(CLEAN_FILES)

240
clean:: $(EXTRASUBDIRS:%=%/__clean__)
241
	$(RM) $(CLEAN_FILES) $(CLEAN_TARGETS) $(PROGRAMS) $(MANPAGES)
242

243
.PHONY: clean $(EXTRASUBDIRS:%=%/__clean__)
244

245 246
# Rules for installing

247 248 249
$(INSTALLDIRS):
	$(MKINSTALLDIRS) $@

250
install install-lib install-dev uninstall::
251

252
.PHONY: install install-lib install-dev uninstall
253

Alexandre Julliard's avatar
Alexandre Julliard committed
254 255
# Misc. rules

256
$(MC_SRCS:.mc=.mc.rc): $(WMC)
257

258
$(IDL_GEN_HEADERS) $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS:.idl=.tlb): $(WIDL)
259

260
$(RC_SRCS:.rc=.res) $(MC_SRCS:.mc=.mc.res): $(WRC)
261

Alexandre Julliard's avatar
Alexandre Julliard committed
262
dummy:
Alexandre Julliard's avatar
Alexandre Julliard committed
263

264
.PHONY: dummy
265

Alexandre Julliard's avatar
Alexandre Julliard committed
266
# End of global rules