blob: 644811e760657c69fbd81f99488078a942ea0b64 [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
11# ASM_SRCS : assembly sources
Alexandre Julliard24c3c5e2000-05-24 03:31:04 +000012# GEN_C_SRCS : generated C files
Alexandre Julliardc53ceba2000-04-09 18:19:59 +000013# GEN_ASM_SRCS : generated assembly sources
14# RC_SRCS : resource source files
15# SPEC_SRCS : interface definition files
16# GLUE : C sources for which glue code needs to be generated
17# EXTRA_SRCS : extra source files for make depend
18# EXTRA_OBJS : extra object files
19# WRCEXTRA : extra wrc flags (e.g. '-p _SysRes')
20# SUBDIRS : subdirectories that contain a Makefile
21# EXTRASUBDIRS : subdirectories that do not contain a Makefile
Alexandre Julliardff8331e1995-09-18 11:19:54 +000022
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +000023# First some useful definitions
24
Alexandre Julliard8664b891996-04-05 14:58:24 +000025SHELL = /bin/sh
26CC = @CC@
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +000027CPP = @CPP@
Alexandre Julliard18f92e71996-07-17 20:02:21 +000028CFLAGS = @CFLAGS@
Alexandre Julliard0623a6f1998-01-18 18:01:49 +000029OPTIONS = @OPTIONS@ -D_REENTRANT
Alexandre Julliardff8331e1995-09-18 11:19:54 +000030X_CFLAGS = @X_CFLAGS@
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +000031X_LIBS = @X_LIBS@
Patrik Stridvallea584721998-11-01 16:22:07 +000032XLIB = @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@
Alexandre Julliard318f4ce2000-01-31 05:02:49 +000033DLL_LINK = @DLL_LINK@
Alexandre Julliard02e90081998-01-04 17:49:09 +000034LIBS = @LIBS@
Alexandre Julliardff8331e1995-09-18 11:19:54 +000035YACC = @YACC@
36LEX = @LEX@
37LEXLIB = @LEXLIB@
Alexandre Julliard641ee761997-08-04 16:34:36 +000038RANLIB = @RANLIB@
39LN_S = @LN_S@
Alexandre Julliard51662371999-05-15 10:41:15 +000040DIVINCL = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include
Marcus Meissnerd43eb2d2000-01-08 22:23:43 +000041ALLCFLAGS = $(DIVINCL) $(CFLAGS) $(DEFS) $(OPTIONS) $(X_CFLAGS)
Alexandre Julliardff8331e1995-09-18 11:19:54 +000042LDCOMBINE = ld -r
Marcus Meissnera387aa42000-09-26 23:09:47 +000043LDFLAGS = @LDFLAGS@
Alexandre Julliard641ee761997-08-04 16:34:36 +000044AR = ar rc
Alexandre Julliardff8331e1995-09-18 11:19:54 +000045RM = rm -f
Patrik Stridvalla9be64e1999-07-31 17:39:44 +000046MV = mv
Alexandre Julliard829fe321998-07-26 14:27:39 +000047MKDIR = mkdir -p
Alexandre Julliardc7c217b1998-04-13 12:21:30 +000048C2MAN = @C2MAN@
Mike McCormack4306eaa2000-07-23 19:27:00 +000049MANSPECS = -w $(TOPSRCDIR)/dlls/gdi/gdi32.spec \
50 -w $(TOPSRCDIR)/dlls/user/user32.spec \
51 -w $(TOPSRCDIR)/dlls/comctl32/comctl32.spec \
52 -w $(TOPSRCDIR)/dlls/comdlg32/comdlg32.spec \
53 -w $(TOPSRCDIR)/dlls/kernel/kernel32.spec
Patrik Stridvalla9be64e1999-07-31 17:39:44 +000054LINT = @LINT@
55LINTFLAGS = @LINTFLAGS@
56ALLLINTFLAGS = $(LINTFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL)
Patrik Stridvall385dc181999-09-29 10:24:19 +000057WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi_check/winapi_check
Alexandre Julliarde482eeb2000-06-23 20:15:35 +000058BUILD = $(TOPOBJDIR)/tools/winebuild/winebuild
Alexandre Julliard2f158c22000-06-14 21:45:38 +000059MAKEDEP = $(TOPOBJDIR)/tools/makedep
60WRC = $(TOPOBJDIR)/tools/wrc/wrc
Alexandre Julliard01e819a2000-06-08 04:52:11 +000061WRCFLAGS = -c -s -p $*
Alexandre Julliard2f158c22000-06-14 21:45:38 +000062WMC = $(TOPOBJDIR)/tools/wmc/wmc
Alexandre Julliard0adad952000-01-26 01:45:58 +000063DLLDIR = $(TOPOBJDIR)/dlls
Alexandre Julliardff8331e1995-09-18 11:19:54 +000064@SET_MAKE@
65
Alexandre Julliard641ee761997-08-04 16:34:36 +000066# Installation infos
67
68INSTALL = @INSTALL@
69INSTALL_PROGRAM = @INSTALL_PROGRAM@
70INSTALL_DATA = @INSTALL_DATA@
71prefix = @prefix@
72exec_prefix = @exec_prefix@
73bindir = @bindir@
74libdir = @libdir@
75infodir = @infodir@
Alexandre Julliardd6baf1b1999-07-18 15:47:22 +000076mandir = @mandir@
77prog_manext = 1
78conf_manext = 5
Alexandre Julliard641ee761997-08-04 16:34:36 +000079includedir = @includedir@/wine
Alexandre Julliard24c3c5e2000-05-24 03:31:04 +000080CLEAN_FILES = *.o *.a *.so *.ln \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej \
81 *.flc *.spec.c *.glue.c y.tab.c y.tab.h lex.yy.c core
Alexandre Julliard641ee761997-08-04 16:34:36 +000082
Alexandre Julliard24c3c5e2000-05-24 03:31:04 +000083OBJS = $(SPEC_SRCS:.spec=.spec.o) $(C_SRCS:.c=.o) $(GEN_C_SRCS:.c=.o) $(GEN_ASM_SRCS:.s=.o) \
Alexandre Julliard318f4ce2000-01-31 05:02:49 +000084 $(ASM_SRCS:.S=.o) $(RC_SRCS:.rc=.o) $(GLUE:.c=.glue.o) $(EXTRA_OBJS)
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +000085
Patrik Stridvalla9be64e1999-07-31 17:39:44 +000086LINTS = $(C_SRCS:.c=.ln)
87
Alexandre Julliard318f4ce2000-01-31 05:02:49 +000088# DLL list
89
Patrik Stridvall2941a212000-04-25 20:34:22 +000090X_DLLS = \
91 ddraw \
Hidenori Takeshima4615e292000-05-23 23:36:41 +000092 @OPENGL32_DLL@ \
Patrik Stridvall2941a212000-04-25 20:34:22 +000093 x11drv
94
Alexandre Julliard318f4ce2000-01-31 05:02:49 +000095DLLS = \
Patrik Stridvall2941a212000-04-25 20:34:22 +000096 @X_DLLS@ \
Alexandre Julliardcd770ea2000-07-25 15:10:52 +000097 advapi32 \
Alexandre Julliard318f4ce2000-01-31 05:02:49 +000098 avifil32 \
99 comctl32 \
100 comdlg32 \
Alexandre Julliard4f356e82000-06-23 16:16:30 +0000101 crtdll \
Alexandre Julliard318f4ce2000-01-31 05:02:49 +0000102 dciman32 \
Alexandre Julliardddce6522000-03-17 16:58:10 +0000103 dinput \
Alexandre Julliardc6075322000-07-09 11:19:35 +0000104 dplay \
Alexandre Julliard318f4ce2000-01-31 05:02:49 +0000105 dplayx \
106 dsound \
Alexandre Julliard1dac57f2000-03-19 12:08:09 +0000107 gdi32 \
Alexandre Julliard318f4ce2000-01-31 05:02:49 +0000108 icmp \
109 imagehlp \
110 imm32 \
Eric Pouech2a3b0a12000-02-26 13:14:04 +0000111 joystick.drv \
Dimitrie O. Paun36b5b6b2000-06-03 00:07:44 +0000112 kernel32 \
Alexandre Julliard318f4ce2000-01-31 05:02:49 +0000113 lz32 \
114 mcianim.drv \
115 mciavi.drv \
116 mcicda.drv \
117 mciseq.drv \
118 mciwave.drv \
119 midimap.drv \
Alexandre Julliardebc32252000-03-17 15:09:48 +0000120 mpr \
Alexandre Julliard318f4ce2000-01-31 05:02:49 +0000121 msacm.drv \
122 msacm32 \
123 msnet32 \
124 msvfw32 \
125 odbc32 \
126 ole32 \
127 oleaut32 \
128 olecli32 \
129 oledlg \
Sean Langley58c71d42000-02-07 16:26:56 +0000130 olepro32 \
Alexandre Julliard318f4ce2000-01-31 05:02:49 +0000131 olesvr32 \
132 psapi \
133 rasapi32 \
Hidenori Takeshimae75f9fb2000-05-03 18:12:19 +0000134 riched32 \
Huw D M Davies10b1b232000-07-15 19:53:50 +0000135 rpcrt4 \
Mike McCormackdc2461e2000-07-15 21:35:55 +0000136 serialui \
Francois Jacquesdf5e5792000-07-08 18:27:03 +0000137 setupapi \
Alexandre Julliard318f4ce2000-01-31 05:02:49 +0000138 shell32 \
Alexandre Julliardc6075322000-07-09 11:19:35 +0000139 shfolder \
140 shlwapi \
Alexandre Julliard318f4ce2000-01-31 05:02:49 +0000141 tapi32 \
Alexandre Julliard1dac57f2000-03-19 12:08:09 +0000142 ttydrv \
Alexandre Julliard819fa8c2000-04-11 20:07:00 +0000143 urlmon \
Alexandre Julliard1dac57f2000-03-19 12:08:09 +0000144 user32 \
Alexandre Julliard318f4ce2000-01-31 05:02:49 +0000145 version \
Alexandre Julliard7ee34352000-02-29 22:11:44 +0000146 w32skrnl \
Alexandre Julliard318f4ce2000-01-31 05:02:49 +0000147 wineoss.drv \
Dimitrie O. Paun84bde6a2000-05-30 20:27:23 +0000148 wineps \
Alexandre Julliard819fa8c2000-04-11 20:07:00 +0000149 wininet \
Alexandre Julliarde1d78892000-02-26 13:45:34 +0000150 winmm \
Eric Pouech44af98c2000-04-25 19:57:27 +0000151 winspool.drv \
Alexandre Julliard318f4ce2000-01-31 05:02:49 +0000152 wnaspi32 \
Alexandre Julliardc6075322000-07-09 11:19:35 +0000153 wow32 \
154 ws2_32 \
Patrik Stridvall2941a212000-04-25 20:34:22 +0000155 wsock32
Alexandre Julliard318f4ce2000-01-31 05:02:49 +0000156
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000157# Implicit rules
158
Alexandre Julliardf5aee672000-07-25 17:52:08 +0000159.SUFFIXES: .mc .rc .res .spec .spec.c .spec.o .glue.c
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000160
161.c.o:
162 $(CC) -c $(ALLCFLAGS) -o $*.o $<
163
Patrik Stridvall0691a591999-07-31 14:45:22 +0000164.spec.c.spec.o:
165 $(CC) -c $(ALLCFLAGS) @GCC_NO_BUILTIN@ -o $*.spec.o $<
166
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +0000167.s.o:
Patrik Stridvall1439f721998-10-11 17:12:21 +0000168 $(AS) -o $*.o $<
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +0000169
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000170.S.o:
171 $(CC) -c -o $*.o $<
172
Alexandre Julliardf5aee672000-07-25 17:52:08 +0000173.mc.rc:
Alexandre Julliard7e495e12000-07-25 21:01:59 +0000174 LD_LIBRARY_PATH="$(TOPOBJDIR):$$LD_LIBRARY_PATH" $(WMC) -i -H /dev/null -o $@ $<
Alexandre Julliardf5aee672000-07-25 17:52:08 +0000175
Alexandre Julliarda845b881998-06-01 10:44:35 +0000176.rc.s:
177 $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) $<
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000178
179.rc.h:
Alexandre Julliarda845b881998-06-01 10:44:35 +0000180 $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) -nh $<
181
182.rc.res:
183 $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) -r $<
184
185.res.s:
186 $(WRC) $(WRCFLAGS) $(WRCEXTRA) -b $<
187
188.res.h:
189 $(WRC) $(WRCFLAGS) $(WRCEXTRA) -bnh $<
190
Ulrich Weigand3dff7bb1999-07-11 13:58:31 +0000191.spec.spec.c:
Alexandre Julliarde482eeb2000-06-23 20:15:35 +0000192 $(BUILD) @DLLFLAGS@ -o $@ -spec $<
Ulrich Weigand3dff7bb1999-07-11 13:58:31 +0000193
Ulrich Weigand8336cc91999-08-15 12:45:53 +0000194.c.glue.c:
Alexandre Julliarde482eeb2000-06-23 20:15:35 +0000195 $(BUILD) @DLLFLAGS@ -o $@ -glue $<
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000196
Patrik Stridvalla9be64e1999-07-31 17:39:44 +0000197.c.ln:
198 $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
199
Alexandre Julliard318f4ce2000-01-31 05:02:49 +0000200.PHONY: all install uninstall clean distclean depend dummy
201
Alexandre Julliardd0edc5f2000-03-04 22:31:27 +0000202# 'all' target first in case the enclosing Makefile didn't define any target
203
204all: Makefile
205
Alexandre Julliarda845b881998-06-01 10:44:35 +0000206# Rule to rebuild the resource compiler
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000207
Alexandre Julliarda845b881998-06-01 10:44:35 +0000208$(WRC) check_wrc:
Alexandre Julliard2f158c22000-06-14 21:45:38 +0000209 cd $(TOPOBJDIR)/tools/wrc && $(MAKE) wrc
Alexandre Julliarda845b881998-06-01 10:44:35 +0000210
Bertho Stultiens30855912000-06-13 04:34:41 +0000211# Rule to rebuild the message compiler
212
213$(WMC) check_wmc:
Alexandre Julliard2f158c22000-06-14 21:45:38 +0000214 cd $(TOPOBJDIR)/tools/wmc && $(MAKE) wmc
Bertho Stultiens30855912000-06-13 04:34:41 +0000215
Alexandre Julliardc6c09441997-01-12 18:32:19 +0000216# Rule to rebuild the 'makedep' program
Alexandre Julliard530ee841996-10-23 16:59:13 +0000217
218$(MAKEDEP) check_makedep:
Alexandre Julliard2f158c22000-06-14 21:45:38 +0000219 cd $(TOPOBJDIR)/tools && $(MAKE) makedep
Alexandre Julliardc6c09441997-01-12 18:32:19 +0000220
Alexandre Julliarde482eeb2000-06-23 20:15:35 +0000221# Rule to rebuild the 'winebuild' program
Alexandre Julliardc6c09441997-01-12 18:32:19 +0000222
Alexandre Julliarde482eeb2000-06-23 20:15:35 +0000223$(BUILD) check_winebuild:
224 cd $(TOPOBJDIR)/tools/winebuild && $(MAKE) winebuild
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000225
Alexandre Julliarde66d4211999-03-14 15:22:29 +0000226# Rules for makefile
227
Marcus Meissnerca004e51999-01-03 12:26:22 +0000228Makefile: Makefile.in $(TOPSRCDIR)/configure
229 @echo Makefile is older than $?, please rerun $(TOPSRCDIR)/configure
230 @exit 1
231
Alexandre Julliard829fe321998-07-26 14:27:39 +0000232# Rules for auto documentation
Alexandre Julliard44ed71f1997-12-21 19:17:50 +0000233
234man: $(C_SRCS)
Alexandre Julliard829fe321998-07-26 14:27:39 +0000235 for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/man3w -S3w $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done
236
John R. Sheets1e8e5ba2000-08-08 01:24:00 +0000237doc-html: $(C_SRCS)
Alexandre Julliard829fe321998-07-26 14:27:39 +0000238 for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/html -Th -iwindows.h $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done
239
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000240# Rule for linting
241
Patrik Stridvalla9be64e1999-07-31 17:39:44 +0000242$(MODULE).ln : $(LINTS)
243 if test "$(LINTS)" ; \
244 then \
245 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
246 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
247 else \
248 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
249 fi
250
251lint:: $(MODULE).ln
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000252
Patrik Stridvall385dc181999-09-29 10:24:19 +0000253# Rules for Windows API checking
254
255winapi_check::
256 $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
257
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000258# Rules for dependencies
259
260$(SUBDIRS:%=%/__depend__): $(MAKEDEP) dummy
261 cd `dirname $@` && $(MAKE) depend
262
Alexandre Julliard24c3c5e2000-05-24 03:31:04 +0000263depend: $(MAKEDEP) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS) $(GEN_C_SRCS) $(SUBDIRS:%=%/__depend__)
264 $(MAKEDEP) $(DIVINCL) -C$(SRCDIR) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS) -C. $(GEN_C_SRCS)
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000265
266# Rules for cleaning
267
268$(SUBDIRS:%=%/__clean__): dummy
269 cd `dirname $@` && $(MAKE) clean
270
271$(EXTRASUBDIRS:%=%/__clean__): dummy
272 -cd `dirname $@` && $(RM) $(CLEAN_FILES)
273
274clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
Alexandre Julliardf5aee672000-07-25 17:52:08 +0000275 $(RM) $(CLEAN_FILES) $(GEN_C_SRCS) $(GEN_ASM_SRCS) $(RC_SRCS:.rc=.s) $(RC_SRCS:.rc=.h) $(MC_SRCS:.mc=.rc) $(PROGRAMS)
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000276
Alexandre Julliard2f158c22000-06-14 21:45:38 +0000277# Rules for installing
278
279$(SUBDIRS:%=%/__install__): dummy
280 cd `dirname $@` && $(MAKE) install
281
282$(SUBDIRS:%=%/__uninstall__): dummy
283 cd `dirname $@` && $(MAKE) uninstall
284
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000285# Misc. rules
286
Alexandre Julliardc585a502000-09-27 23:40:43 +0000287$(SPEC_SRCS:.spec=.spec.c): $(BUILD) $(TOPSRCDIR)/include/builtin16.h
Ulrich Weigand3dff7bb1999-07-11 13:58:31 +0000288
Alexandre Julliardc585a502000-09-27 23:40:43 +0000289$(GLUE:.c=.glue.c): $(BUILD) $(TOPSRCDIR)/include/builtin16.h
Ulrich Weigand3dff7bb1999-07-11 13:58:31 +0000290
Alexandre Julliardd0edc5f2000-03-04 22:31:27 +0000291$(RC_SRCS:.rc=.s): $(WRC)
292
Alexandre Julliardf5aee672000-07-25 17:52:08 +0000293$(MC_SRCS:.mc=.rc): $(WMC)
294
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000295$(SUBDIRS): dummy
296 @cd $@ && $(MAKE)
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000297
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000298dummy:
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000299
300# End of global rules