blob: 5c54adeae8224fd9875bda45b1558c81ab74954e [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 Julliard6ac34ac2003-10-11 01:05:18 +000038LDDLL = @LDDLL@
Alexandre Julliardada5e652002-12-12 22:03:14 +000039DLLTOOL = @DLLTOOL@
Hidenori Takeshimad48ca942000-12-22 22:28:00 +000040DLLWRAP = @DLLWRAP@
Alexandre Julliardfc01b722002-05-12 03:16:39 +000041AR = @AR@ rc
Alexandre Julliard641ee761997-08-04 16:34:36 +000042RANLIB = @RANLIB@
Alexandre Julliardfc01b722002-05-12 03:16:39 +000043STRIP = @STRIP@
44WINDRES = @WINDRES@
Alexandre Julliarddf234a92002-05-22 02:10:39 +000045LN = @LN@
Alexandre Julliard641ee761997-08-04 16:34:36 +000046LN_S = @LN_S@
Alexandre Julliardfc01b722002-05-12 03:16:39 +000047TOOLSDIR = @TOOLSDIR@
Marcus Meissner1d4db782003-01-09 00:46:54 +000048AS = @AS@
Alexandre Julliardeb5f89c2002-05-24 21:22:10 +000049LD = @LD@
Marcus Meissnera387aa42000-09-26 23:09:47 +000050LDFLAGS = @LDFLAGS@
Alexandre Julliardeb5f89c2002-05-24 21:22:10 +000051LDCOMBINE = $(LD) -r
Alexandre Julliardff8331e1995-09-18 11:19:54 +000052RM = rm -f
Patrik Stridvalla9be64e1999-07-31 17:39:44 +000053MV = mv
Patrik Stridvalla9be64e1999-07-31 17:39:44 +000054LINT = @LINT@
55LINTFLAGS = @LINTFLAGS@
Alexandre Julliardfc094232003-04-14 21:46:41 +000056INCLUDES = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include $(EXTRAINCL)
57EXTRACFLAGS = @EXTRACFLAGS@
Alexandre Julliard16cd8612003-09-24 19:01:44 +000058ALLCFLAGS = $(INCLUDES) $(DEFS) $(DLLFLAGS) $(EXTRACFLAGS) $(CPPFLAGS) $(CFLAGS)
Alexandre Julliardfc094232003-04-14 21:46:41 +000059ALLLINTFLAGS = $(INCLUDES) $(DEFS) $(LINTFLAGS)
Alexandre Julliard16cd8612003-09-24 19:01:44 +000060IDLFLAGS = $(INCLUDES) $(DEFS) $(EXTRAIDLFLAGS)
Alexandre Julliardfc094232003-04-14 21:46:41 +000061MKINSTALLDIRS= $(TOPSRCDIR)/tools/mkinstalldirs -m 755
Patrik Stridvall385dc181999-09-29 10:24:19 +000062WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi_check/winapi_check
Alexandre Julliard35363162002-05-22 21:32:49 +000063WINEWRAPPER = $(TOPSRCDIR)/tools/winewrapper
Richard Cohen6039fb02003-07-21 22:01:07 +000064C2MAN = $(TOPSRCDIR)/tools/c2man.pl
Dimitrie O. Paune39e8a12002-11-11 20:25:54 +000065RUNTEST = $(TOPSRCDIR)/tools/runtest
Alexandre Julliardfc01b722002-05-12 03:16:39 +000066WINEBUILD = $(TOOLSDIR)/tools/winebuild/winebuild
67MAKEDEP = $(TOOLSDIR)/tools/makedep
68WRC = $(TOOLSDIR)/tools/wrc/wrc
Dimitrie O. Paun54e6b0d2003-10-03 05:01:33 +000069BIN2RES = $(TOOLSDIR)/tools/bin2res
Alexandre Julliardfc01b722002-05-12 03:16:39 +000070WMC = $(TOOLSDIR)/tools/wmc/wmc
Alexandre Julliarded2f8fc2002-12-03 23:36:05 +000071WIDL = $(TOOLSDIR)/tools/widl/widl
Dimitrie O. Paun1a1f9bf2003-05-06 18:34:53 +000072RC = $(WRC)
73RC16 = $(WRC)
Alexandre Julliard49b9c762003-12-13 03:19:34 +000074RCFLAGS = --nostdinc $(INCLUDES) $(DEFS) $(EXTRARCFLAGS)
Dimitrie O. Paun1a1f9bf2003-05-06 18:34:53 +000075RC16FLAGS = -O res16 $(RCFLAGS)
Alexandre Julliard2a93f852002-12-11 01:34:51 +000076LDPATH = @LDPATH@
77DLLDIR = $(TOPOBJDIR)/dlls
Alexandre Julliarde1a9b102003-05-01 03:16:21 +000078LIBDIR = $(TOPOBJDIR)/libs
Alexandre Julliard6a9fe362003-03-19 22:09:16 +000079LIBPORT = -L$(TOPOBJDIR)/libs/port -lwine_port
Alexandre Julliard7ab9a712003-03-21 05:06:48 +000080LIBUNICODE = -L$(TOPOBJDIR)/libs/unicode -lwine_unicode
Alexandre Julliard6692d392003-03-20 01:30:11 +000081LIBUUID = -L$(TOPOBJDIR)/libs/uuid -lwine_uuid
Alexandre Julliard2d1c7902003-03-22 20:40:48 +000082LIBWINE = -L$(TOPOBJDIR)/libs/wine -lwine
Alexandre Julliardb0182392000-12-06 00:04:10 +000083
Alexandre Julliardff8331e1995-09-18 11:19:54 +000084@SET_MAKE@
85
Alexandre Julliard641ee761997-08-04 16:34:36 +000086# Installation infos
87
Alexandre Julliardf673b712002-06-14 23:48:27 +000088INSTALL = @INSTALL@ $(INSTALL_FLAGS)
89INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(INSTALL_PROGRAM_FLAGS)
90INSTALL_SCRIPT = @INSTALL_SCRIPT@ $(INSTALL_SCRIPT_FLAGS)
91INSTALL_DATA = @INSTALL_DATA@ $(INSTALL_DATA_FLAGS)
Alexandre Julliard641ee761997-08-04 16:34:36 +000092prefix = @prefix@
93exec_prefix = @exec_prefix@
94bindir = @bindir@
95libdir = @libdir@
Alexandre Julliard1d8d0172002-08-02 19:34:21 +000096datadir = @datadir@
Alexandre Julliard641ee761997-08-04 16:34:36 +000097infodir = @infodir@
Alexandre Julliardd6baf1b1999-07-18 15:47:22 +000098mandir = @mandir@
Alexandre Julliard9bb05fc2002-05-14 18:36:54 +000099sysconfdir = @sysconfdir@
100includedir = @includedir@/wine
Alexandre Julliardc1bfca02002-03-20 22:19:06 +0000101dlldir = @libdir@/wine
Alexandre Julliardd6baf1b1999-07-18 15:47:22 +0000102prog_manext = 1
Jon Griffiths35345f22003-03-15 19:48:34 +0000103api_manext = 3w
Alexandre Julliardd6baf1b1999-07-18 15:47:22 +0000104conf_manext = 5
Alexandre Julliardfc01b722002-05-12 03:16:39 +0000105CLEAN_FILES = *.o *.a *.so *.ln *.$(LIBEXT) \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej \
Alexandre Julliardaf62e832003-08-23 00:45:20 +0000106 *.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 +0000107
Alexandre Julliardc728efc2002-10-02 02:34:09 +0000108OBJS = $(C_SRCS:.c=.o) $(EXTRA_OBJS)
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000109
Steven Edwards9138fbb2002-07-29 23:28:09 +0000110RCOBJS = $(RC_SRCS:.rc=.res.o)
111LINTS = $(C_SRCS:.c=.ln)
Patrik Stridvalla9be64e1999-07-31 17:39:44 +0000112
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000113# Implicit rules
114
Alexandre Julliard21ee3292003-04-21 22:52:31 +0000115.SUFFIXES: .mc .rc .mc.rc .res .res.o .spec .spec.c .spec.def .ok
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000116
117.c.o:
François Gouget1c3a2422001-11-09 19:15:51 +0000118 $(CC) -c $(ALLCFLAGS) -o $@ $<
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000119
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +0000120.s.o:
François Gouget1c3a2422001-11-09 19:15:51 +0000121 $(AS) -o $@ $<
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +0000122
Alexandre Julliard017a61e2000-11-06 05:30:48 +0000123.mc.mc.rc:
Martin Fuchs3f441672002-10-19 17:15:00 +0000124 $(LDPATH) $(WMC) -i -U -H /dev/null -o $@ $<
Alexandre Julliardf5aee672000-07-25 17:52:08 +0000125
Alexandre Julliarda845b881998-06-01 10:44:35 +0000126.rc.res:
Dimitrie O. Paun1a1f9bf2003-05-06 18:34:53 +0000127 $(LDPATH) $(RC) $(RCFLAGS) -fo$@ $<
Alexandre Julliarda845b881998-06-01 10:44:35 +0000128
Alexandre Julliardfc01b722002-05-12 03:16:39 +0000129.res.res.o:
130 $(WINDRES) -i $< -o $@
131
Ulrich Weigand3dff7bb1999-07-11 13:58:31 +0000132.spec.spec.c:
Alexandre Julliard2e12d332003-04-21 23:54:05 +0000133 $(WINEBUILD) $(DEFS) -o $@ --main-module $(MODULE) --spec $<
Ulrich Weigand3dff7bb1999-07-11 13:58:31 +0000134
Dmitry Timoshkov93a5b862002-02-04 18:48:18 +0000135.spec.spec.def:
Alexandre Julliard2e12d332003-04-21 23:54:05 +0000136 $(WINEBUILD) $(DEFS) -o $@ --def $<
Dmitry Timoshkov93a5b862002-02-04 18:48:18 +0000137
Patrik Stridvalla9be64e1999-07-31 17:39:44 +0000138.c.ln:
139 $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
140
Alexandre Julliardcaa03382002-02-20 19:03:59 +0000141.c.ok:
Alexandre Julliardedeee892002-08-09 01:22:40 +0000142 $(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
Alexandre Julliardcaa03382002-02-20 19:03:59 +0000143
Alexandre Julliardd0edc5f2000-03-04 22:31:27 +0000144# 'all' target first in case the enclosing Makefile didn't define any target
145
146all: Makefile
147
Patrik Stridvallb7190292001-07-29 20:20:13 +0000148filter:
149 @$(TOPSRCDIR)/tools/winapi/make_filter --make $(MAKE) all
150
Alexandre Julliardf673b712002-06-14 23:48:27 +0000151.PHONY: all filter
152
Dimitrie O. Paun54e6b0d2003-10-03 05:01:33 +0000153# Rules for resources
154
155$(RC_BINARIES): $(BIN2RES) $(RC_BINSRC)
156 $(BIN2RES) -f -o $@ $(SRCDIR)/$(RC_BINSRC)
157
158$(RC_SRCS:.rc=.res) $(RC_SRCS16:.rc=.res): $(WRC) $(RC_BINARIES)
159
Alexandre Julliardad533832002-05-14 20:54:58 +0000160# Rule for main module debug channels
161
Alexandre Julliardc728efc2002-10-02 02:34:09 +0000162$(MODULE).dbg.c: $(C_SRCS) $(C_SRCS16) $(WINEBUILD)
Alexandre Julliard2e12d332003-04-21 23:54:05 +0000163 $(WINEBUILD) $(DEFS) -o $@ --debug -C$(SRCDIR) $(C_SRCS) $(C_SRCS16)
Alexandre Julliarda845b881998-06-01 10:44:35 +0000164
Alexandre Julliard526531e2002-08-01 18:36:58 +0000165# Rule to rebuild the tools
Bertho Stultiens30855912000-06-13 04:34:41 +0000166
Alexandre Julliarde048ada2003-03-23 20:00:02 +0000167$(MAKEDEP):
Alexandre Julliard526531e2002-08-01 18:36:58 +0000168 cd $(TOOLSDIR)/tools && $(MAKE) `basename $@`
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000169
Alexandre Julliarde66d4211999-03-14 15:22:29 +0000170# Rules for makefile
171
Marcus Meissnerca004e51999-01-03 12:26:22 +0000172Makefile: Makefile.in $(TOPSRCDIR)/configure
173 @echo Makefile is older than $?, please rerun $(TOPSRCDIR)/configure
174 @exit 1
175
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000176# Rule for linting
177
Patrik Stridvalla9be64e1999-07-31 17:39:44 +0000178$(MODULE).ln : $(LINTS)
179 if test "$(LINTS)" ; \
180 then \
181 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
182 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
183 else \
184 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
185 fi
186
187lint:: $(MODULE).ln
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000188
Patrik Stridvall385dc181999-09-29 10:24:19 +0000189# Rules for Windows API checking
190
Alexandre Julliardf673b712002-06-14 23:48:27 +0000191winapi_check:: dummy
Patrik Stridvall385dc181999-09-29 10:24:19 +0000192 $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
193
Alexandre Julliardf673b712002-06-14 23:48:27 +0000194.PHONY: winapi_check
195
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000196# Rules for dependencies
197
198$(SUBDIRS:%=%/__depend__): $(MAKEDEP) dummy
199 cd `dirname $@` && $(MAKE) depend
200
Alexandre Julliardad533832002-05-14 20:54:58 +0000201depend: $(MAKEDEP) $(SUBDIRS:%=%/__depend__)
Alexandre Julliardfc094232003-04-14 21:46:41 +0000202 $(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 +0000203
Alexandre Julliardf673b712002-06-14 23:48:27 +0000204.PHONY: depend $(SUBDIRS:%=%/__depend__)
205
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000206# Rules for cleaning
207
208$(SUBDIRS:%=%/__clean__): dummy
209 cd `dirname $@` && $(MAKE) clean
210
Alexandre Julliard13b0c092002-01-10 03:30:21 +0000211$(SUBDIRS:%=%/__testclean__): dummy
212 cd `dirname $@` && $(MAKE) testclean
213
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000214$(EXTRASUBDIRS:%=%/__clean__): dummy
215 -cd `dirname $@` && $(RM) $(CLEAN_FILES)
216
Alexandre Julliard13b0c092002-01-10 03:30:21 +0000217testclean:: $(SUBDIRS:%=%/__testclean__)
Alexandre Julliard13b0c092002-01-10 03:30:21 +0000218
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000219clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
Dimitrie O. Paun54e6b0d2003-10-03 05:01:33 +0000220 $(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 +0000221
Alexandre Julliardf673b712002-06-14 23:48:27 +0000222.PHONY: clean testclean $(SUBDIRS:%=%/__clean__) $(SUBDIRS:%=%/__testclean__) $(EXTRASUBDIRS:%=%/__clean__)
223
Alexandre Julliard2f158c22000-06-14 21:45:38 +0000224# Rules for installing
225
Alexandre Julliard2d1c7902003-03-22 20:40:48 +0000226$(SUBDIRS:%=%/__install__): dummy
Alexandre Julliard2f158c22000-06-14 21:45:38 +0000227 cd `dirname $@` && $(MAKE) install
228
Alexandre Julliard2d1c7902003-03-22 20:40:48 +0000229$(SUBDIRS:%=%/__install-lib__): dummy
230 cd `dirname $@` && $(MAKE) install-lib
231
232$(SUBDIRS:%=%/__install-dev__): dummy
233 cd `dirname $@` && $(MAKE) install-dev
234
235$(SUBDIRS:%=%/__uninstall__): dummy
Alexandre Julliard2f158c22000-06-14 21:45:38 +0000236 cd `dirname $@` && $(MAKE) uninstall
237
Alexandre Julliardf673b712002-06-14 23:48:27 +0000238install:: $(INSTALLSUBDIRS:%=%/__install__)
239
240uninstall:: $(INSTALLSUBDIRS:%=%/__uninstall__)
241
Alexandre Julliardada5e652002-12-12 22:03:14 +0000242.PHONY: install install-lib install-dev uninstall \
Alexandre Julliard2d1c7902003-03-22 20:40:48 +0000243 $(SUBDIRS:%=%/__install__) $(SUBDIRS:%=%/__uninstall__) \
244 $(SUBDIRS:%=%/__install-lib__) $(SUBDIRS:%=%/__install-dev__)
Alexandre Julliardf673b712002-06-14 23:48:27 +0000245
Alexandre Julliardedeee892002-08-09 01:22:40 +0000246# Rules for checking that no imports are missing
Alexandre Julliard13b0c092002-01-10 03:30:21 +0000247
Alexandre Julliardedeee892002-08-09 01:22:40 +0000248$(SUBDIRS:%=%/__checklink__): dummy
249 @cd `dirname $@` && $(MAKE) checklink
250
251.PHONY: checklink $(SUBDIRS:%=%/__checklink__)
252
253# Rules for testing
Alexandre Julliard13b0c092002-01-10 03:30:21 +0000254
Alexandre Julliardd7c606d2002-04-02 02:58:45 +0000255$(SUBDIRS:%=%/__test__): dummy
256 @cd `dirname $@` && $(MAKE) test
257
Alexandre Julliardc3c587e2002-09-06 19:46:00 +0000258$(SUBDIRS:%=%/__crosstest__): dummy
259 @cd `dirname $@` && $(MAKE) crosstest
260
261.PHONY: check test crosstest $(SUBDIRS:%=%/__test__) $(SUBDIRS:%=%/__crosstest__)
Alexandre Julliardf673b712002-06-14 23:48:27 +0000262
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000263# Misc. rules
264
Alexandre Julliard017a61e2000-11-06 05:30:48 +0000265$(MC_SRCS:.mc=.mc.rc): $(WMC)
Alexandre Julliardf5aee672000-07-25 17:52:08 +0000266
Alexandre Julliardaa89ecc2003-04-11 00:38:56 +0000267$(IDL_SRCS:.idl=.h): $(WIDL)
268
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000269$(SUBDIRS): dummy
270 @cd $@ && $(MAKE)
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000271
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000272dummy:
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000273
Alexandre Julliardf673b712002-06-14 23:48:27 +0000274.PHONY: dummy $(SUBDIRS)
275
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000276# End of global rules