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