blob: 19b4b8b8acdade74f20278a4d79eb359f50f5ae2 [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#
3# Each individual makefile should 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 Julliardd37eb361997-07-20 16:23:21 +00008# C_SRCS : C sources for the module (optional)
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +00009# ASM_SRCS : assembly sources (optional)
10# GEN_ASM_SRCS : generated assembly sources (optional)
Alexandre Julliard3db94ef1997-09-28 17:43:24 +000011# RC_SRCS : resource source files (optional)
Ulrich Weigand3dff7bb1999-07-11 13:58:31 +000012# SPEC_SRCS : interface definition files (optional)
13# GLUE : C sources for which glue code needs to be generated (optional)
Alexandre Julliard3db94ef1997-09-28 17:43:24 +000014# EXTRA_SRCS : extra source files for make depend (optional)
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +000015# EXTRA_OBJS : extra object files (optional)
Alexandre Julliarda845b881998-06-01 10:44:35 +000016# WRCEXTRA : extra wrc flags (e.g. '-p _SysRes') (optional)
Alexandre Julliardff8331e1995-09-18 11:19:54 +000017
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +000018# First some useful definitions
19
Alexandre Julliard8664b891996-04-05 14:58:24 +000020SHELL = /bin/sh
21CC = @CC@
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +000022CPP = @CPP@
Alexandre Julliard18f92e71996-07-17 20:02:21 +000023CFLAGS = @CFLAGS@
Alexandre Julliard0623a6f1998-01-18 18:01:49 +000024OPTIONS = @OPTIONS@ -D_REENTRANT
Alexandre Julliardff8331e1995-09-18 11:19:54 +000025X_CFLAGS = @X_CFLAGS@
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +000026X_LIBS = @X_LIBS@
Patrik Stridvallea584721998-11-01 16:22:07 +000027XLIB = @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@
Todd Vierling8beb15a1998-12-18 17:30:52 +000028WINELIB = $(WINESTUB) -L$(TOPOBJDIR) -lwine
Alexandre Julliard02e90081998-01-04 17:49:09 +000029LIBS = @LIBS@
Alexandre Julliardff8331e1995-09-18 11:19:54 +000030YACC = @YACC@
31LEX = @LEX@
32LEXLIB = @LEXLIB@
Alexandre Julliard641ee761997-08-04 16:34:36 +000033RANLIB = @RANLIB@
34LN_S = @LN_S@
Alexandre Julliard51662371999-05-15 10:41:15 +000035DIVINCL = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include
Alexandre Julliard18f92e71996-07-17 20:02:21 +000036ALLCFLAGS = $(CFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL) $(X_CFLAGS)
Alexandre Julliardff8331e1995-09-18 11:19:54 +000037LDCOMBINE = ld -r
Todd Vierling4b992b01998-12-15 15:26:27 +000038LDSHARED = @LDSHARED@
Alexandre Julliard641ee761997-08-04 16:34:36 +000039AR = ar rc
Alexandre Julliardff8331e1995-09-18 11:19:54 +000040RM = rm -f
Patrik Stridvalla9be64e1999-07-31 17:39:44 +000041MV = mv
Alexandre Julliard829fe321998-07-26 14:27:39 +000042MKDIR = mkdir -p
Alexandre Julliardc7c217b1998-04-13 12:21:30 +000043C2MAN = @C2MAN@
James Juranffe6b761999-06-12 08:21:57 +000044LDCONFIG = @LDCONFIG@
Alexandre Julliard829fe321998-07-26 14:27:39 +000045MANSPECS = -w $(TOPSRCDIR)/relay32/gdi32.spec \
46 -w $(TOPSRCDIR)/relay32/user32.spec \
47 -w $(TOPSRCDIR)/relay32/comctl32.spec \
48 -w $(TOPSRCDIR)/relay32/comdlg32.spec \
49 -w $(TOPSRCDIR)/relay32/kernel32.spec
Patrik Stridvalla9be64e1999-07-31 17:39:44 +000050LINT = @LINT@
51LINTFLAGS = @LINTFLAGS@
52ALLLINTFLAGS = $(LINTFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL)
Patrik Stridvall385dc181999-09-29 10:24:19 +000053WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi_check/winapi_check
Alexandre Julliardc6c09441997-01-12 18:32:19 +000054BUILD = $(TOPOBJDIR)/tools/build@PROGEXT@
55MAKEDEP = $(TOPOBJDIR)/tools/makedep@PROGEXT@
56WINERC = $(TOPOBJDIR)/rc/winerc@PROGEXT@
Alexandre Julliarda845b881998-06-01 10:44:35 +000057WRC = $(TOPOBJDIR)/tools/wrc/wrc@PROGEXT@
Bertho Stultiensd1895a71999-04-25 18:31:35 +000058WRCFLAGS = -c
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +000059WINESTUB = $(TOPOBJDIR)/library/winestub.o
Alexandre Julliard18f92e71996-07-17 20:02:21 +000060SUBMAKE = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'OPTIONS=$(OPTIONS)'
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
77
Ulrich Weigand3dff7bb1999-07-11 13:58:31 +000078OBJS = $(C_SRCS:.c=.o) $(GEN_ASM_SRCS:.s=.o) $(ASM_SRCS:.S=.o) $(RC_SRCS:.rc=.o) \
79 $(SPEC_SRCS:.spec=.spec.o) $(GLUE:.c=.glue.o) $(EXTRA_OBJS)
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +000080
Patrik Stridvalla9be64e1999-07-31 17:39:44 +000081LINTS = $(C_SRCS:.c=.ln)
82
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +000083# Implicit rules
84
Patrik Stridvall0691a591999-07-31 14:45:22 +000085.SUFFIXES:
Ulrich Weigand8336cc91999-08-15 12:45:53 +000086.SUFFIXES: .rc .res .spec .spec.c .spec.o .glue.c $(SUFFIXES)
Alexandre Julliardff8331e1995-09-18 11:19:54 +000087
88.c.o:
89 $(CC) -c $(ALLCFLAGS) -o $*.o $<
90
Patrik Stridvall0691a591999-07-31 14:45:22 +000091.spec.c.spec.o:
92 $(CC) -c $(ALLCFLAGS) @GCC_NO_BUILTIN@ -o $*.spec.o $<
93
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +000094.s.o:
Patrik Stridvall1439f721998-10-11 17:12:21 +000095 $(AS) -o $*.o $<
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +000096
Alexandre Julliardff8331e1995-09-18 11:19:54 +000097.S.o:
98 $(CC) -c -o $*.o $<
99
Alexandre Julliarda845b881998-06-01 10:44:35 +0000100.rc.s:
101 $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) $<
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000102
103.rc.h:
Alexandre Julliarda845b881998-06-01 10:44:35 +0000104 $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) -nh $<
105
106.rc.res:
107 $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) -r $<
108
109.res.s:
110 $(WRC) $(WRCFLAGS) $(WRCEXTRA) -b $<
111
112.res.h:
113 $(WRC) $(WRCFLAGS) $(WRCEXTRA) -bnh $<
114
Ulrich Weigand3dff7bb1999-07-11 13:58:31 +0000115.spec.spec.c:
Ulrich Weigand4b32fd01999-07-15 14:51:40 +0000116 $(BUILD) @BUILDFLAGS@ -o $@ -spec $<
Ulrich Weigand3dff7bb1999-07-11 13:58:31 +0000117
Ulrich Weigand8336cc91999-08-15 12:45:53 +0000118.c.glue.c:
Ulrich Weigand4b32fd01999-07-15 14:51:40 +0000119 $(BUILD) @BUILDFLAGS@ -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 Julliarda845b881998-06-01 10:44:35 +0000124# Rule to rebuild the resource compiler
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000125
126$(WINERC) check_winerc:
Alexandre Julliardc6c09441997-01-12 18:32:19 +0000127 cd $(TOPOBJDIR)/rc; $(SUBMAKE) winerc@PROGEXT@
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000128
Alexandre Julliarda845b881998-06-01 10:44:35 +0000129$(WRC) check_wrc:
130 cd $(TOPOBJDIR)/tools/wrc; $(SUBMAKE) wrc@PROGEXT@
131
Alexandre Julliardc6c09441997-01-12 18:32:19 +0000132# Rule to rebuild the 'makedep' program
Alexandre Julliard530ee841996-10-23 16:59:13 +0000133
134$(MAKEDEP) check_makedep:
Alexandre Julliardc6c09441997-01-12 18:32:19 +0000135 cd $(TOPOBJDIR)/tools; $(SUBMAKE) makedep@PROGEXT@
136
137# Rule to rebuild the 'build' program
138
139$(BUILD) checkbuild:
140 cd $(TOPOBJDIR)/tools; $(SUBMAKE) build@PROGEXT@
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000141
142# Rule for main module
143
Marcus Meissner96075121999-10-13 13:45:15 +0000144$(MODULE).o: $(OBJS) Makefile.in $(TOPSRCDIR)/Make.rules.in
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000145 $(LDCOMBINE) $(OBJS) -o $(MODULE).o
146
Alexandre Julliarde66d4211999-03-14 15:22:29 +0000147# Rules for makefile
148
Marcus Meissnerca004e51999-01-03 12:26:22 +0000149Makefile: Makefile.in $(TOPSRCDIR)/configure
150 @echo Makefile is older than $?, please rerun $(TOPSRCDIR)/configure
151 @exit 1
152
Alexandre Julliarde66d4211999-03-14 15:22:29 +0000153all: Makefile
154
Alexandre Julliard829fe321998-07-26 14:27:39 +0000155# Rules for auto documentation
Alexandre Julliard44ed71f1997-12-21 19:17:50 +0000156
157man: $(C_SRCS)
Alexandre Julliard829fe321998-07-26 14:27:39 +0000158 for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/man3w -S3w $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done
159
160html: $(C_SRCS)
161 for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/html -Th -iwindows.h $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done
162
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000163# Rule for linting
164
Patrik Stridvalla9be64e1999-07-31 17:39:44 +0000165$(MODULE).ln : $(LINTS)
166 if test "$(LINTS)" ; \
167 then \
168 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
169 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
170 else \
171 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
172 fi
173
174lint:: $(MODULE).ln
Alexandre Julliard46ea8b31998-05-03 19:01:20 +0000175
Patrik Stridvall385dc181999-09-29 10:24:19 +0000176# Rules for Windows API checking
177
178winapi_check::
179 $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
180
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000181# Misc. rules
182
Ulrich Weigand3dff7bb1999-07-11 13:58:31 +0000183$(SPEC_SRCS:.spec=.spec.c): $(BUILD) $(TOPSRCDIR)/include/builtin16.h $(TOPSRCDIR)/include/builtin32.h
184
Ulrich Weigand8336cc91999-08-15 12:45:53 +0000185$(GLUE:.c=.glue.c): $(BUILD) $(TOPSRCDIR)/include/builtin16.h $(TOPSRCDIR)/include/builtin32.h
Ulrich Weigand3dff7bb1999-07-11 13:58:31 +0000186
Alexandre Julliard3db94ef1997-09-28 17:43:24 +0000187depend:: $(MAKEDEP) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS)
188 $(MAKEDEP) $(DIVINCL) -C$(SRCDIR) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS)
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000189
190clean::
Ulrich Weigand8336cc91999-08-15 12:45:53 +0000191 $(RM) *.o *.ln \#*\# *~ *% .#* *.bak *.orig *.rej *.flc y.tab.c y.tab.h lex.yy.c core $(GEN_ASM_SRCS) $(RC_SRCS:.rc=.s) $(RC_SRCS:.rc=.h) $(SPEC_SRCS:.spec=.spec.c) $(GLUE:.c=.glue.c) $(PROGRAMS)
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000192
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000193dummy:
Alexandre Julliardd7d4fdf1995-12-26 15:05:24 +0000194
195# End of global rules