blob: fc18bd9ed37da945a9eb863888bb36884f881867 [file] [log] [blame]
Alexandre Julliard139a4b11996-11-02 14:24:07 +00001# Global rules shared by all makefiles -*-Makefile-*-
Alexandre Julliardbf9130a1996-10-13 17:45:47 +00002#
Alexandre Julliardc53ceba2000-04-09 18:19:59 +00003# Each individual makefile must define the following variables:
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +00004# 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
Alexandre Julliardc53ceba2000-04-09 18:19:59 +00008#
9# Each individual makefile may define the following additional variables:
10# C_SRCS : C sources for the module
Alexandre Julliardc728efc2002-10-02 02:34:09 +000011# C_SRCS16 : 16-bit C sources for the module
Alexandre Julliardc53ceba2000-04-09 18:19:59 +000012# RC_SRCS : resource source files
Alexandre Julliardc53ceba2000-04-09 18:19:59 +000013# EXTRA_SRCS : extra source files for make depend
14# EXTRA_OBJS : extra object files
Alexandre Julliard32459912002-05-09 00:05:48 +000015# IMPORTS : dlls to import
16# DELAYIMPORTS : dlls to import in delayed mode
Alexandre Julliardc53ceba2000-04-09 18:19:59 +000017# SUBDIRS : subdirectories that contain a Makefile
18# EXTRASUBDIRS : subdirectories that do not contain a Makefile
Alexandre Julliardf673b712002-06-14 23:48:27 +000019# INSTALLSUBDIRS : subdirectories to run make install/uninstall into
Alexandre Julliardff8331e1995-09-18 11:19:54 +000020
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +000021# First some useful definitions
22
Alexandre Julliard8664b891996-04-05 14:58:24 +000023SHELL = /bin/sh
24CC = @CC@
Alexandre Julliardfc094232003-04-14 21:46:41 +000025CFLAGS = @CFLAGS@
Alexandre Julliard15566392003-06-13 23:26:01 +000026CPPFLAGS = @CPPFLAGS@
Alexandre Julliard02e90081998-01-04 17:49:09 +000027LIBS = @LIBS@
Mike McCormackc068f672004-03-16 03:11:39 +000028BISON = @BISON@
29YACC = $(BISON) -y
Alexandre Julliardff8331e1995-09-18 11:19:54 +000030LEX = @LEX@
31LEXLIB = @LEXLIB@
Alexandre Julliardfc01b722002-05-12 03:16:39 +000032EXEEXT = @EXEEXT@
33OBJEXT = @OBJEXT@
Alexandre Julliard2fa4f762000-10-31 00:20:51 +000034LIBEXT = @LIBEXT@
Alexandre Julliardc1bfca02002-03-20 22:19:06 +000035DLLEXT = @DLLEXT@
Alexandre Julliardada5e652002-12-12 22:03:14 +000036IMPLIBEXT = @IMPLIBEXT@
Alexandre Julliard2fa4f762000-10-31 00:20:51 +000037LDSHARED = @LDSHARED@
Alexandre Julliardada5e652002-12-12 22:03:14 +000038DLLTOOL = @DLLTOOL@
Hidenori Takeshimad48ca942000-12-22 22:28:00 +000039DLLWRAP = @DLLWRAP@
Alexandre Julliardfc01b722002-05-12 03:16:39 +000040AR = @AR@ rc
Alexandre Julliard641ee761997-08-04 16:34:36 +000041RANLIB = @RANLIB@
Alexandre Julliardfc01b722002-05-12 03:16:39 +000042STRIP = @STRIP@
43WINDRES = @WINDRES@
Alexandre Julliarddf234a92002-05-22 02:10:39 +000044LN = @LN@
Alexandre Julliard641ee761997-08-04 16:34:36 +000045LN_S = @LN_S@
Alexandre Julliardfc01b722002-05-12 03:16:39 +000046TOOLSDIR = @TOOLSDIR@
Marcus Meissner1d4db782003-01-09 00:46:54 +000047AS = @AS@
Alexandre Julliardeb5f89c2002-05-24 21:22:10 +000048LD = @LD@
Marcus Meissnera387aa42000-09-26 23:09:47 +000049LDFLAGS = @LDFLAGS@
Alexandre Julliardff8331e1995-09-18 11:19:54 +000050RM = rm -f
Patrik Stridvalla9be64e1999-07-31 17:39:44 +000051MV = mv
Patrik Stridvalla9be64e1999-07-31 17:39:44 +000052LINT = @LINT@
53LINTFLAGS = @LINTFLAGS@
Alexandre Julliardfc094232003-04-14 21:46:41 +000054INCLUDES = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include $(EXTRAINCL)
55EXTRACFLAGS = @EXTRACFLAGS@
Alexandre Julliard16cd8612003-09-24 19:01:44 +000056ALLCFLAGS = $(INCLUDES) $(DEFS) $(DLLFLAGS) $(EXTRACFLAGS) $(CPPFLAGS) $(CFLAGS)
Alexandre Julliardfc094232003-04-14 21:46:41 +000057ALLLINTFLAGS = $(INCLUDES) $(DEFS) $(LINTFLAGS)
Alexandre Julliard16cd8612003-09-24 19:01:44 +000058IDLFLAGS = $(INCLUDES) $(DEFS) $(EXTRAIDLFLAGS)
Alexandre Julliardfc094232003-04-14 21:46:41 +000059MKINSTALLDIRS= $(TOPSRCDIR)/tools/mkinstalldirs -m 755
Patrik Stridvall385dc181999-09-29 10:24:19 +000060WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi_check/winapi_check
Alexandre Julliard35363162002-05-22 21:32:49 +000061WINEWRAPPER = $(TOPSRCDIR)/tools/winewrapper
Richard Cohen6039fb02003-07-21 22:01:07 +000062C2MAN = $(TOPSRCDIR)/tools/c2man.pl
Dimitrie O. Paune39e8a12002-11-11 20:25:54 +000063RUNTEST = $(TOPSRCDIR)/tools/runtest
Alexandre Julliardfc01b722002-05-12 03:16:39 +000064WINEBUILD = $(TOOLSDIR)/tools/winebuild/winebuild
65MAKEDEP = $(TOOLSDIR)/tools/makedep
66WRC = $(TOOLSDIR)/tools/wrc/wrc
Dimitrie O. Paun54e6b0d2003-10-03 05:01:33 +000067BIN2RES = $(TOOLSDIR)/tools/bin2res
Alexandre Julliardfc01b722002-05-12 03:16:39 +000068WMC = $(TOOLSDIR)/tools/wmc/wmc
Alexandre Julliarded2f8fc2002-12-03 23:36:05 +000069WIDL = $(TOOLSDIR)/tools/widl/widl
Alexandre Julliardccc3d662004-03-02 06:58:21 +000070WINEGCC = $(TOOLSDIR)/tools/winegcc/winegcc
Dimitrie O. Paun1a1f9bf2003-05-06 18:34:53 +000071RC = $(WRC)
72RC16 = $(WRC)
Alexandre Julliard49b9c762003-12-13 03:19:34 +000073RCFLAGS = --nostdinc $(INCLUDES) $(DEFS) $(EXTRARCFLAGS)
Dimitrie O. Paun1a1f9bf2003-05-06 18:34:53 +000074RC16FLAGS = -O res16 $(RCFLAGS)
Alexandre Julliard2a93f852002-12-11 01:34:51 +000075LDPATH = @LDPATH@
76DLLDIR = $(TOPOBJDIR)/dlls
Alexandre Julliarde1a9b102003-05-01 03:16:21 +000077LIBDIR = $(TOPOBJDIR)/libs
Alexandre Julliard6a9fe362003-03-19 22:09:16 +000078LIBPORT = -L$(TOPOBJDIR)/libs/port -lwine_port
Alexandre Julliard7ab9a712003-03-21 05:06:48 +000079LIBUNICODE = -L$(TOPOBJDIR)/libs/unicode -lwine_unicode
Alexandre Julliard2d1c7902003-03-22 20:40:48 +000080LIBWINE = -L$(TOPOBJDIR)/libs/wine -lwine
Alexandre Julliardb0182392000-12-06 00:04:10 +000081
Alexandre Julliardff8331e1995-09-18 11:19:54 +000082@SET_MAKE@
83
Alexandre Julliard641ee761997-08-04 16:34:36 +000084# Installation infos
85
Alexandre Julliardf673b712002-06-14 23:48:27 +000086INSTALL = @INSTALL@ $(INSTALL_FLAGS)
87INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(INSTALL_PROGRAM_FLAGS)
88INSTALL_SCRIPT = @INSTALL_SCRIPT@ $(INSTALL_SCRIPT_FLAGS)
89INSTALL_DATA = @INSTALL_DATA@ $(INSTALL_DATA_FLAGS)
Alexandre Julliard641ee761997-08-04 16:34:36 +000090prefix = @prefix@
91exec_prefix = @exec_prefix@
92bindir = @bindir@
93libdir = @libdir@
Alexandre Julliard1d8d0172002-08-02 19:34:21 +000094datadir = @datadir@
Alexandre Julliard641ee761997-08-04 16:34:36 +000095infodir = @infodir@
Alexandre Julliardd6baf1b1999-07-18 15:47:22 +000096mandir = @mandir@
Alexandre Julliard9bb05fc2002-05-14 18:36:54 +000097sysconfdir = @sysconfdir@
98includedir = @includedir@/wine
Alexandre Julliardc1bfca02002-03-20 22:19:06 +000099dlldir = @libdir@/wine
Alexandre Julliardd6baf1b1999-07-18 15:47:22 +0000100prog_manext = 1
Jon Griffiths35345f22003-03-15 19:48:34 +0000101api_manext = 3w
Alexandre Julliardd6baf1b1999-07-18 15:47:22 +0000102conf_manext = 5
Alexandre Julliardfc01b722002-05-12 03:16:39 +0000103CLEAN_FILES = *.o *.a *.so *.ln *.$(LIBEXT) \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej \
Mike McCormackc068f672004-03-16 03:11:39 +0000104 *.flc *.spec.c *.spec.def *.dbg.c *.tab.c *.tab.h @LEX_OUTPUT_ROOT@.c core
Alexandre Julliard641ee761997-08-04 16:34:36 +0000105
Alexandre Julliardc728efc2002-10-02 02:34:09 +0000106OBJS = $(C_SRCS:.c=.o) $(EXTRA_OBJS)
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000107
Steven Edwards9138fbb2002-07-29 23:28:09 +0000108RCOBJS = $(RC_SRCS:.rc=.res.o)
109LINTS = $(C_SRCS:.c=.ln)
Patrik Stridvalla9be64e1999-07-31 17:39:44 +0000110
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000111# Implicit rules
112
Alexandre Julliard21ee3292003-04-21 22:52:31 +0000113.SUFFIXES: .mc .rc .mc.rc .res .res.o .spec .spec.c .spec.def .ok
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000114
115.c.o:
François Gouget1c3a2422001-11-09 19:15:51 +0000116 $(CC) -c $(ALLCFLAGS) -o $@ $<
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000117
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +0000118.s.o:
François Gouget1c3a2422001-11-09 19:15:51 +0000119 $(AS) -o $@ $<
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +0000120
Alexandre Julliard017a61e2000-11-06 05:30:48 +0000121.mc.mc.rc:
Martin Fuchs3f441672002-10-19 17:15:00 +0000122 $(LDPATH) $(WMC) -i -U -H /dev/null -o $@ $<
Alexandre Julliardf5aee672000-07-25 17:52:08 +0000123
Alexandre Julliarda845b881998-06-01 10:44:35 +0000124.rc.res:
Dimitrie O. Paun1a1f9bf2003-05-06 18:34:53 +0000125 $(LDPATH) $(RC) $(RCFLAGS) -fo$@ $<
Alexandre Julliarda845b881998-06-01 10:44:35 +0000126
Alexandre Julliardfc01b722002-05-12 03:16:39 +0000127.res.res.o:
128 $(WINDRES) -i $< -o $@
129
Ulrich Weigand3dff7bb1999-07-11 13:58:31 +0000130.spec.spec.c:
Alexandre Julliard492ac292004-02-17 20:36:16 +0000131 $(WINEBUILD) $(DEFS) -o $@ --main-module $(MODULE) --dll $<
Ulrich Weigand3dff7bb1999-07-11 13:58:31 +0000132
Dmitry Timoshkov93a5b862002-02-04 18:48:18 +0000133.spec.spec.def:
Alexandre Julliard2e12d332003-04-21 23:54:05 +0000134 $(WINEBUILD) $(DEFS) -o $@ --def $<
Dmitry Timoshkov93a5b862002-02-04 18:48:18 +0000135
Patrik Stridvalla9be64e1999-07-31 17:39:44 +0000136.c.ln:
137 $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
138
Alexandre Julliardcaa03382002-02-20 19:03:59 +0000139.c.ok:
Alexandre Julliardedeee892002-08-09 01:22:40 +0000140 $(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
Alexandre Julliardcaa03382002-02-20 19:03:59 +0000141
Alexandre Julliardd0edc5f2000-03-04 22:31:27 +0000142# 'all' target first in case the enclosing Makefile didn't define any target
143
144all: Makefile
145
Patrik Stridvallb7190292001-07-29 20:20:13 +0000146filter:
147 @$(TOPSRCDIR)/tools/winapi/make_filter --make $(MAKE) all
148
Alexandre Julliardf673b712002-06-14 23:48:27 +0000149.PHONY: all filter
150
Dimitrie O. Paun54e6b0d2003-10-03 05:01:33 +0000151# Rules for resources
152
153$(RC_BINARIES): $(BIN2RES) $(RC_BINSRC)
154 $(BIN2RES) -f -o $@ $(SRCDIR)/$(RC_BINSRC)
155
156$(RC_SRCS:.rc=.res) $(RC_SRCS16:.rc=.res): $(WRC) $(RC_BINARIES)
157
Alexandre Julliardad533832002-05-14 20:54:58 +0000158# Rule for main module debug channels
159
Alexandre Julliardc728efc2002-10-02 02:34:09 +0000160$(MODULE).dbg.c: $(C_SRCS) $(C_SRCS16) $(WINEBUILD)
Alexandre Julliard2e12d332003-04-21 23:54:05 +0000161 $(WINEBUILD) $(DEFS) -o $@ --debug -C$(SRCDIR) $(C_SRCS) $(C_SRCS16)
Alexandre Julliarda845b881998-06-01 10:44:35 +0000162
Alexandre Julliard526531e2002-08-01 18:36:58 +0000163# Rule to rebuild the tools
Bertho Stultiens30855912000-06-13 04:34:41 +0000164
Alexandre Julliarde048ada2003-03-23 20:00:02 +0000165$(MAKEDEP):
Alexandre Julliard526531e2002-08-01 18:36:58 +0000166 cd $(TOOLSDIR)/tools && $(MAKE) `basename $@`
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000167
Alexandre Julliarde66d4211999-03-14 15:22:29 +0000168# Rules for makefile
169
Marcus Meissnerca004e51999-01-03 12:26:22 +0000170Makefile: Makefile.in $(TOPSRCDIR)/configure
171 @echo Makefile is older than $?, please rerun $(TOPSRCDIR)/configure
172 @exit 1
173
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000174# Rule for linting
175
Patrik Stridvalla9be64e1999-07-31 17:39:44 +0000176$(MODULE).ln : $(LINTS)
177 if test "$(LINTS)" ; \
178 then \
179 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
180 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
181 else \
182 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
183 fi
184
185lint:: $(MODULE).ln
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000186
Patrik Stridvall385dc181999-09-29 10:24:19 +0000187# Rules for Windows API checking
188
Alexandre Julliardf673b712002-06-14 23:48:27 +0000189winapi_check:: dummy
Patrik Stridvall385dc181999-09-29 10:24:19 +0000190 $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
191
Alexandre Julliardf673b712002-06-14 23:48:27 +0000192.PHONY: winapi_check
193
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000194# Rules for dependencies
195
196$(SUBDIRS:%=%/__depend__): $(MAKEDEP) dummy
197 cd `dirname $@` && $(MAKE) depend
198
Alexandre Julliardad533832002-05-14 20:54:58 +0000199depend: $(MAKEDEP) $(SUBDIRS:%=%/__depend__)
Alexandre Julliardfc094232003-04-14 21:46:41 +0000200 $(MAKEDEP) $(INCLUDES) -C$(SRCDIR) $(C_SRCS) $(C_SRCS16) $(RC_SRCS) $(RC_SRCS16) $(MC_SRCS) $(IDL_SRCS) $(EXTRA_SRCS)
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000201
Alexandre Julliardf673b712002-06-14 23:48:27 +0000202.PHONY: depend $(SUBDIRS:%=%/__depend__)
203
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000204# Rules for cleaning
205
206$(SUBDIRS:%=%/__clean__): dummy
207 cd `dirname $@` && $(MAKE) clean
208
Alexandre Julliard13b0c092002-01-10 03:30:21 +0000209$(SUBDIRS:%=%/__testclean__): dummy
210 cd `dirname $@` && $(MAKE) testclean
211
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000212$(EXTRASUBDIRS:%=%/__clean__): dummy
213 -cd `dirname $@` && $(RM) $(CLEAN_FILES)
214
Alexandre Julliard13b0c092002-01-10 03:30:21 +0000215testclean:: $(SUBDIRS:%=%/__testclean__)
Alexandre Julliard13b0c092002-01-10 03:30:21 +0000216
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000217clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
Dimitrie O. Paun54e6b0d2003-10-03 05:01:33 +0000218 $(RM) $(CLEAN_FILES) $(RC_SRCS:.rc=.res) $(RC_SRCS16:.rc=.res) $(MC_SRCS:.mc=.mc.rc) $(PROGRAMS) $(RC_BINARIES)
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000219
Alexandre Julliardf673b712002-06-14 23:48:27 +0000220.PHONY: clean testclean $(SUBDIRS:%=%/__clean__) $(SUBDIRS:%=%/__testclean__) $(EXTRASUBDIRS:%=%/__clean__)
221
Alexandre Julliard2f158c22000-06-14 21:45:38 +0000222# Rules for installing
223
Alexandre Julliard2d1c7902003-03-22 20:40:48 +0000224$(SUBDIRS:%=%/__install__): dummy
Alexandre Julliard2f158c22000-06-14 21:45:38 +0000225 cd `dirname $@` && $(MAKE) install
226
Alexandre Julliard2d1c7902003-03-22 20:40:48 +0000227$(SUBDIRS:%=%/__install-lib__): dummy
228 cd `dirname $@` && $(MAKE) install-lib
229
230$(SUBDIRS:%=%/__install-dev__): dummy
231 cd `dirname $@` && $(MAKE) install-dev
232
233$(SUBDIRS:%=%/__uninstall__): dummy
Alexandre Julliard2f158c22000-06-14 21:45:38 +0000234 cd `dirname $@` && $(MAKE) uninstall
235
Alexandre Julliardf673b712002-06-14 23:48:27 +0000236install:: $(INSTALLSUBDIRS:%=%/__install__)
237
238uninstall:: $(INSTALLSUBDIRS:%=%/__uninstall__)
239
Alexandre Julliardada5e652002-12-12 22:03:14 +0000240.PHONY: install install-lib install-dev uninstall \
Alexandre Julliard2d1c7902003-03-22 20:40:48 +0000241 $(SUBDIRS:%=%/__install__) $(SUBDIRS:%=%/__uninstall__) \
242 $(SUBDIRS:%=%/__install-lib__) $(SUBDIRS:%=%/__install-dev__)
Alexandre Julliardf673b712002-06-14 23:48:27 +0000243
Alexandre Julliardedeee892002-08-09 01:22:40 +0000244# Rules for checking that no imports are missing
Alexandre Julliard13b0c092002-01-10 03:30:21 +0000245
Alexandre Julliardedeee892002-08-09 01:22:40 +0000246$(SUBDIRS:%=%/__checklink__): dummy
247 @cd `dirname $@` && $(MAKE) checklink
248
249.PHONY: checklink $(SUBDIRS:%=%/__checklink__)
250
251# Rules for testing
Alexandre Julliard13b0c092002-01-10 03:30:21 +0000252
Alexandre Julliardd7c606d2002-04-02 02:58:45 +0000253$(SUBDIRS:%=%/__test__): dummy
254 @cd `dirname $@` && $(MAKE) test
255
Alexandre Julliardc3c587e2002-09-06 19:46:00 +0000256$(SUBDIRS:%=%/__crosstest__): dummy
257 @cd `dirname $@` && $(MAKE) crosstest
258
259.PHONY: check test crosstest $(SUBDIRS:%=%/__test__) $(SUBDIRS:%=%/__crosstest__)
Alexandre Julliardf673b712002-06-14 23:48:27 +0000260
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000261# Misc. rules
262
Alexandre Julliard017a61e2000-11-06 05:30:48 +0000263$(MC_SRCS:.mc=.mc.rc): $(WMC)
Alexandre Julliardf5aee672000-07-25 17:52:08 +0000264
Alexandre Julliardaa89ecc2003-04-11 00:38:56 +0000265$(IDL_SRCS:.idl=.h): $(WIDL)
266
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000267$(SUBDIRS): dummy
268 @cd $@ && $(MAKE)
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000269
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000270dummy:
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000271
Alexandre Julliardf673b712002-06-14 23:48:27 +0000272.PHONY: dummy $(SUBDIRS)
273
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000274# End of global rules