Revived the GEN_C_SRCS variable to support wrc lex/yacc sources.
[wine] / Make.rules.in
1 # Global rules shared by all makefiles     -*-Makefile-*-
2 #
3 # Each individual makefile must define the following variables:
4 # 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
8 #
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_C_SRCS   : generated C files
13 # 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
22
23 # First some useful definitions
24
25 SHELL     = /bin/sh
26 CC        = @CC@
27 CPP       = @CPP@
28 CFLAGS    = @CFLAGS@
29 OPTIONS   = @OPTIONS@ -D_REENTRANT
30 X_CFLAGS  = @X_CFLAGS@
31 X_LIBS    = @X_LIBS@
32 XLIB      = @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@
33 DLL_LINK  = @DLL_LINK@
34 LIBS      = @LIBS@
35 YACC      = @YACC@
36 LEX       = @LEX@
37 LEXLIB    = @LEXLIB@
38 RANLIB    = @RANLIB@
39 LN_S      = @LN_S@
40 DIVINCL   = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include
41 ALLCFLAGS = $(DIVINCL) $(CFLAGS) $(DEFS) $(OPTIONS) $(X_CFLAGS)
42 LDCOMBINE = ld -r
43 AR        = ar rc
44 RM        = rm -f
45 MV        = mv
46 MKDIR     = mkdir -p
47 C2MAN     = @C2MAN@
48 MANSPECS  = -w $(TOPSRCDIR)/relay32/gdi32.spec \
49             -w $(TOPSRCDIR)/relay32/user32.spec \
50             -w $(TOPSRCDIR)/relay32/comctl32.spec \
51             -w $(TOPSRCDIR)/relay32/comdlg32.spec \
52             -w $(TOPSRCDIR)/relay32/kernel32.spec 
53 LINT      = @LINT@
54 LINTFLAGS = @LINTFLAGS@
55 ALLLINTFLAGS = $(LINTFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL)
56 WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi_check/winapi_check
57 BUILD     = $(TOPOBJDIR)/tools/build@PROGEXT@
58 MAKEDEP   = $(TOPOBJDIR)/tools/makedep@PROGEXT@
59 WRC       = $(TOPOBJDIR)/tools/wrc/wrc@PROGEXT@
60 WRCFLAGS  = -c
61 DLLDIR    = $(TOPOBJDIR)/dlls
62 @SET_MAKE@
63
64 # Installation infos
65
66 INSTALL         = @INSTALL@
67 INSTALL_PROGRAM = @INSTALL_PROGRAM@
68 INSTALL_DATA    = @INSTALL_DATA@
69 prefix          = @prefix@
70 exec_prefix     = @exec_prefix@
71 bindir          = @bindir@
72 libdir          = @libdir@
73 infodir         = @infodir@
74 mandir          = @mandir@
75 prog_manext     = 1
76 conf_manext     = 5
77 includedir      = @includedir@/wine
78 CLEAN_FILES     = *.o *.a *.so *.ln \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej \
79                   *.flc *.spec.c *.glue.c y.tab.c y.tab.h lex.yy.c core
80
81 OBJS = $(SPEC_SRCS:.spec=.spec.o) $(C_SRCS:.c=.o) $(GEN_C_SRCS:.c=.o) $(GEN_ASM_SRCS:.s=.o) \
82        $(ASM_SRCS:.S=.o) $(RC_SRCS:.rc=.o) $(GLUE:.c=.glue.o) $(EXTRA_OBJS)
83
84 LINTS = $(C_SRCS:.c=.ln)
85
86 # DLL list
87
88 X_DLLS = \
89         ddraw \
90         @OPENGL32_DLL@ \
91         x11drv
92
93 DLLS = \
94         @X_DLLS@ \
95         avifil32 \
96         comctl32 \
97         comdlg32 \
98         dciman32 \
99         dinput \
100         dplayx \
101         dsound \
102         gdi32 \
103         icmp \
104         imagehlp \
105         imm32 \
106         joystick.drv \
107         lz32 \
108         mcianim.drv \
109         mciavi.drv \
110         mcicda.drv \
111         mciseq.drv \
112         mciwave.drv \
113         midimap.drv \
114         mpr \
115         msacm \
116         msacm.drv \
117         msacm32 \
118         msnet32 \
119         msvfw32 \
120         odbc32 \
121         ole32 \
122         oleaut32 \
123         olecli32 \
124         oledlg \
125         olepro32 \
126         olesvr32 \
127         psapi \
128         rasapi32 \
129         riched32 \
130         setupx \
131         shell32 \
132         sound \
133         stress \
134         tapi32 \
135         ttydrv \
136         urlmon \
137         user32 \
138         version \
139         w32skrnl \
140         win87em \
141         windebug \
142         wineoss.drv \
143         wing \
144         wininet \
145         winmm \
146         winspool.drv \
147         wnaspi32 \
148         wsock32
149
150 # Implicit rules
151
152 .SUFFIXES:
153 .SUFFIXES: .rc .res .spec .spec.c .spec.o .glue.c $(SUFFIXES)
154
155 .c.o:
156         $(CC) -c $(ALLCFLAGS) -o $*.o $<
157
158 .spec.c.spec.o:
159         $(CC) -c $(ALLCFLAGS) @GCC_NO_BUILTIN@ -o $*.spec.o $<
160
161 .s.o:
162         $(AS) -o $*.o $<  
163
164 .S.o:
165         $(CC) -c -o $*.o $<  
166
167 .rc.s:
168         $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) $<
169
170 .rc.h:
171         $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) -nh $<
172
173 .rc.res:
174         $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) -r $<
175
176 .res.s:
177         $(WRC) $(WRCFLAGS) $(WRCEXTRA) -b $<
178
179 .res.h:
180         $(WRC) $(WRCFLAGS) $(WRCEXTRA) -bnh $<
181
182 .spec.spec.c:
183         $(BUILD) @BUILDFLAGS@ -o $@ -spec $<
184
185 .c.glue.c:
186         $(BUILD) @BUILDFLAGS@ -o $@ -glue $<
187
188 .c.ln:
189         $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
190
191 .PHONY: all install uninstall clean distclean depend dummy
192
193 # 'all' target first in case the enclosing Makefile didn't define any target
194
195 all: Makefile
196
197 # Rule to rebuild the resource compiler
198
199 $(WRC) check_wrc:
200         cd $(TOPOBJDIR)/tools/wrc && $(MAKE) wrc@PROGEXT@
201
202 # Rule to rebuild the 'makedep' program
203
204 $(MAKEDEP) check_makedep:
205         cd $(TOPOBJDIR)/tools && $(MAKE) makedep@PROGEXT@
206
207 # Rule to rebuild the 'build' program
208
209 $(BUILD) checkbuild:
210         cd $(TOPOBJDIR)/tools && $(MAKE) build@PROGEXT@
211
212 # Rule for main module
213
214 $(MODULE).o: $(OBJS) Makefile.in $(TOPSRCDIR)/Make.rules.in
215         $(LDCOMBINE) $(OBJS) -o $(MODULE).o
216
217 # Rules for makefile
218
219 Makefile: Makefile.in $(TOPSRCDIR)/configure
220         @echo Makefile is older than $?, please rerun $(TOPSRCDIR)/configure
221         @exit 1
222
223 # Rules for auto documentation
224
225 man: $(C_SRCS)
226         for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/man3w -S3w $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done
227
228 html: $(C_SRCS)
229         for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/html -Th -iwindows.h  $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done
230
231 # Rule for linting
232
233 $(MODULE).ln : $(LINTS)
234         if test "$(LINTS)" ; \
235         then \
236                 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
237                 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
238         else \
239                 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
240         fi
241
242 lint:: $(MODULE).ln
243
244 # Rules for Windows API checking
245
246 winapi_check::
247         $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
248
249 # Rules for dependencies
250
251 $(SUBDIRS:%=%/__depend__): $(MAKEDEP) dummy
252         cd `dirname $@` && $(MAKE) depend
253
254 depend: $(MAKEDEP) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS) $(GEN_C_SRCS) $(SUBDIRS:%=%/__depend__)
255         $(MAKEDEP) $(DIVINCL) -C$(SRCDIR) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS) -C. $(GEN_C_SRCS)
256
257 # Rules for cleaning
258
259 $(SUBDIRS:%=%/__clean__): dummy
260         cd `dirname $@` && $(MAKE) clean
261
262 $(EXTRASUBDIRS:%=%/__clean__): dummy
263         -cd `dirname $@` && $(RM) $(CLEAN_FILES)
264
265 clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
266         $(RM) $(CLEAN_FILES) $(GEN_C_SRCS) $(GEN_ASM_SRCS) $(RC_SRCS:.rc=.s) $(RC_SRCS:.rc=.h) $(PROGRAMS)
267
268 # Misc. rules
269
270 $(SPEC_SRCS:.spec=.spec.c): $(BUILD) $(TOPSRCDIR)/include/builtin16.h $(TOPSRCDIR)/include/builtin32.h
271
272 $(GLUE:.c=.glue.c): $(BUILD) $(TOPSRCDIR)/include/builtin16.h $(TOPSRCDIR)/include/builtin32.h
273
274 $(RC_SRCS:.rc=.s): $(WRC)
275
276 $(SUBDIRS): dummy
277         @cd $@ && $(MAKE)
278
279 dummy:
280
281 # End of global rules