blob: 55d982d0ab97c1be8b1fe7e5852acb8ff9b8f342 [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 Julliard02e90081998-01-04 17:49:09 +000027LIBS = @LIBS@
Alexandre Julliardff8331e1995-09-18 11:19:54 +000028YACC = @YACC@
29LEX = @LEX@
30LEXLIB = @LEXLIB@
Alexandre Julliardfc01b722002-05-12 03:16:39 +000031EXEEXT = @EXEEXT@
32OBJEXT = @OBJEXT@
Alexandre Julliard2fa4f762000-10-31 00:20:51 +000033LIBEXT = @LIBEXT@
Alexandre Julliardc1bfca02002-03-20 22:19:06 +000034DLLEXT = @DLLEXT@
Alexandre Julliardada5e652002-12-12 22:03:14 +000035IMPLIBEXT = @IMPLIBEXT@
Alexandre Julliard2fa4f762000-10-31 00:20:51 +000036LDSHARED = @LDSHARED@
Alexandre Julliardada5e652002-12-12 22:03:14 +000037DLLTOOL = @DLLTOOL@
Hidenori Takeshimad48ca942000-12-22 22:28:00 +000038DLLWRAP = @DLLWRAP@
Alexandre Julliardfc01b722002-05-12 03:16:39 +000039AR = @AR@ rc
Alexandre Julliard641ee761997-08-04 16:34:36 +000040RANLIB = @RANLIB@
Alexandre Julliardfc01b722002-05-12 03:16:39 +000041STRIP = @STRIP@
42WINDRES = @WINDRES@
Alexandre Julliarddf234a92002-05-22 02:10:39 +000043LN = @LN@
Alexandre Julliard641ee761997-08-04 16:34:36 +000044LN_S = @LN_S@
Alexandre Julliardfc01b722002-05-12 03:16:39 +000045TOOLSDIR = @TOOLSDIR@
Marcus Meissner1d4db782003-01-09 00:46:54 +000046AS = @AS@
Alexandre Julliardeb5f89c2002-05-24 21:22:10 +000047LD = @LD@
Marcus Meissnera387aa42000-09-26 23:09:47 +000048LDFLAGS = @LDFLAGS@
Alexandre Julliardeb5f89c2002-05-24 21:22:10 +000049LDCOMBINE = $(LD) -r
Alexandre Julliardff8331e1995-09-18 11:19:54 +000050RM = rm -f
Patrik Stridvalla9be64e1999-07-31 17:39:44 +000051MV = mv
Alexandre Julliardc7c217b1998-04-13 12:21:30 +000052C2MAN = @C2MAN@
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@
57ALLCFLAGS = $(INCLUDES) $(DEFS) $(EXTRACFLAGS) $(CFLAGS)
58ALLLINTFLAGS = $(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
Dimitrie O. Paune39e8a12002-11-11 20:25:54 +000062RUNTEST = $(TOPSRCDIR)/tools/runtest
Alexandre Julliardfc01b722002-05-12 03:16:39 +000063WINEBUILD = $(TOOLSDIR)/tools/winebuild/winebuild
64MAKEDEP = $(TOOLSDIR)/tools/makedep
65WRC = $(TOOLSDIR)/tools/wrc/wrc
66WMC = $(TOOLSDIR)/tools/wmc/wmc
Alexandre Julliarded2f8fc2002-12-03 23:36:05 +000067WIDL = $(TOOLSDIR)/tools/widl/widl
Dimitrie O. Paun1a1f9bf2003-05-06 18:34:53 +000068RC = $(WRC)
69RC16 = $(WRC)
70RCFLAGS = --nostdinc $(INCLUDES) $(EXTRARCFLAGS)
71RC16FLAGS = -O res16 $(RCFLAGS)
Alexandre Julliard2a93f852002-12-11 01:34:51 +000072LDPATH = @LDPATH@
73DLLDIR = $(TOPOBJDIR)/dlls
Alexandre Julliarde1a9b102003-05-01 03:16:21 +000074LIBDIR = $(TOPOBJDIR)/libs
Alexandre Julliard6a9fe362003-03-19 22:09:16 +000075LIBPORT = -L$(TOPOBJDIR)/libs/port -lwine_port
Alexandre Julliard7ab9a712003-03-21 05:06:48 +000076LIBUNICODE = -L$(TOPOBJDIR)/libs/unicode -lwine_unicode
Alexandre Julliard6692d392003-03-20 01:30:11 +000077LIBUUID = -L$(TOPOBJDIR)/libs/uuid -lwine_uuid
Alexandre Julliard2d1c7902003-03-22 20:40:48 +000078LIBWINE = -L$(TOPOBJDIR)/libs/wine -lwine
Alexandre Julliardb0182392000-12-06 00:04:10 +000079
Alexandre Julliardff8331e1995-09-18 11:19:54 +000080@SET_MAKE@
81
Alexandre Julliard641ee761997-08-04 16:34:36 +000082# Installation infos
83
Alexandre Julliardf673b712002-06-14 23:48:27 +000084INSTALL = @INSTALL@ $(INSTALL_FLAGS)
85INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(INSTALL_PROGRAM_FLAGS)
86INSTALL_SCRIPT = @INSTALL_SCRIPT@ $(INSTALL_SCRIPT_FLAGS)
87INSTALL_DATA = @INSTALL_DATA@ $(INSTALL_DATA_FLAGS)
Alexandre Julliard641ee761997-08-04 16:34:36 +000088prefix = @prefix@
89exec_prefix = @exec_prefix@
90bindir = @bindir@
91libdir = @libdir@
Alexandre Julliard1d8d0172002-08-02 19:34:21 +000092datadir = @datadir@
Alexandre Julliard641ee761997-08-04 16:34:36 +000093infodir = @infodir@
Alexandre Julliardd6baf1b1999-07-18 15:47:22 +000094mandir = @mandir@
Alexandre Julliard9bb05fc2002-05-14 18:36:54 +000095sysconfdir = @sysconfdir@
96includedir = @includedir@/wine
Alexandre Julliardc1bfca02002-03-20 22:19:06 +000097dlldir = @libdir@/wine
Alexandre Julliardd6baf1b1999-07-18 15:47:22 +000098prog_manext = 1
Jon Griffiths35345f22003-03-15 19:48:34 +000099api_manext = 3w
Alexandre Julliardd6baf1b1999-07-18 15:47:22 +0000100conf_manext = 5
Alexandre Julliardfc01b722002-05-12 03:16:39 +0000101CLEAN_FILES = *.o *.a *.so *.ln *.$(LIBEXT) \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej \
Alexandre Julliardad533832002-05-14 20:54:58 +0000102 *.flc *.spec.c *.spec.def *.glue.c *.dbg.c y.tab.c y.tab.h @LEX_OUTPUT_ROOT@.c core
Alexandre Julliard641ee761997-08-04 16:34:36 +0000103
Alexandre Julliardc728efc2002-10-02 02:34:09 +0000104OBJS = $(C_SRCS:.c=.o) $(EXTRA_OBJS)
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000105
Steven Edwards9138fbb2002-07-29 23:28:09 +0000106RCOBJS = $(RC_SRCS:.rc=.res.o)
107LINTS = $(C_SRCS:.c=.ln)
Patrik Stridvalla9be64e1999-07-31 17:39:44 +0000108
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000109# Implicit rules
110
Alexandre Julliard21ee3292003-04-21 22:52:31 +0000111.SUFFIXES: .mc .rc .mc.rc .res .res.o .spec .spec.c .spec.def .ok
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000112
113.c.o:
François Gouget1c3a2422001-11-09 19:15:51 +0000114 $(CC) -c $(ALLCFLAGS) -o $@ $<
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000115
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +0000116.s.o:
François Gouget1c3a2422001-11-09 19:15:51 +0000117 $(AS) -o $@ $<
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +0000118
Alexandre Julliard017a61e2000-11-06 05:30:48 +0000119.mc.mc.rc:
Martin Fuchs3f441672002-10-19 17:15:00 +0000120 $(LDPATH) $(WMC) -i -U -H /dev/null -o $@ $<
Alexandre Julliardf5aee672000-07-25 17:52:08 +0000121
Alexandre Julliarda845b881998-06-01 10:44:35 +0000122.rc.res:
Dimitrie O. Paun1a1f9bf2003-05-06 18:34:53 +0000123 $(LDPATH) $(RC) $(RCFLAGS) -fo$@ $<
Alexandre Julliarda845b881998-06-01 10:44:35 +0000124
Alexandre Julliardfc01b722002-05-12 03:16:39 +0000125.res.res.o:
126 $(WINDRES) -i $< -o $@
127
Ulrich Weigand3dff7bb1999-07-11 13:58:31 +0000128.spec.spec.c:
Alexandre Julliard2e12d332003-04-21 23:54:05 +0000129 $(WINEBUILD) $(DEFS) -o $@ --main-module $(MODULE) --spec $<
Ulrich Weigand3dff7bb1999-07-11 13:58:31 +0000130
Dmitry Timoshkov93a5b862002-02-04 18:48:18 +0000131.spec.spec.def:
Alexandre Julliard2e12d332003-04-21 23:54:05 +0000132 $(WINEBUILD) $(DEFS) -o $@ --def $<
Dmitry Timoshkov93a5b862002-02-04 18:48:18 +0000133
Patrik Stridvalla9be64e1999-07-31 17:39:44 +0000134.c.ln:
135 $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
136
Alexandre Julliardcaa03382002-02-20 19:03:59 +0000137.c.ok:
Alexandre Julliardedeee892002-08-09 01:22:40 +0000138 $(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
Alexandre Julliardcaa03382002-02-20 19:03:59 +0000139
Alexandre Julliardd0edc5f2000-03-04 22:31:27 +0000140# 'all' target first in case the enclosing Makefile didn't define any target
141
142all: Makefile
143
Patrik Stridvallb7190292001-07-29 20:20:13 +0000144filter:
145 @$(TOPSRCDIR)/tools/winapi/make_filter --make $(MAKE) all
146
Alexandre Julliardf673b712002-06-14 23:48:27 +0000147.PHONY: all filter
148
Alexandre Julliardad533832002-05-14 20:54:58 +0000149# Rule for main module debug channels
150
Alexandre Julliardc728efc2002-10-02 02:34:09 +0000151$(MODULE).dbg.c: $(C_SRCS) $(C_SRCS16) $(WINEBUILD)
Alexandre Julliard2e12d332003-04-21 23:54:05 +0000152 $(WINEBUILD) $(DEFS) -o $@ --debug -C$(SRCDIR) $(C_SRCS) $(C_SRCS16)
Alexandre Julliarda845b881998-06-01 10:44:35 +0000153
Alexandre Julliard526531e2002-08-01 18:36:58 +0000154# Rule to rebuild the tools
Bertho Stultiens30855912000-06-13 04:34:41 +0000155
Alexandre Julliarde048ada2003-03-23 20:00:02 +0000156$(MAKEDEP):
Alexandre Julliard526531e2002-08-01 18:36:58 +0000157 cd $(TOOLSDIR)/tools && $(MAKE) `basename $@`
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000158
Alexandre Julliarde66d4211999-03-14 15:22:29 +0000159# Rules for makefile
160
Marcus Meissnerca004e51999-01-03 12:26:22 +0000161Makefile: Makefile.in $(TOPSRCDIR)/configure
162 @echo Makefile is older than $?, please rerun $(TOPSRCDIR)/configure
163 @exit 1
164
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000165# Rule for linting
166
Patrik Stridvalla9be64e1999-07-31 17:39:44 +0000167$(MODULE).ln : $(LINTS)
168 if test "$(LINTS)" ; \
169 then \
170 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
171 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
172 else \
173 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
174 fi
175
176lint:: $(MODULE).ln
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000177
Patrik Stridvall385dc181999-09-29 10:24:19 +0000178# Rules for Windows API checking
179
Alexandre Julliardf673b712002-06-14 23:48:27 +0000180winapi_check:: dummy
Patrik Stridvall385dc181999-09-29 10:24:19 +0000181 $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
182
Alexandre Julliardf673b712002-06-14 23:48:27 +0000183.PHONY: winapi_check
184
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000185# Rules for dependencies
186
187$(SUBDIRS:%=%/__depend__): $(MAKEDEP) dummy
188 cd `dirname $@` && $(MAKE) depend
189
Alexandre Julliardad533832002-05-14 20:54:58 +0000190depend: $(MAKEDEP) $(SUBDIRS:%=%/__depend__)
Alexandre Julliardfc094232003-04-14 21:46:41 +0000191 $(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 +0000192
Alexandre Julliardf673b712002-06-14 23:48:27 +0000193.PHONY: depend $(SUBDIRS:%=%/__depend__)
194
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000195# Rules for cleaning
196
197$(SUBDIRS:%=%/__clean__): dummy
198 cd `dirname $@` && $(MAKE) clean
199
Alexandre Julliard13b0c092002-01-10 03:30:21 +0000200$(SUBDIRS:%=%/__testclean__): dummy
201 cd `dirname $@` && $(MAKE) testclean
202
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000203$(EXTRASUBDIRS:%=%/__clean__): dummy
204 -cd `dirname $@` && $(RM) $(CLEAN_FILES)
205
Alexandre Julliard13b0c092002-01-10 03:30:21 +0000206testclean:: $(SUBDIRS:%=%/__testclean__)
Alexandre Julliard13b0c092002-01-10 03:30:21 +0000207
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000208clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
Alexandre Julliardc728efc2002-10-02 02:34:09 +0000209 $(RM) $(CLEAN_FILES) $(RC_SRCS:.rc=.res) $(RC_SRCS16:.rc=.res) $(MC_SRCS:.mc=.mc.rc) $(PROGRAMS)
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000210
Alexandre Julliardf673b712002-06-14 23:48:27 +0000211.PHONY: clean testclean $(SUBDIRS:%=%/__clean__) $(SUBDIRS:%=%/__testclean__) $(EXTRASUBDIRS:%=%/__clean__)
212
Alexandre Julliard2f158c22000-06-14 21:45:38 +0000213# Rules for installing
214
Alexandre Julliard2d1c7902003-03-22 20:40:48 +0000215$(SUBDIRS:%=%/__install__): dummy
Alexandre Julliard2f158c22000-06-14 21:45:38 +0000216 cd `dirname $@` && $(MAKE) install
217
Alexandre Julliard2d1c7902003-03-22 20:40:48 +0000218$(SUBDIRS:%=%/__install-lib__): dummy
219 cd `dirname $@` && $(MAKE) install-lib
220
221$(SUBDIRS:%=%/__install-dev__): dummy
222 cd `dirname $@` && $(MAKE) install-dev
223
224$(SUBDIRS:%=%/__uninstall__): dummy
Alexandre Julliard2f158c22000-06-14 21:45:38 +0000225 cd `dirname $@` && $(MAKE) uninstall
226
Alexandre Julliardf673b712002-06-14 23:48:27 +0000227install:: $(INSTALLSUBDIRS:%=%/__install__)
228
229uninstall:: $(INSTALLSUBDIRS:%=%/__uninstall__)
230
Alexandre Julliardada5e652002-12-12 22:03:14 +0000231.PHONY: install install-lib install-dev uninstall \
Alexandre Julliard2d1c7902003-03-22 20:40:48 +0000232 $(SUBDIRS:%=%/__install__) $(SUBDIRS:%=%/__uninstall__) \
233 $(SUBDIRS:%=%/__install-lib__) $(SUBDIRS:%=%/__install-dev__)
Alexandre Julliardf673b712002-06-14 23:48:27 +0000234
Alexandre Julliardedeee892002-08-09 01:22:40 +0000235# Rules for checking that no imports are missing
Alexandre Julliard13b0c092002-01-10 03:30:21 +0000236
Alexandre Julliardedeee892002-08-09 01:22:40 +0000237$(SUBDIRS:%=%/__checklink__): dummy
238 @cd `dirname $@` && $(MAKE) checklink
239
240.PHONY: checklink $(SUBDIRS:%=%/__checklink__)
241
242# Rules for testing
Alexandre Julliard13b0c092002-01-10 03:30:21 +0000243
Alexandre Julliardd7c606d2002-04-02 02:58:45 +0000244$(SUBDIRS:%=%/__test__): dummy
245 @cd `dirname $@` && $(MAKE) test
246
Alexandre Julliardc3c587e2002-09-06 19:46:00 +0000247$(SUBDIRS:%=%/__crosstest__): dummy
248 @cd `dirname $@` && $(MAKE) crosstest
249
250.PHONY: check test crosstest $(SUBDIRS:%=%/__test__) $(SUBDIRS:%=%/__crosstest__)
Alexandre Julliardf673b712002-06-14 23:48:27 +0000251
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000252# Misc. rules
253
Dimitrie O. Paun1a1f9bf2003-05-06 18:34:53 +0000254$(RC_SRCS:.rc=.res) $(RC_SRCS16:.rc=.res): $(WRC)
Dmitry Timoshkovdb790452001-05-31 21:37:29 +0000255
Alexandre Julliard017a61e2000-11-06 05:30:48 +0000256$(MC_SRCS:.mc=.mc.rc): $(WMC)
Alexandre Julliardf5aee672000-07-25 17:52:08 +0000257
Alexandre Julliardaa89ecc2003-04-11 00:38:56 +0000258$(IDL_SRCS:.idl=.h): $(WIDL)
259
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000260$(SUBDIRS): dummy
261 @cd $@ && $(MAKE)
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000262
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000263dummy:
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000264
Alexandre Julliardf673b712002-06-14 23:48:27 +0000265.PHONY: dummy $(SUBDIRS)
266
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000267# End of global rules