blob: 8c9cab2c13dbc7d70178ee1b8ed1900c973b7299 [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
Alexandre Julliardc53ceba2000-04-09 18:19:59 +000019# 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 Julliard02e90081998-01-04 17:49:09 +000032LIBS = @LIBS@
Alexandre Julliardff8331e1995-09-18 11:19:54 +000033YACC = @YACC@
34LEX = @LEX@
35LEXLIB = @LEXLIB@
Alexandre Julliard2fa4f762000-10-31 00:20:51 +000036LIBEXT = @LIBEXT@
37LDSHARED = @LDSHARED@
Hidenori Takeshimad48ca942000-12-22 22:28:00 +000038DLLWRAP = @DLLWRAP@
39DLLWRAPFLAGS = --add-stdcall-alias
Alexandre Julliard641ee761997-08-04 16:34:36 +000040RANLIB = @RANLIB@
41LN_S = @LN_S@
Alexandre Julliard91222da2000-12-10 23:01:33 +000042DIVINCL = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include $(EXTRAINCL)
Marcus Meissnerd43eb2d2000-01-08 22:23:43 +000043ALLCFLAGS = $(DIVINCL) $(CFLAGS) $(DEFS) $(OPTIONS) $(X_CFLAGS)
Dimitrie O. Paun79e44ab2000-12-05 04:13:36 +000044LDCOMBINE = @LDCOMBINE@
Marcus Meissnera387aa42000-09-26 23:09:47 +000045LDFLAGS = @LDFLAGS@
Alexandre Julliard641ee761997-08-04 16:34:36 +000046AR = ar rc
Alexandre Julliardff8331e1995-09-18 11:19:54 +000047RM = rm -f
Patrik Stridvalla9be64e1999-07-31 17:39:44 +000048MV = mv
Alexandre Julliard829fe321998-07-26 14:27:39 +000049MKDIR = mkdir -p
Alexandre Julliardc7c217b1998-04-13 12:21:30 +000050C2MAN = @C2MAN@
Mike McCormack4306eaa2000-07-23 19:27:00 +000051MANSPECS = -w $(TOPSRCDIR)/dlls/gdi/gdi32.spec \
52 -w $(TOPSRCDIR)/dlls/user/user32.spec \
53 -w $(TOPSRCDIR)/dlls/comctl32/comctl32.spec \
Mike McCormack76e25f62001-07-26 20:06:00 +000054 -w $(TOPSRCDIR)/dlls/commdlg/comdlg32.spec \
Mike McCormack4306eaa2000-07-23 19:27:00 +000055 -w $(TOPSRCDIR)/dlls/kernel/kernel32.spec
Patrik Stridvalla9be64e1999-07-31 17:39:44 +000056LINT = @LINT@
57LINTFLAGS = @LINTFLAGS@
58ALLLINTFLAGS = $(LINTFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL)
Patrik Stridvall385dc181999-09-29 10:24:19 +000059WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi_check/winapi_check
Alexandre Julliard21ec0062000-10-23 21:39:39 +000060WINEBUILD = $(TOPOBJDIR)/tools/winebuild/winebuild
Alexandre Julliard2f158c22000-06-14 21:45:38 +000061MAKEDEP = $(TOPOBJDIR)/tools/makedep
62WRC = $(TOPOBJDIR)/tools/wrc/wrc
Alexandre Julliard2f158c22000-06-14 21:45:38 +000063WMC = $(TOPOBJDIR)/tools/wmc/wmc
Hidenori Takeshimad48ca942000-12-22 22:28:00 +000064LDPATH = @LDPATH@
Alexandre Julliard0adad952000-01-26 01:45:58 +000065DLLDIR = $(TOPOBJDIR)/dlls
Alexandre Julliardb0182392000-12-06 00:04:10 +000066LIBWINE = -L$(TOPOBJDIR)/library -lwine
67LIBTSX11 = -L$(TOPOBJDIR)/tsx11 -lwine_tsx11
68LIBUNICODE= -L$(TOPOBJDIR)/unicode -lwine_unicode
Alexandre Julliardc4d11762000-12-27 19:06:44 +000069LIBUUID = -L$(TOPOBJDIR)/ole -lwine_uuid
Alexandre Julliardb0182392000-12-06 00:04:10 +000070
Alexandre Julliardff8331e1995-09-18 11:19:54 +000071@SET_MAKE@
72
Alexandre Julliard641ee761997-08-04 16:34:36 +000073# Installation infos
74
75INSTALL = @INSTALL@
76INSTALL_PROGRAM = @INSTALL_PROGRAM@
Satsuki Fujishimaf34f4182001-03-19 19:19:23 +000077INSTALL_SCRIPT = @INSTALL_SCRIPT@
Alexandre Julliard641ee761997-08-04 16:34:36 +000078INSTALL_DATA = @INSTALL_DATA@
79prefix = @prefix@
80exec_prefix = @exec_prefix@
81bindir = @bindir@
82libdir = @libdir@
83infodir = @infodir@
Alexandre Julliardd6baf1b1999-07-18 15:47:22 +000084mandir = @mandir@
85prog_manext = 1
86conf_manext = 5
Alexandre Julliard641ee761997-08-04 16:34:36 +000087includedir = @includedir@/wine
Alexandre Julliard24c3c5e2000-05-24 03:31:04 +000088CLEAN_FILES = *.o *.a *.so *.ln \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej \
89 *.flc *.spec.c *.glue.c y.tab.c y.tab.h lex.yy.c core
Alexandre Julliard641ee761997-08-04 16:34:36 +000090
Alexandre Julliard24c3c5e2000-05-24 03:31:04 +000091OBJS = $(SPEC_SRCS:.spec=.spec.o) $(C_SRCS:.c=.o) $(GEN_C_SRCS:.c=.o) $(GEN_ASM_SRCS:.s=.o) \
Alexandre Julliardcbeb6442000-10-25 20:33:58 +000092 $(ASM_SRCS:.S=.o) $(GLUE:.c=.glue.o) $(EXTRA_OBJS)
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +000093
Patrik Stridvalla9be64e1999-07-31 17:39:44 +000094LINTS = $(C_SRCS:.c=.ln)
95
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +000096# Implicit rules
97
Alexandre Julliard000c13a2000-11-09 20:31:18 +000098.SUFFIXES: .mc .rc .mc.rc .res .spec .spec.c .glue.c
Alexandre Julliardff8331e1995-09-18 11:19:54 +000099
100.c.o:
François Gouget1c3a2422001-11-09 19:15:51 +0000101 $(CC) -c $(ALLCFLAGS) -o $@ $<
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000102
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +0000103.s.o:
François Gouget1c3a2422001-11-09 19:15:51 +0000104 $(AS) -o $@ $<
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +0000105
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000106.S.o:
François Gouget1c3a2422001-11-09 19:15:51 +0000107 $(CC) -c -o $@ $<
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000108
Alexandre Julliard017a61e2000-11-06 05:30:48 +0000109.mc.mc.rc:
110 $(LDPATH) $(WMC) -i -H /dev/null -o $@ $<
Alexandre Julliardf5aee672000-07-25 17:52:08 +0000111
Alexandre Julliarda845b881998-06-01 10:44:35 +0000112.rc.res:
Alexandre Julliard017a61e2000-11-06 05:30:48 +0000113 $(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -r $<
Alexandre Julliarda845b881998-06-01 10:44:35 +0000114
Ulrich Weigand3dff7bb1999-07-11 13:58:31 +0000115.spec.spec.c:
Alexandre Julliardb0182392000-12-06 00:04:10 +0000116 $(LDPATH) $(WINEBUILD) @DLLFLAGS@ -L$(DLLDIR) -o $@ -spec $<
Ulrich Weigand3dff7bb1999-07-11 13:58:31 +0000117
Ulrich Weigand8336cc91999-08-15 12:45:53 +0000118.c.glue.c:
Alexandre Julliard017a61e2000-11-06 05:30:48 +0000119 $(LDPATH) $(WINEBUILD) @DLLFLAGS@ -o $@ -glue $<
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000120
Patrik Stridvalla9be64e1999-07-31 17:39:44 +0000121.c.ln:
122 $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
123
Alexandre Julliard318f4ce2000-01-31 05:02:49 +0000124.PHONY: all install uninstall clean distclean depend dummy
125
Alexandre Julliardd0edc5f2000-03-04 22:31:27 +0000126# 'all' target first in case the enclosing Makefile didn't define any target
127
128all: Makefile
129
Patrik Stridvallb7190292001-07-29 20:20:13 +0000130filter:
131 @$(TOPSRCDIR)/tools/winapi/make_filter --make $(MAKE) all
132
Alexandre Julliard000c13a2000-11-09 20:31:18 +0000133# Rule for main module intermediate object
134
135$(MODULE).tmp.o: $(OBJS) Makefile.in
136 $(LDCOMBINE) $(OBJS) -o $@
Alexandre Julliardcaf5f892000-11-13 04:17:00 +0000137 -strip --strip-unneeded $@
Alexandre Julliard000c13a2000-11-09 20:31:18 +0000138
139# Rule for main module spec file
140
141$(MODULE).spec.c: $(MODULE).spec $(RC_SRCS:.rc=.res) $(SYMBOLFILE) $(WINEBUILD)
Alexandre Julliardb0182392000-12-06 00:04:10 +0000142 $(LDPATH) $(WINEBUILD) @DLLFLAGS@ -L$(DLLDIR) $(SYMBOLFILE:%=-sym %) -o $@ -spec $(SRCDIR)/$(MODULE).spec
Alexandre Julliard000c13a2000-11-09 20:31:18 +0000143
Alexandre Julliarda845b881998-06-01 10:44:35 +0000144# Rule to rebuild the resource compiler
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000145
Alexandre Julliard21ec0062000-10-23 21:39:39 +0000146$(WRC):
Alexandre Julliard2f158c22000-06-14 21:45:38 +0000147 cd $(TOPOBJDIR)/tools/wrc && $(MAKE) wrc
Alexandre Julliarda845b881998-06-01 10:44:35 +0000148
Bertho Stultiens30855912000-06-13 04:34:41 +0000149# Rule to rebuild the message compiler
150
Alexandre Julliard21ec0062000-10-23 21:39:39 +0000151$(WMC):
Alexandre Julliard2f158c22000-06-14 21:45:38 +0000152 cd $(TOPOBJDIR)/tools/wmc && $(MAKE) wmc
Bertho Stultiens30855912000-06-13 04:34:41 +0000153
Alexandre Julliardc6c09441997-01-12 18:32:19 +0000154# Rule to rebuild the 'makedep' program
Alexandre Julliard530ee841996-10-23 16:59:13 +0000155
Alexandre Julliard21ec0062000-10-23 21:39:39 +0000156$(MAKEDEP):
Alexandre Julliard2f158c22000-06-14 21:45:38 +0000157 cd $(TOPOBJDIR)/tools && $(MAKE) makedep
Alexandre Julliardc6c09441997-01-12 18:32:19 +0000158
Alexandre Julliarde482eeb2000-06-23 20:15:35 +0000159# Rule to rebuild the 'winebuild' program
Alexandre Julliardc6c09441997-01-12 18:32:19 +0000160
Alexandre Julliard21ec0062000-10-23 21:39:39 +0000161$(WINEBUILD):
Alexandre Julliarde482eeb2000-06-23 20:15:35 +0000162 cd $(TOPOBJDIR)/tools/winebuild && $(MAKE) winebuild
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000163
Alexandre Julliarde66d4211999-03-14 15:22:29 +0000164# Rules for makefile
165
Marcus Meissnerca004e51999-01-03 12:26:22 +0000166Makefile: Makefile.in $(TOPSRCDIR)/configure
167 @echo Makefile is older than $?, please rerun $(TOPSRCDIR)/configure
168 @exit 1
169
Alexandre Julliard829fe321998-07-26 14:27:39 +0000170# Rules for auto documentation
Alexandre Julliard44ed71f1997-12-21 19:17:50 +0000171
Francois Gougetb83bb6d2001-08-22 18:01:39 +0000172$(SUBDIRS:%=%/__man__): dummy
173 cd `dirname $@` && $(MAKE) man
Alexandre Julliard829fe321998-07-26 14:27:39 +0000174
Francois Gougetb83bb6d2001-08-22 18:01:39 +0000175man: $(C_SRCS) $(SUBDIRS:%=%/__man__)
176 if [ -n "$(C_SRCS)" ]; then $(MKDIR) $(TOPOBJDIR)/documentation/man3w; for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/man3w -S3w $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done; fi
177
178$(SUBDIRS:%=%/__doc_html__): dummy
179 cd `dirname $@` && $(MAKE) doc-html
180
181doc-html: $(C_SRCS) $(SUBDIRS:%=%/__doc_html__)
182 if [ -n "$(C_SRCS)" ]; then $(MKDIR) $(TOPOBJDIR)/documentation/html; for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/html -Th -iwindows.h $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done; fi
Alexandre Julliard829fe321998-07-26 14:27:39 +0000183
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000184# Rule for linting
185
Patrik Stridvalla9be64e1999-07-31 17:39:44 +0000186$(MODULE).ln : $(LINTS)
187 if test "$(LINTS)" ; \
188 then \
189 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
190 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
191 else \
192 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
193 fi
194
195lint:: $(MODULE).ln
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000196
Patrik Stridvall385dc181999-09-29 10:24:19 +0000197# Rules for Windows API checking
198
199winapi_check::
200 $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
201
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000202# Rules for dependencies
203
204$(SUBDIRS:%=%/__depend__): $(MAKEDEP) dummy
205 cd `dirname $@` && $(MAKE) depend
206
Alexandre Julliard017a61e2000-11-06 05:30:48 +0000207depend: $(MAKEDEP) $(GEN_C_SRCS) $(SUBDIRS:%=%/__depend__)
Dmitry Timoshkovdb790452001-05-31 21:37:29 +0000208 $(MAKEDEP) $(DIVINCL) -C$(SRCDIR) $(C_SRCS) $(RC_SRCS) $(RC_SRCS16) $(MC_SRCS) $(EXTRA_SRCS) -C. $(GEN_C_SRCS)
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000209
210# Rules for cleaning
211
212$(SUBDIRS:%=%/__clean__): dummy
213 cd `dirname $@` && $(MAKE) clean
214
215$(EXTRASUBDIRS:%=%/__clean__): dummy
216 -cd `dirname $@` && $(RM) $(CLEAN_FILES)
217
218clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
Dmitry Timoshkovdb790452001-05-31 21:37:29 +0000219 $(RM) $(CLEAN_FILES) $(GEN_C_SRCS) $(GEN_ASM_SRCS) $(RC_SRCS:.rc=.res) $(RC_SRCS16:.rc=.res) $(MC_SRCS:.mc=.mc.rc) $(PROGRAMS)
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000220
Alexandre Julliard2f158c22000-06-14 21:45:38 +0000221# Rules for installing
222
223$(SUBDIRS:%=%/__install__): dummy
224 cd `dirname $@` && $(MAKE) install
225
226$(SUBDIRS:%=%/__uninstall__): dummy
227 cd `dirname $@` && $(MAKE) uninstall
228
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000229# Misc. rules
230
Alexandre Julliard21ec0062000-10-23 21:39:39 +0000231$(SPEC_SRCS:.spec=.spec.c): $(WINEBUILD) $(TOPSRCDIR)/include/builtin16.h
Ulrich Weigand3dff7bb1999-07-11 13:58:31 +0000232
Alexandre Julliard21ec0062000-10-23 21:39:39 +0000233$(GLUE:.c=.glue.c): $(WINEBUILD) $(TOPSRCDIR)/include/builtin16.h
Ulrich Weigand3dff7bb1999-07-11 13:58:31 +0000234
Alexandre Julliardcbeb6442000-10-25 20:33:58 +0000235$(RC_SRCS:.rc=.res): $(WRC)
Alexandre Julliardd0edc5f2000-03-04 22:31:27 +0000236
Dmitry Timoshkovdb790452001-05-31 21:37:29 +0000237$(RC_SRCS16:.rc=.res): $(WRC)
238
Alexandre Julliard017a61e2000-11-06 05:30:48 +0000239$(MC_SRCS:.mc=.mc.rc): $(WMC)
Alexandre Julliardf5aee672000-07-25 17:52:08 +0000240
Alexandre Julliardc53ceba2000-04-09 18:19:59 +0000241$(SUBDIRS): dummy
242 @cd $@ && $(MAKE)
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000243
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000244dummy:
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000245
246# End of global rules