blob: c4b70ac0947cf7327d68ffd654034d8981eb234b [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 Julliardd7d4fdf1995-12-26 15:05:24 +000025CPP = @CPP@
Alexandre Julliardfc094232003-04-14 21:46:41 +000026CFLAGS = @CFLAGS@
Alexandre Julliard15566392003-06-13 23:26:01 +000027CPPFLAGS = @CPPFLAGS@
Alexandre Julliard02e90081998-01-04 17:49:09 +000028LIBS = @LIBS@
Alexandre Julliardff8331e1995-09-18 11:19:54 +000029YACC = @YACC@
30LEX = @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 Julliardeb5f89c2002-05-24 21:22:10 +000050LDCOMBINE = $(LD) -r
Alexandre Julliardff8331e1995-09-18 11:19:54 +000051RM = rm -f
Patrik Stridvalla9be64e1999-07-31 17:39:44 +000052MV = mv
Patrik Stridvalla9be64e1999-07-31 17:39:44 +000053LINT = @LINT@
54LINTFLAGS = @LINTFLAGS@
Alexandre Julliardfc094232003-04-14 21:46:41 +000055INCLUDES = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include $(EXTRAINCL)
56EXTRACFLAGS = @EXTRACFLAGS@
Alexandre Julliard15566392003-06-13 23:26:01 +000057ALLCFLAGS = $(INCLUDES) $(DEFS) $(EXTRACFLAGS) $(CPPFLAGS) $(CFLAGS)
Alexandre Julliardfc094232003-04-14 21:46:41 +000058ALLLINTFLAGS = $(INCLUDES) $(DEFS) $(LINTFLAGS)
59MKINSTALLDIRS= $(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
67WMC = $(TOOLSDIR)/tools/wmc/wmc
Alexandre Julliarded2f8fc2002-12-03 23:36:05 +000068WIDL = $(TOOLSDIR)/tools/widl/widl
Dimitrie O. Paun1a1f9bf2003-05-06 18:34:53 +000069RC = $(WRC)
70RC16 = $(WRC)
71RCFLAGS = --nostdinc $(INCLUDES) $(EXTRARCFLAGS)
72RC16FLAGS = -O res16 $(RCFLAGS)
Alexandre Julliard2a93f852002-12-11 01:34:51 +000073LDPATH = @LDPATH@
74DLLDIR = $(TOPOBJDIR)/dlls
Alexandre Julliarde1a9b102003-05-01 03:16:21 +000075LIBDIR = $(TOPOBJDIR)/libs
Alexandre Julliard6a9fe362003-03-19 22:09:16 +000076LIBPORT = -L$(TOPOBJDIR)/libs/port -lwine_port
Alexandre Julliard7ab9a712003-03-21 05:06:48 +000077LIBUNICODE = -L$(TOPOBJDIR)/libs/unicode -lwine_unicode
Alexandre Julliard6692d392003-03-20 01:30:11 +000078LIBUUID = -L$(TOPOBJDIR)/libs/uuid -lwine_uuid
Alexandre Julliard2d1c7902003-03-22 20:40:48 +000079LIBWINE = -L$(TOPOBJDIR)/libs/wine -lwine
Alexandre Julliardb0182392000-12-06 00:04:10 +000080
Alexandre Julliardff8331e1995-09-18 11:19:54 +000081@SET_MAKE@
82
Alexandre Julliard641ee761997-08-04 16:34:36 +000083# Installation infos
84
Alexandre Julliardf673b712002-06-14 23:48:27 +000085INSTALL = @INSTALL@ $(INSTALL_FLAGS)
86INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(INSTALL_PROGRAM_FLAGS)
87INSTALL_SCRIPT = @INSTALL_SCRIPT@ $(INSTALL_SCRIPT_FLAGS)
88INSTALL_DATA = @INSTALL_DATA@ $(INSTALL_DATA_FLAGS)
Alexandre Julliard641ee761997-08-04 16:34:36 +000089prefix = @prefix@
90exec_prefix = @exec_prefix@
91bindir = @bindir@
92libdir = @libdir@
Alexandre Julliard1d8d0172002-08-02 19:34:21 +000093datadir = @datadir@
Alexandre Julliard641ee761997-08-04 16:34:36 +000094infodir = @infodir@
Alexandre Julliardd6baf1b1999-07-18 15:47:22 +000095mandir = @mandir@
Alexandre Julliard9bb05fc2002-05-14 18:36:54 +000096sysconfdir = @sysconfdir@
97includedir = @includedir@/wine
Alexandre Julliardc1bfca02002-03-20 22:19:06 +000098dlldir = @libdir@/wine
Alexandre Julliardd6baf1b1999-07-18 15:47:22 +000099prog_manext = 1
Jon Griffiths35345f22003-03-15 19:48:34 +0000100api_manext = 3w
Alexandre Julliardd6baf1b1999-07-18 15:47:22 +0000101conf_manext = 5
Alexandre Julliardfc01b722002-05-12 03:16:39 +0000102CLEAN_FILES = *.o *.a *.so *.ln *.$(LIBEXT) \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej \
Alexandre Julliardaf62e832003-08-23 00:45:20 +0000103 *.flc *.spec.c *.spec.def *.dbg.c y.tab.c y.tab.h @LEX_OUTPUT_ROOT@.c core
Alexandre Julliard641ee761997-08-04 16:34:36 +0000104
Alexandre Julliardc728efc2002-10-02 02:34:09 +0000105OBJS = $(C_SRCS:.c=.o) $(EXTRA_OBJS)
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000106
Steven Edwards9138fbb2002-07-29 23:28:09 +0000107RCOBJS = $(RC_SRCS:.rc=.res.o)
108LINTS = $(C_SRCS:.c=.ln)
Patrik Stridvalla9be64e1999-07-31 17:39:44 +0000109
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000110# Implicit rules
111
Alexandre Julliard21ee3292003-04-21 22:52:31 +0000112.SUFFIXES: .mc .rc .mc.rc .res .res.o .spec .spec.c .spec.def .ok
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000113
114.c.o:
François Gouget1c3a2422001-11-09 19:15:51 +0000115 $(CC) -c $(ALLCFLAGS) -o $@ $<
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000116
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +0000117.s.o:
François Gouget1c3a2422001-11-09 19:15:51 +0000118 $(AS) -o $@ $<
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +0000119
Alexandre Julliard017a61e2000-11-06 05:30:48 +0000120.mc.mc.rc:
Martin Fuchs3f441672002-10-19 17:15:00 +0000121 $(LDPATH) $(WMC) -i -U -H /dev/null -o $@ $<
Alexandre Julliardf5aee672000-07-25 17:52:08 +0000122
Alexandre Julliarda845b881998-06-01 10:44:35 +0000123.rc.res:
Dimitrie O. Paun1a1f9bf2003-05-06 18:34:53 +0000124 $(LDPATH) $(RC) $(RCFLAGS) -fo$@ $<
Alexandre Julliarda845b881998-06-01 10:44:35 +0000125
Alexandre Julliardfc01b722002-05-12 03:16:39 +0000126.res.res.o:
127 $(WINDRES) -i $< -o $@
128
Ulrich Weigand3dff7bb1999-07-11 13:58:31 +0000129.spec.spec.c:
Alexandre Julliard2e12d332003-04-21 23:54:05 +0000130 $(WINEBUILD) $(DEFS) -o $@ --main-module $(MODULE) --spec $<
Ulrich Weigand3dff7bb1999-07-11 13:58:31 +0000131
Dmitry Timoshkov93a5b862002-02-04 18:48:18 +0000132.spec.spec.def:
Alexandre Julliard2e12d332003-04-21 23:54:05 +0000133 $(WINEBUILD) $(DEFS) -o $@ --def $<
Dmitry Timoshkov93a5b862002-02-04 18:48:18 +0000134
Patrik Stridvalla9be64e1999-07-31 17:39:44 +0000135.c.ln:
136 $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
137
Alexandre Julliardcaa03382002-02-20 19:03:59 +0000138.c.ok:
Alexandre Julliardedeee892002-08-09 01:22:40 +0000139 $(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
Alexandre Julliardcaa03382002-02-20 19:03:59 +0000140
Alexandre Julliardd0edc5f2000-03-04 22:31:27 +0000141# 'all' target first in case the enclosing Makefile didn't define any target
142
143all: Makefile
144
Patrik Stridvallb7190292001-07-29 20:20:13 +0000145filter:
146 @$(TOPSRCDIR)/tools/winapi/make_filter --make $(MAKE) all
147
Alexandre Julliardf673b712002-06-14 23:48:27 +0000148.PHONY: all filter
149
Alexandre Julliardad533832002-05-14 20:54:58 +0000150# Rule for main module debug channels
151
Alexandre Julliardc728efc2002-10-02 02:34:09 +0000152$(MODULE).dbg.c: $(C_SRCS) $(C_SRCS16) $(WINEBUILD)
Alexandre Julliard2e12d332003-04-21 23:54:05 +0000153 $(WINEBUILD) $(DEFS) -o $@ --debug -C$(SRCDIR) $(C_SRCS) $(C_SRCS16)
Alexandre Julliarda845b881998-06-01 10:44:35 +0000154
Alexandre Julliard526531e2002-08-01 18:36:58 +0000155# Rule to rebuild the tools
Bertho Stultiens30855912000-06-13 04:34:41 +0000156
Alexandre Julliarde048ada2003-03-23 20:00:02 +0000157$(MAKEDEP):
Alexandre Julliard526531e2002-08-01 18:36:58 +0000158 cd $(TOOLSDIR)/tools && $(MAKE) `basename $@`
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000159
Alexandre Julliarde66d4211999-03-14 15:22:29 +0000160# Rules for makefile
161
Marcus Meissnerca004e51999-01-03 12:26:22 +0000162Makefile: Makefile.in $(TOPSRCDIR)/configure
163 @echo Makefile is older than $?, please rerun $(TOPSRCDIR)/configure
164 @exit 1
165
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000166# Rule for linting
167
Patrik Stridvalla9be64e1999-07-31 17:39:44 +0000168$(MODULE).ln : $(LINTS)
169 if test "$(LINTS)" ; \
170 then \
171 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
172 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
173 else \
174 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
175 fi
176
177lint:: $(MODULE).ln
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000178
Patrik Stridvall385dc181999-09-29 10:24:19 +0000179# Rules for Windows API checking
180
Alexandre Julliardf673b712002-06-14 23:48:27 +0000181winapi_check:: dummy
Patrik Stridvall385dc181999-09-29 10:24:19 +0000182 $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
183
Alexandre Julliardf673b712002-06-14 23:48:27 +0000184.PHONY: winapi_check
185
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000186# Rules for dependencies
187
188$(SUBDIRS:%=%/__depend__): $(MAKEDEP) dummy
189 cd `dirname $@` && $(MAKE) depend
190
Alexandre Julliardad533832002-05-14 20:54:58 +0000191depend: $(MAKEDEP) $(SUBDIRS:%=%/__depend__)
Alexandre Julliardfc094232003-04-14 21:46:41 +0000192 $(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 +0000193
Alexandre Julliardf673b712002-06-14 23:48:27 +0000194.PHONY: depend $(SUBDIRS:%=%/__depend__)
195
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000196# Rules for cleaning
197
198$(SUBDIRS:%=%/__clean__): dummy
199 cd `dirname $@` && $(MAKE) clean
200
Alexandre Julliard13b0c092002-01-10 03:30:21 +0000201$(SUBDIRS:%=%/__testclean__): dummy
202 cd `dirname $@` && $(MAKE) testclean
203
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000204$(EXTRASUBDIRS:%=%/__clean__): dummy
205 -cd `dirname $@` && $(RM) $(CLEAN_FILES)
206
Alexandre Julliard13b0c092002-01-10 03:30:21 +0000207testclean:: $(SUBDIRS:%=%/__testclean__)
Alexandre Julliard13b0c092002-01-10 03:30:21 +0000208
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000209clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
Alexandre Julliardc728efc2002-10-02 02:34:09 +0000210 $(RM) $(CLEAN_FILES) $(RC_SRCS:.rc=.res) $(RC_SRCS16:.rc=.res) $(MC_SRCS:.mc=.mc.rc) $(PROGRAMS)
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000211
Alexandre Julliardf673b712002-06-14 23:48:27 +0000212.PHONY: clean testclean $(SUBDIRS:%=%/__clean__) $(SUBDIRS:%=%/__testclean__) $(EXTRASUBDIRS:%=%/__clean__)
213
Alexandre Julliard2f158c22000-06-14 21:45:38 +0000214# Rules for installing
215
Alexandre Julliard2d1c7902003-03-22 20:40:48 +0000216$(SUBDIRS:%=%/__install__): dummy
Alexandre Julliard2f158c22000-06-14 21:45:38 +0000217 cd `dirname $@` && $(MAKE) install
218
Alexandre Julliard2d1c7902003-03-22 20:40:48 +0000219$(SUBDIRS:%=%/__install-lib__): dummy
220 cd `dirname $@` && $(MAKE) install-lib
221
222$(SUBDIRS:%=%/__install-dev__): dummy
223 cd `dirname $@` && $(MAKE) install-dev
224
225$(SUBDIRS:%=%/__uninstall__): dummy
Alexandre Julliard2f158c22000-06-14 21:45:38 +0000226 cd `dirname $@` && $(MAKE) uninstall
227
Alexandre Julliardf673b712002-06-14 23:48:27 +0000228install:: $(INSTALLSUBDIRS:%=%/__install__)
229
230uninstall:: $(INSTALLSUBDIRS:%=%/__uninstall__)
231
Alexandre Julliardada5e652002-12-12 22:03:14 +0000232.PHONY: install install-lib install-dev uninstall \
Alexandre Julliard2d1c7902003-03-22 20:40:48 +0000233 $(SUBDIRS:%=%/__install__) $(SUBDIRS:%=%/__uninstall__) \
234 $(SUBDIRS:%=%/__install-lib__) $(SUBDIRS:%=%/__install-dev__)
Alexandre Julliardf673b712002-06-14 23:48:27 +0000235
Alexandre Julliardedeee892002-08-09 01:22:40 +0000236# Rules for checking that no imports are missing
Alexandre Julliard13b0c092002-01-10 03:30:21 +0000237
Alexandre Julliardedeee892002-08-09 01:22:40 +0000238$(SUBDIRS:%=%/__checklink__): dummy
239 @cd `dirname $@` && $(MAKE) checklink
240
241.PHONY: checklink $(SUBDIRS:%=%/__checklink__)
242
243# Rules for testing
Alexandre Julliard13b0c092002-01-10 03:30:21 +0000244
Alexandre Julliardd7c606d2002-04-02 02:58:45 +0000245$(SUBDIRS:%=%/__test__): dummy
246 @cd `dirname $@` && $(MAKE) test
247
Alexandre Julliardc3c587e2002-09-06 19:46:00 +0000248$(SUBDIRS:%=%/__crosstest__): dummy
249 @cd `dirname $@` && $(MAKE) crosstest
250
251.PHONY: check test crosstest $(SUBDIRS:%=%/__test__) $(SUBDIRS:%=%/__crosstest__)
Alexandre Julliardf673b712002-06-14 23:48:27 +0000252
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000253# Misc. rules
254
Dimitrie O. Paun1a1f9bf2003-05-06 18:34:53 +0000255$(RC_SRCS:.rc=.res) $(RC_SRCS16:.rc=.res): $(WRC)
Dmitry Timoshkovdb790452001-05-31 21:37:29 +0000256
Alexandre Julliard017a61e2000-11-06 05:30:48 +0000257$(MC_SRCS:.mc=.mc.rc): $(WMC)
Alexandre Julliardf5aee672000-07-25 17:52:08 +0000258
Alexandre Julliardaa89ecc2003-04-11 00:38:56 +0000259$(IDL_SRCS:.idl=.h): $(WIDL)
260
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000261$(SUBDIRS): dummy
262 @cd $@ && $(MAKE)
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000263
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000264dummy:
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000265
Alexandre Julliardf673b712002-06-14 23:48:27 +0000266.PHONY: dummy $(SUBDIRS)
267
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000268# End of global rules