Implemented NetQueryDisplayInformation, NetUserGetInfo, created
[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 # EXTRA_SRCS   : extra source files for make depend
17 # EXTRA_OBJS   : extra object files
18 # IMPORTS      : dlls to import
19 # DELAYIMPORTS : dlls to import in delayed mode
20 # SUBDIRS      : subdirectories that contain a Makefile
21 # EXTRASUBDIRS : subdirectories that do not contain a Makefile
22 # INSTALLSUBDIRS : subdirectories to run make install/uninstall into
23
24 # First some useful definitions
25
26 SHELL     = /bin/sh
27 CC        = @CC@
28 CPP       = @CPP@
29 CFLAGS    = @CFLAGS@ $(EXTRACFLAGS)
30 OPTIONS   = @OPTIONS@ -D_REENTRANT
31 X_CFLAGS  = @X_CFLAGS@
32 X_LIBS    = @X_LIBS@
33 XLIB      = @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@
34 LIBS      = @LIBS@
35 YACC      = @YACC@
36 LEX       = @LEX@
37 LEXLIB    = @LEXLIB@
38 EXEEXT    = @EXEEXT@
39 OBJEXT    = @OBJEXT@
40 LIBEXT    = @LIBEXT@
41 DLLEXT    = @DLLEXT@
42 CROSSCC   = @CROSSCC@
43 LDSHARED  = @LDSHARED@
44 DLLWRAP   = @DLLWRAP@
45 DLLWRAPFLAGS = --add-stdcall-alias
46 AR        = @AR@ rc
47 RANLIB    = @RANLIB@
48 STRIP     = @STRIP@
49 WINDRES   = @WINDRES@
50 LN        = @LN@
51 LN_S      = @LN_S@
52 TOOLSDIR  = @TOOLSDIR@
53 DIVINCL   = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include $(EXTRAINCL)
54 ALLCFLAGS = $(DIVINCL) $(CFLAGS) $(DEFS) $(OPTIONS) $(X_CFLAGS)
55 LD        = @LD@
56 LDFLAGS   = @LDFLAGS@
57 LDCOMBINE = $(LD) -r
58 RM        = rm -f
59 MV        = mv
60 C2MAN     = @C2MAN@
61 MANSPECS  = -w $(TOPSRCDIR)/dlls/gdi/gdi32.spec \
62             -w $(TOPSRCDIR)/dlls/user/user32.spec \
63             -w $(TOPSRCDIR)/dlls/comctl32/comctl32.spec \
64             -w $(TOPSRCDIR)/dlls/commdlg/comdlg32.spec \
65             -w $(TOPSRCDIR)/dlls/kernel/kernel32.spec
66 LINT      = @LINT@
67 LINTFLAGS = @LINTFLAGS@
68 ALLLINTFLAGS = $(LINTFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL)
69 MKINSTALLDIRS= $(TOPSRCDIR)/tools/mkinstalldirs
70 WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi_check/winapi_check
71 WINEWRAPPER  = $(TOPSRCDIR)/tools/winewrapper
72 RUNTEST      = $(TOPSRCDIR)/programs/winetest/runtest
73 WINEBUILD    = $(TOOLSDIR)/tools/winebuild/winebuild
74 MAKEDEP      = $(TOOLSDIR)/tools/makedep
75 WRC          = $(TOOLSDIR)/tools/wrc/wrc
76 WMC          = $(TOOLSDIR)/tools/wmc/wmc
77 LDPATH    = @LDPATH@
78 DLLDIR    = $(TOPOBJDIR)/dlls
79 LIBWINE   = -L$(TOPOBJDIR)/library -lwine
80 LIBTSX11  = -L$(TOPOBJDIR)/tsx11 -lwine_tsx11
81 LIBUNICODE= -L$(TOPOBJDIR)/unicode -lwine_unicode
82 LIBUUID   = -L$(TOPOBJDIR)/ole -lwine_uuid
83
84 @SET_MAKE@
85
86 # Installation infos
87
88 INSTALL         = @INSTALL@ $(INSTALL_FLAGS)
89 INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(INSTALL_PROGRAM_FLAGS)
90 INSTALL_SCRIPT  = @INSTALL_SCRIPT@ $(INSTALL_SCRIPT_FLAGS)
91 INSTALL_DATA    = @INSTALL_DATA@ $(INSTALL_DATA_FLAGS)
92 prefix          = @prefix@
93 exec_prefix     = @exec_prefix@
94 bindir          = @bindir@
95 libdir          = @libdir@
96 datadir         = @datadir@
97 infodir         = @infodir@
98 mandir          = @mandir@
99 sysconfdir      = @sysconfdir@
100 includedir      = @includedir@/wine
101 dlldir          = @libdir@/wine
102 prog_manext     = 1
103 conf_manext     = 5
104 CLEAN_FILES     = *.o *.a *.so *.ln *.$(LIBEXT) \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej \
105                   *.flc *.spec.c *.spec.def *.glue.c *.dbg.c y.tab.c y.tab.h @LEX_OUTPUT_ROOT@.c core
106
107 OBJS = $(C_SRCS:.c=.o) $(GEN_C_SRCS:.c=.o) $(GEN_ASM_SRCS:.s=.o) $(ASM_SRCS:.S=.o) $(EXTRA_OBJS)
108
109 RCOBJS = $(RC_SRCS:.rc=.res.o)
110 LINTS  = $(C_SRCS:.c=.ln)
111
112 # Implicit rules
113
114 .SUFFIXES: .mc .rc .mc.rc .res .res.o .spec .spec.c .spec.def .pl .ok .cross.o
115
116 .c.o:
117         $(CC) -c $(ALLCFLAGS) -o $@ $<
118
119 .c.cross.o:
120         $(CROSSCC) -c $(ALLCFLAGS) -o $@ $<
121
122 .s.o:
123         $(AS) -o $@ $<
124
125 .S.o:
126         $(CC) -c -o $@ $<
127
128 .mc.mc.rc:
129         $(LDPATH) $(WMC) -i -H /dev/null -o $@ $<
130
131 .rc.res:
132         $(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -r $<
133
134 .res.res.o:
135         $(WINDRES) -i $< -o $@
136
137 .spec.spec.c:
138         $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -M $(MODULE) -spec $<
139
140 .spec.spec.def:
141         $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -def $<
142
143 .c.ln:
144         $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
145
146 .c.ok:
147         $(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
148
149 .pl.ok:
150         $(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
151
152 # 'all' target first in case the enclosing Makefile didn't define any target
153
154 all: Makefile
155
156 filter:
157         @$(TOPSRCDIR)/tools/winapi/make_filter --make $(MAKE) all
158
159 .PHONY: all filter
160
161 # Rule for main module debug channels
162
163 $(MODULE).dbg.c: $(C_SRCS) $(WINEBUILD)
164         $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -debug -C$(SRCDIR) $(C_SRCS)
165
166 # Rule for 16-bit glue
167
168 $(MODULE).glue.c: $(C_SRCS) $(WINEBUILD)
169         $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -glue -C$(SRCDIR) $(C_SRCS)
170
171 # Rule to rebuild the tools
172
173 $(MAKEDEP) $(WINEBUILD) $(WMC) $(WRC):
174         cd $(TOOLSDIR)/tools && $(MAKE) `basename $@`
175
176 # Rules for makefile
177
178 Makefile: Makefile.in $(TOPSRCDIR)/configure
179         @echo Makefile is older than $?, please rerun $(TOPSRCDIR)/configure
180         @exit 1
181
182 # Rules for auto documentation
183
184 $(SUBDIRS:%=%/__man__): dummy
185         cd `dirname $@` && $(MAKE) man
186
187 man: $(C_SRCS) $(SUBDIRS:%=%/__man__)
188         if [ -n "$(C_SRCS)" ]; then $(MKINSTALLDIRS) $(TOPOBJDIR)/documentation/man3w; for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/man3w -S3w $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done; fi
189
190 $(SUBDIRS:%=%/__doc_html__): dummy
191         cd `dirname $@` && $(MAKE) doc-html
192
193 doc-html: $(C_SRCS) $(SUBDIRS:%=%/__doc_html__)
194         if [ -n "$(C_SRCS)" ]; then $(MKINSTALLDIRS) $(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
195
196 .PHONY: man doc-html $(SUBDIRS:%=%/__man__) $(SUBDIRS:%=%/__doc_html__)
197
198 # Rule for linting
199
200 $(MODULE).ln : $(LINTS)
201         if test "$(LINTS)" ; \
202         then \
203                 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
204                 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
205         else \
206                 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
207         fi
208
209 lint:: $(MODULE).ln
210
211 # Rules for Windows API checking
212
213 winapi_check:: dummy
214         $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
215
216 .PHONY: winapi_check
217
218 # Rules for dependencies
219
220 $(SUBDIRS:%=%/__depend__): $(MAKEDEP) dummy
221         cd `dirname $@` && $(MAKE) depend
222
223 depend: $(MAKEDEP) $(SUBDIRS:%=%/__depend__)
224         $(MAKEDEP) $(DIVINCL) -C$(SRCDIR) $(C_SRCS) $(RC_SRCS) $(RC_SRCS16) $(MC_SRCS) $(EXTRA_SRCS)
225
226 .PHONY: depend $(SUBDIRS:%=%/__depend__)
227
228 # Rules for cleaning
229
230 $(SUBDIRS:%=%/__clean__): dummy
231         cd `dirname $@` && $(MAKE) clean
232
233 $(SUBDIRS:%=%/__testclean__): dummy
234         cd `dirname $@` && $(MAKE) testclean
235
236 $(EXTRASUBDIRS:%=%/__clean__): dummy
237         -cd `dirname $@` && $(RM) $(CLEAN_FILES)
238
239 testclean:: $(SUBDIRS:%=%/__testclean__)
240
241 clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
242         $(RM) $(CLEAN_FILES) $(GEN_C_SRCS) $(GEN_ASM_SRCS) $(RC_SRCS:.rc=.res) $(RC_SRCS16:.rc=.res) $(MC_SRCS:.mc=.mc.rc) $(PROGRAMS)
243
244 .PHONY: clean testclean $(SUBDIRS:%=%/__clean__) $(SUBDIRS:%=%/__testclean__) $(EXTRASUBDIRS:%=%/__clean__)
245
246 # Rules for installing
247
248 $(INSTALLSUBDIRS:%=%/__install__): dummy
249         cd `dirname $@` && $(MAKE) install
250
251 $(INSTALLSUBDIRS:%=%/__uninstall__): dummy
252         cd `dirname $@` && $(MAKE) uninstall
253
254 install:: $(INSTALLSUBDIRS:%=%/__install__)
255
256 uninstall:: $(INSTALLSUBDIRS:%=%/__uninstall__)
257
258 .PHONY: install uninstall $(INSTALLSUBDIRS:%=%/__install__) $(INSTALLSUBDIRS:%=%/__uninstall__)
259
260 # Rules for checking that no imports are missing
261
262 $(SUBDIRS:%=%/__checklink__): dummy
263         @cd `dirname $@` && $(MAKE) checklink
264
265 .PHONY: checklink $(SUBDIRS:%=%/__checklink__)
266
267 # Rules for testing
268
269 $(SUBDIRS:%=%/__test__): dummy
270         @cd `dirname $@` && $(MAKE) test
271
272 $(SUBDIRS:%=%/__crosstest__): dummy
273         @cd `dirname $@` && $(MAKE) crosstest
274
275 .PHONY: check test crosstest $(SUBDIRS:%=%/__test__) $(SUBDIRS:%=%/__crosstest__)
276
277 # Misc. rules
278
279 $(SPEC_SRCS:.spec=.spec.c): $(WINEBUILD)
280
281 $(RC_SRCS:.rc=.res): $(WRC)
282
283 $(RC_SRCS16:.rc=.res): $(WRC)
284
285 $(MC_SRCS:.mc=.mc.rc): $(WMC)
286
287 $(SUBDIRS): dummy
288         @cd $@ && $(MAKE)
289
290 dummy:
291
292 .PHONY: dummy $(SUBDIRS)
293
294 # End of global rules