blob: e296a443723b0555ae90bfec7dfb33fce488a5f8 [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
12# GEN_ASM_SRCS : generated assembly sources
13# RC_SRCS : resource source files
14# SPEC_SRCS : interface definition files
15# GLUE : C sources for which glue code needs to be generated
16# EXTRA_SRCS : extra source files for make depend
17# EXTRA_OBJS : extra object files
18# WRCEXTRA : extra wrc flags (e.g. '-p _SysRes')
19# SUBDIRS : subdirectories that contain a Makefile
20# EXTRASUBDIRS : subdirectories that do not contain a Makefile
Alexandre Julliardff8331e1995-09-18 11:19:54 +000021
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +000022# First some useful definitions
23
Alexandre Julliard8664b891996-04-05 14:58:24 +000024SHELL = /bin/sh
25CC = @CC@
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +000026CPP = @CPP@
Alexandre Julliard18f92e71996-07-17 20:02:21 +000027CFLAGS = @CFLAGS@
Alexandre Julliard0623a6f1998-01-18 18:01:49 +000028OPTIONS = @OPTIONS@ -D_REENTRANT
Alexandre Julliardff8331e1995-09-18 11:19:54 +000029X_CFLAGS = @X_CFLAGS@
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +000030X_LIBS = @X_LIBS@
Patrik Stridvallea584721998-11-01 16:22:07 +000031XLIB = @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@
Alexandre Julliard318f4ce2000-01-31 05:02:49 +000032DLL_LINK = @DLL_LINK@
Alexandre Julliard02e90081998-01-04 17:49:09 +000033LIBS = @LIBS@
Alexandre Julliardff8331e1995-09-18 11:19:54 +000034YACC = @YACC@
35LEX = @LEX@
36LEXLIB = @LEXLIB@
Alexandre Julliard641ee761997-08-04 16:34:36 +000037RANLIB = @RANLIB@
38LN_S = @LN_S@
Alexandre Julliard51662371999-05-15 10:41:15 +000039DIVINCL = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include
Marcus Meissnerd43eb2d2000-01-08 22:23:43 +000040ALLCFLAGS = $(DIVINCL) $(CFLAGS) $(DEFS) $(OPTIONS) $(X_CFLAGS)
Alexandre Julliardff8331e1995-09-18 11:19:54 +000041LDCOMBINE = ld -r
Alexandre Julliard641ee761997-08-04 16:34:36 +000042AR = ar rc
Alexandre Julliardff8331e1995-09-18 11:19:54 +000043RM = rm -f
Patrik Stridvalla9be64e1999-07-31 17:39:44 +000044MV = mv
Alexandre Julliard829fe321998-07-26 14:27:39 +000045MKDIR = mkdir -p
Alexandre Julliardc7c217b1998-04-13 12:21:30 +000046C2MAN = @C2MAN@
Alexandre Julliard829fe321998-07-26 14:27:39 +000047MANSPECS = -w $(TOPSRCDIR)/relay32/gdi32.spec \
48 -w $(TOPSRCDIR)/relay32/user32.spec \
49 -w $(TOPSRCDIR)/relay32/comctl32.spec \
50 -w $(TOPSRCDIR)/relay32/comdlg32.spec \
51 -w $(TOPSRCDIR)/relay32/kernel32.spec
Patrik Stridvalla9be64e1999-07-31 17:39:44 +000052LINT = @LINT@
53LINTFLAGS = @LINTFLAGS@
54ALLLINTFLAGS = $(LINTFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL)
Patrik Stridvall385dc181999-09-29 10:24:19 +000055WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi_check/winapi_check
Alexandre Julliardc6c09441997-01-12 18:32:19 +000056BUILD = $(TOPOBJDIR)/tools/build@PROGEXT@
57MAKEDEP = $(TOPOBJDIR)/tools/makedep@PROGEXT@
Alexandre Julliarda845b881998-06-01 10:44:35 +000058WRC = $(TOPOBJDIR)/tools/wrc/wrc@PROGEXT@
Bertho Stultiensd1895a71999-04-25 18:31:35 +000059WRCFLAGS = -c
Alexandre Julliard0adad952000-01-26 01:45:58 +000060DLLDIR = $(TOPOBJDIR)/dlls
Alexandre Julliardff8331e1995-09-18 11:19:54 +000061@SET_MAKE@
62
Alexandre Julliard641ee761997-08-04 16:34:36 +000063# Installation infos
64
65INSTALL = @INSTALL@
66INSTALL_PROGRAM = @INSTALL_PROGRAM@
67INSTALL_DATA = @INSTALL_DATA@
68prefix = @prefix@
69exec_prefix = @exec_prefix@
70bindir = @bindir@
71libdir = @libdir@
72infodir = @infodir@
Alexandre Julliardd6baf1b1999-07-18 15:47:22 +000073mandir = @mandir@
74prog_manext = 1
75conf_manext = 5
Alexandre Julliard641ee761997-08-04 16:34:36 +000076includedir = @includedir@/wine
Alexandre Julliard77d5ebb2000-03-25 14:03:50 +000077CLEAN_FILES = *.o *.a *.so *.ln \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej *.flc \
78 *.spec.c *.glue.c y.tab.c y.tab.h lex.yy.c core
Alexandre Julliard641ee761997-08-04 16:34:36 +000079
Alexandre Julliard318f4ce2000-01-31 05:02:49 +000080OBJS = $(SPEC_SRCS:.spec=.spec.o) $(C_SRCS:.c=.o) $(GEN_ASM_SRCS:.s=.o) \
81 $(ASM_SRCS:.S=.o) $(RC_SRCS:.rc=.o) $(GLUE:.c=.glue.o) $(EXTRA_OBJS)
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +000082
Patrik Stridvalla9be64e1999-07-31 17:39:44 +000083LINTS = $(C_SRCS:.c=.ln)
84
Alexandre Julliard318f4ce2000-01-31 05:02:49 +000085# DLL list
86
Patrik Stridvall2941a212000-04-25 20:34:22 +000087X_DLLS = \
88 ddraw \
89 x11drv
90
Alexandre Julliard318f4ce2000-01-31 05:02:49 +000091DLLS = \
Patrik Stridvall2941a212000-04-25 20:34:22 +000092 @X_DLLS@ \
Alexandre Julliard318f4ce2000-01-31 05:02:49 +000093 avifil32 \
94 comctl32 \
95 comdlg32 \
96 dciman32 \
Alexandre Julliardddce6522000-03-17 16:58:10 +000097 dinput \
Alexandre Julliard318f4ce2000-01-31 05:02:49 +000098 dplayx \
99 dsound \
Alexandre Julliard1dac57f2000-03-19 12:08:09 +0000100 gdi32 \
Alexandre Julliard318f4ce2000-01-31 05:02:49 +0000101 icmp \
102 imagehlp \
103 imm32 \
Eric Pouech2a3b0a12000-02-26 13:14:04 +0000104 joystick.drv \
Alexandre Julliard318f4ce2000-01-31 05:02:49 +0000105 lz32 \
106 mcianim.drv \
107 mciavi.drv \
108 mcicda.drv \
109 mciseq.drv \
110 mciwave.drv \
111 midimap.drv \
Alexandre Julliardebc32252000-03-17 15:09:48 +0000112 mpr \
Alexandre Julliard318f4ce2000-01-31 05:02:49 +0000113 msacm \
114 msacm.drv \
115 msacm32 \
116 msnet32 \
117 msvfw32 \
118 odbc32 \
119 ole32 \
120 oleaut32 \
121 olecli32 \
122 oledlg \
Sean Langley58c71d42000-02-07 16:26:56 +0000123 olepro32 \
Alexandre Julliard318f4ce2000-01-31 05:02:49 +0000124 olesvr32 \
125 psapi \
126 rasapi32 \
Hidenori Takeshimae75f9fb2000-05-03 18:12:19 +0000127 riched32 \
Alexandre Julliard318f4ce2000-01-31 05:02:49 +0000128 setupx \
129 shell32 \
130 sound \
131 stress \
132 tapi32 \
Alexandre Julliard1dac57f2000-03-19 12:08:09 +0000133 ttydrv \
Alexandre Julliard819fa8c2000-04-11 20:07:00 +0000134 urlmon \
Alexandre Julliard1dac57f2000-03-19 12:08:09 +0000135 user32 \
Alexandre Julliard318f4ce2000-01-31 05:02:49 +0000136 version \
Alexandre Julliard7ee34352000-02-29 22:11:44 +0000137 w32skrnl \
Alexandre Julliard318f4ce2000-01-31 05:02:49 +0000138 win87em \
139 windebug \
140 wineoss.drv \
141 wing \
Alexandre Julliard819fa8c2000-04-11 20:07:00 +0000142 wininet \
Alexandre Julliarde1d78892000-02-26 13:45:34 +0000143 winmm \
Eric Pouech44af98c2000-04-25 19:57:27 +0000144 winspool.drv \
Alexandre Julliard318f4ce2000-01-31 05:02:49 +0000145 wnaspi32 \
Patrik Stridvall2941a212000-04-25 20:34:22 +0000146 wsock32
Alexandre Julliard318f4ce2000-01-31 05:02:49 +0000147
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000148# Implicit rules
149
Patrik Stridvall0691a591999-07-31 14:45:22 +0000150.SUFFIXES:
Ulrich Weigand8336cc91999-08-15 12:45:53 +0000151.SUFFIXES: .rc .res .spec .spec.c .spec.o .glue.c $(SUFFIXES)
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000152
153.c.o:
154 $(CC) -c $(ALLCFLAGS) -o $*.o $<
155
Patrik Stridvall0691a591999-07-31 14:45:22 +0000156.spec.c.spec.o:
157 $(CC) -c $(ALLCFLAGS) @GCC_NO_BUILTIN@ -o $*.spec.o $<
158
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +0000159.s.o:
Patrik Stridvall1439f721998-10-11 17:12:21 +0000160 $(AS) -o $*.o $<
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +0000161
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000162.S.o:
163 $(CC) -c -o $*.o $<
164
Alexandre Julliarda845b881998-06-01 10:44:35 +0000165.rc.s:
166 $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) $<
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000167
168.rc.h:
Alexandre Julliarda845b881998-06-01 10:44:35 +0000169 $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) -nh $<
170
171.rc.res:
172 $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) -r $<
173
174.res.s:
175 $(WRC) $(WRCFLAGS) $(WRCEXTRA) -b $<
176
177.res.h:
178 $(WRC) $(WRCFLAGS) $(WRCEXTRA) -bnh $<
179
Ulrich Weigand3dff7bb1999-07-11 13:58:31 +0000180.spec.spec.c:
Ulrich Weigand4b32fd01999-07-15 14:51:40 +0000181 $(BUILD) @BUILDFLAGS@ -o $@ -spec $<
Ulrich Weigand3dff7bb1999-07-11 13:58:31 +0000182
Ulrich Weigand8336cc91999-08-15 12:45:53 +0000183.c.glue.c:
Ulrich Weigand4b32fd01999-07-15 14:51:40 +0000184 $(BUILD) @BUILDFLAGS@ -o $@ -glue $<
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000185
Patrik Stridvalla9be64e1999-07-31 17:39:44 +0000186.c.ln:
187 $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
188
Alexandre Julliard318f4ce2000-01-31 05:02:49 +0000189.PHONY: all install uninstall clean distclean depend dummy
190
Alexandre Julliardd0edc5f2000-03-04 22:31:27 +0000191# 'all' target first in case the enclosing Makefile didn't define any target
192
193all: Makefile
194
Alexandre Julliarda845b881998-06-01 10:44:35 +0000195# Rule to rebuild the resource compiler
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000196
Alexandre Julliarda845b881998-06-01 10:44:35 +0000197$(WRC) check_wrc:
Alexandre Julliard0adad952000-01-26 01:45:58 +0000198 cd $(TOPOBJDIR)/tools/wrc && $(MAKE) wrc@PROGEXT@
Alexandre Julliarda845b881998-06-01 10:44:35 +0000199
Alexandre Julliardc6c09441997-01-12 18:32:19 +0000200# Rule to rebuild the 'makedep' program
Alexandre Julliard530ee841996-10-23 16:59:13 +0000201
202$(MAKEDEP) check_makedep:
Alexandre Julliard0adad952000-01-26 01:45:58 +0000203 cd $(TOPOBJDIR)/tools && $(MAKE) makedep@PROGEXT@
Alexandre Julliardc6c09441997-01-12 18:32:19 +0000204
205# Rule to rebuild the 'build' program
206
207$(BUILD) checkbuild:
Alexandre Julliard0adad952000-01-26 01:45:58 +0000208 cd $(TOPOBJDIR)/tools && $(MAKE) build@PROGEXT@
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000209
210# Rule for main module
211
Marcus Meissner96075121999-10-13 13:45:15 +0000212$(MODULE).o: $(OBJS) Makefile.in $(TOPSRCDIR)/Make.rules.in
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000213 $(LDCOMBINE) $(OBJS) -o $(MODULE).o
214
Alexandre Julliarde66d4211999-03-14 15:22:29 +0000215# Rules for makefile
216
Marcus Meissnerca004e51999-01-03 12:26:22 +0000217Makefile: Makefile.in $(TOPSRCDIR)/configure
218 @echo Makefile is older than $?, please rerun $(TOPSRCDIR)/configure
219 @exit 1
220
Alexandre Julliard829fe321998-07-26 14:27:39 +0000221# Rules for auto documentation
Alexandre Julliard44ed71f1997-12-21 19:17:50 +0000222
223man: $(C_SRCS)
Alexandre Julliard829fe321998-07-26 14:27:39 +0000224 for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/man3w -S3w $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done
225
226html: $(C_SRCS)
227 for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/html -Th -iwindows.h $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done
228
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000229# Rule for linting
230
Patrik Stridvalla9be64e1999-07-31 17:39:44 +0000231$(MODULE).ln : $(LINTS)
232 if test "$(LINTS)" ; \
233 then \
234 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
235 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
236 else \
237 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
238 fi
239
240lint:: $(MODULE).ln
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000241
Patrik Stridvall385dc181999-09-29 10:24:19 +0000242# Rules for Windows API checking
243
244winapi_check::
245 $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
246
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000247# Rules for dependencies
248
249$(SUBDIRS:%=%/__depend__): $(MAKEDEP) dummy
250 cd `dirname $@` && $(MAKE) depend
251
252depend: $(MAKEDEP) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS) $(SUBDIRS:%=%/__depend__)
253 $(MAKEDEP) $(DIVINCL) -C$(SRCDIR) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS)
254
255# Rules for cleaning
256
257$(SUBDIRS:%=%/__clean__): dummy
258 cd `dirname $@` && $(MAKE) clean
259
260$(EXTRASUBDIRS:%=%/__clean__): dummy
261 -cd `dirname $@` && $(RM) $(CLEAN_FILES)
262
263clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
264 $(RM) $(CLEAN_FILES) $(GEN_ASM_SRCS) $(RC_SRCS:.rc=.s) $(RC_SRCS:.rc=.h) $(PROGRAMS)
265
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000266# Misc. rules
267
Ulrich Weigand3dff7bb1999-07-11 13:58:31 +0000268$(SPEC_SRCS:.spec=.spec.c): $(BUILD) $(TOPSRCDIR)/include/builtin16.h $(TOPSRCDIR)/include/builtin32.h
269
Ulrich Weigand8336cc91999-08-15 12:45:53 +0000270$(GLUE:.c=.glue.c): $(BUILD) $(TOPSRCDIR)/include/builtin16.h $(TOPSRCDIR)/include/builtin32.h
Ulrich Weigand3dff7bb1999-07-11 13:58:31 +0000271
Alexandre Julliardd0edc5f2000-03-04 22:31:27 +0000272$(RC_SRCS:.rc=.s): $(WRC)
273
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000274$(SUBDIRS): dummy
275 @cd $@ && $(MAKE)
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000276
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000277dummy:
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000278
279# End of global rules