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