r18264: print the full list of flags
[samba.git] / source / main.mk
1 all: showflags $(ALL_PREDEP) bin/asn1_compile bin/compile_et binaries libraries modules
2
3 include dynconfig.mk
4 include heimdal_build/config.mk
5 include config.mk
6 include dsdb/config.mk
7 include gtk/config.mk
8 include smbd/config.mk
9 include smbd/process_model.mk
10 include libnet/config.mk
11 include auth/config.mk
12 include nsswitch/config.mk
13 include lib/basic.mk
14 include param/config.mk
15 include smb_server/config.mk
16 include rpc_server/config.mk
17 include ldap_server/config.mk
18 include web_server/config.mk
19 include winbind/config.mk
20 include nbt_server/config.mk
21 include wrepl_server/config.mk
22 include cldap_server/config.mk
23 include utils/net/config.mk
24 include utils/config.mk
25 include ntvfs/config.mk
26 include ntptr/config.mk
27 include torture/config.mk
28 include librpc/config.mk
29 include client/config.mk
30 include libcli/config.mk
31 include scripting/ejs/config.mk
32 include scripting/swig/config.mk
33 include kdc/config.mk
34 include passdb/config.mk
35
36 DEFAULT_HEADERS = $(srcdir)/include/core.h \
37                                   $(srcdir)/lib/util/dlinklist.h \
38                                   $(srcdir)/version.h
39
40 binaries: $(BINARIES)
41 libraries: $(STATIC_LIBS) $(SHARED_LIBS)
42 modules: $(SHARED_MODULES)
43 headers: $(PUBLIC_HEADERS) $(DEFAULT_HEADERS)
44 manpages: $(MANPAGES)
45 everything: all
46
47 showlayout: 
48         @echo 'Samba will be installed into:'
49         @echo '  basedir:     $(BASEDIR)'
50         @echo '  bindir:      $(BINDIR)'
51         @echo '  sbindir:     $(SBINDIR)'
52         @echo '  libdir:      $(LIBDIR)'
53         @echo '  modulesdir:  $(MODULESDIR)'
54         @echo '  includedir:  $(INCLUDEDIR)'
55         @echo '  vardir:      $(VARDIR)'
56         @echo '  privatedir:  $(PRIVATEDIR)'
57         @echo '  piddir:      $(PIDDIR)'
58         @echo '  lockdir:     $(LOCKDIR)'
59         @echo '  logfilebase: $(LOGFILEBASE)'
60         @echo '  setupdir:    $(SETUPDIR)'
61         @echo '  jsdir:       $(JSDIR)'
62         @echo '  swatdir:     $(SWATDIR)'
63         @echo '  mandir:      $(MANDIR)'
64         @echo '  datadir:     $(DATADIR)'
65         @echo '  winbindd_socket_dir:  $(WINBINDD_SOCKET_DIR)'
66
67 showflags:
68         @echo 'Samba will be compiled with flags:'
69         @echo '  CPP        = $(CPP)'
70         @echo '  CPPFLAGS   = $(CPPFLAGS)'
71         @echo '  CC         = $(CC)'
72         @echo '  CFLAGS     = $(CFLAGS)'
73         @echo '  PICFLAG    = $(PICFLAG)'
74         @echo '  LD         = $(LD)'
75         @echo '  LDFLAGS    = $(LDFLAGS)'
76         @echo '  STLD       = $(STLD)'
77         @echo '  STLD_FLAGS = $(STLD_FLAGS)'
78         @echo '  SHLD       = $(SHLD)'
79         @echo '  SHLD_FLAGS = $(SHLD_FLAGS)'
80         @echo '  SHLIBEXT   = $(SHLIBEXT)'
81
82 # The permissions to give the executables
83 INSTALLPERMS = 0755
84
85 # set these to where to find various files
86 # These can be overridden by command line switches (see smbd(8))
87 # or in smb.conf (see smb.conf(5))
88 CONFIGFILE = $(CONFIGDIR)/smb.conf
89 PKGCONFIGDIR = $(LIBDIR)/pkgconfig
90 LMHOSTSFILE = $(CONFIGDIR)/lmhosts
91
92 install: showlayout installbin installdat installswat installmisc installlib \
93         installheader installpc installplugins
94
95 # DESTDIR is used here to prevent packagers wasting their time
96 # duplicating the Makefile. Remove it and you will have the privilege
97 # of packaging each samba release for multiple versions of multiple
98 # distributions and operating systems, or at least supplying patches
99 # to all the packaging files required for this, prior to committing
100 # the removal of DESTDIR. Do not remove it even though you think it
101 # is not used.
102
103 installdirs:
104         @$(SHELL) $(srcdir)/script/installdirs.sh \
105                 $(DESTDIR)$(BASEDIR) \
106                 $(DESTDIR)$(BINDIR) \
107                 $(DESTDIR)$(SBINDIR) \
108                 $(DESTDIR)$(LIBDIR) \
109                 $(DESTDIR)$(MODULESDIR) \
110                 $(DESTDIR)$(MANDIR) \
111                 $(DESTDIR)$(VARDIR) \
112                 $(DESTDIR)$(PRIVATEDIR) \
113                 $(DESTDIR)$(DATADIR) \
114                 $(DESTDIR)$(PIDDIR) \
115                 $(DESTDIR)$(LOCKDIR) \
116                 $(DESTDIR)$(LOGFILEBASE) \
117                 $(DESTDIR)$(PRIVATEDIR)/tls \
118                 $(DESTDIR)$(INCLUDEDIR) \
119                 $(DESTDIR)$(PKGCONFIGDIR) \
120                 $(DESTDIR)$(CONFIGDIR) \
121
122 installbin: $(SBIN_PROGS) $(BIN_PROGS) installdirs
123         @$(SHELL) $(srcdir)/script/installbin.sh \
124                 $(INSTALLPERMS) \
125                 $(DESTDIR)$(BASEDIR) \
126                 $(DESTDIR)$(SBINDIR) \
127                 $(DESTDIR)$(LIBDIR) \
128                 $(DESTDIR)$(VARDIR) \
129                 $(SBIN_PROGS)
130         @$(SHELL) $(srcdir)/script/installbin.sh \
131                 $(INSTALLPERMS) \
132                 $(DESTDIR)$(BASEDIR) \
133                 $(DESTDIR)$(BINDIR) \
134                 $(DESTDIR)$(LIBDIR) \
135                 $(DESTDIR)$(VARDIR) \
136                 $(BIN_PROGS)
137
138 installlib: $(INSTALLABLE_SHARED_LIBS) $(STATIC_LIBS) installdirs
139         @$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(LIBDIR) "$(SHLIBEXT)" $(INSTALLABLE_SHARED_LIBS) 
140         @$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(LIBDIR) "$(STLIBEXT)" $(STATIC_LIBS)
141
142 installheader: headers installdirs
143         @$(PERL) $(srcdir)/script/installheader.pl $(DESTDIR)$(INCLUDEDIR) $(PUBLIC_HEADERS) $(DEFAULT_HEADERS)
144
145 installdat: installdirs
146         @$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(DATADIR) $(srcdir)
147
148 installswat: installdirs
149         @$(SHELL) $(srcdir)/script/installswat.sh $(DESTDIR)$(SWATDIR) $(srcdir)
150
151 installman: manpages installdirs
152         @$(SHELL) $(srcdir)/script/installman.sh $(DESTDIR)$(MANDIR) $(MANPAGES)
153
154 installmisc: installdirs
155         @$(SHELL) $(srcdir)/script/installmisc.sh $(srcdir) $(DESTDIR)$(JSDIR) $(DESTDIR)$(SETUPDIR) $(DESTDIR)$(BINDIR)
156
157 installpc: installdirs
158         @$(SHELL) $(srcdir)/script/installpc.sh $(builddir) $(DESTDIR)$(PKGCONFIGDIR) $(PC_FILES)
159
160 uninstall: uninstallbin uninstallman uninstallmisc uninstalllib uninstallheader \
161         uninstallplugins
162
163 uninstallmisc:
164         #FIXME
165
166 uninstallbin:
167         @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(SBIN_PROGS)
168         @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(BIN_PROGS)
169
170 uninstalllib:
171         @$(SHELL) $(srcdir)/script/uninstalllib.sh $(DESTDIR)$(LIBDIR) $(SHARED_LIBS)
172         @$(SHELL) $(srcdir)/script/uninstalllib.sh $(DESTDIR)$(LIBDIR) $(STATIC_LIBS) 
173
174 uninstallheader:
175         @$(SHELL) $(srcdir)/script/uninstallheader.sh $(DESTDIR)$(INCLUDEDIR) $(PUBLIC_HEADERS)
176
177 uninstallman:
178         @$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(MANDIR) $(MANPAGES)
179
180 Makefile: config.status $(MK_FILES)
181         ./config.status
182
183 etags:
184         etags `find $(srcdir) -name "*.[ch]"`
185
186 ctags:
187         ctags `find $(srcdir) -name "*.[ch]"`
188
189 pidl/Makefile: pidl/Makefile.PL
190         cd pidl && $(PERL) Makefile.PL 
191
192 installpidl: pidl/Makefile
193         $(MAKE) -C pidl install
194
195 uninstallpidl: pidl/Makefile
196         $(MAKE) -C pidl uninstall
197
198 $(IDL_HEADER_FILES) \
199         $(IDL_NDR_PARSE_H_FILES) $(IDL_NDR_PARSE_C_FILES) \
200         $(IDL_NDR_CLIENT_C_FILES) $(IDL_NDR_CLIENT_H_FILES) \
201         $(IDL_NDR_SERVER_C_FILES) $(IDL_SWIG_FILES) \
202         $(IDL_NDR_EJS_C_FILES) $(IDL_NDR_EJS_H_FILES): idl
203
204 idl_full: pidl/lib/Parse/Pidl/IDL.pm
205         @CPP="$(CPP)" PERL="$(PERL)" srcdir=$(srcdir) $(srcdir)/script/build_idl.sh FULL $(PIDL_ARGS)
206
207 idl: pidl/lib/Parse/Pidl/IDL.pm
208         @CPP="$(CPP)" PERL="$(PERL)" srcdir=$(srcdir) $(srcdir)/script/build_idl.sh PARTIAL $(PIDL_ARGS)
209
210 pidl/lib/Parse/Pidl/IDL.pm: pidl/idl.yp
211         -$(YAPP) -s -m 'Parse::Pidl::IDL' -o pidl/lib/Parse/Pidl/IDL.pm pidl/idl.yp 
212
213 smb_interfaces: pidl/smb_interfaces.pm
214         $(PERL) -Ipidl $(srcdir)/script/build_smb_interfaces.pl \
215                 include/smb_interfaces.h
216
217 pidl/smb_interfaces.pm: pidl/smb_interfaces.yp
218         -$(YAPP) -s -m 'smb_interfaces' -o pidl/smb_interfaces.pm pidl/smb_interfaces.yp 
219
220 include/config.h:
221         @echo "include/config.h not present"
222         @echo "You need to rerun ./autogen.sh and ./configure"
223         @/bin/false
224
225 $(srcdir)/version.h: $(srcdir)/VERSION
226         @$(SHELL) script/mkversion.sh VERSION $(srcdir)/version.h $(srcdir)/
227
228 regen_version:
229         @$(SHELL) script/mkversion.sh VERSION $(srcdir)/version.h $(srcdir)/
230
231 clean_pch:
232         @echo "Removing precompiled headers"
233         @-rm -f include/includes.h.gch
234
235 pch: clean_pch include/includes.h.gch
236
237 clean:: clean_pch
238         @echo Removing objects
239         @-find . -name '*.o' -exec rm -f '{}' \;
240         @echo Removing hostcc objects
241         @-find . -name '*.ho' -exec rm -f '{}' \;
242         @echo Removing binaries
243         @-rm -f $(BIN_PROGS) $(SBIN_PROGS) $(BINARIES)
244         @echo Removing libraries
245         @-rm -f $(STATIC_LIBRARIES) $(SHARED_LIBRARIES)
246         @-rm -f bin/*.$(SHLIBEXT)*
247         @-rm -f bin/*.a
248         @echo Removing modules
249         @-rm -f bin/modules/*/*.$(SHLIBEXT)
250         @-rm -f bin/*_init_module.c
251         @echo Removing dummy targets
252         @-rm -f bin/.*_*
253         @echo Removing generated files
254         @-rm -f bin/*_init_module.c
255         @-rm -rf librpc/gen_* 
256         @echo Removing proto headers
257         @-rm -f $(PROTO_HEADERS)
258
259 distclean: clean
260         -rm -f include/config.h include/config_tmp.h include/build.h
261         -rm -f Makefile 
262         -rm -f config.status
263         -rm -f config.log config.cache
264         -rm -f config.pm config.mk
265         -rm -f $(PC_FILES)
266
267 removebackup:
268         -rm -f *.bak *~ */*.bak */*~ */*/*.bak */*/*~ */*/*/*.bak */*/*/*~
269
270 realdistclean: distclean removebackup
271         -rm -f include/config_tmp.h.in
272         -rm -f version.h
273         -rm -f configure
274         -rm -f $(MANPAGES)
275
276 test: $(DEFAULT_TEST_TARGET)
277
278 test-swrap: all
279         $(srcdir)/script/tests/selftest.sh ${selftest_prefix} all SOCKET_WRAPPER
280
281 test-noswrap: all
282         $(srcdir)/script/tests/selftest.sh ${selftest_prefix} all
283
284 quicktest: all
285         $(srcdir)/script/tests/selftest.sh ${selftest_prefix} quick SOCKET_WRAPPER
286
287 valgrindtest: valgrindtest-quick
288
289 valgrindtest-quick: all
290         SMBD_VALGRIND="xterm -n smbd -e valgrind -q --db-attach=yes --num-callers=30" \
291         VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \
292         $(srcdir)/script/tests/selftest.sh ${selftest_prefix} quick SOCKET_WRAPPER
293
294 valgrindtest-all: all
295         SMBD_VALGRIND="xterm -n smbd -e valgrind -q --db-attach=yes --num-callers=30" \
296         VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \
297         $(srcdir)/script/tests/selftest.sh ${selftest_prefix} all SOCKET_WRAPPER
298
299 gdbtest: gdbtest-quick
300
301 gdbtest-quick: all
302         SMBD_VALGRIND="xterm -n smbd -e gdb --args " \
303         $(srcdir)/script/tests/selftest.sh ${selftest_prefix} quick SOCKET_WRAPPER
304
305 gdbtest-all: all
306         SMBD_VALGRIND="xterm -n smbd -e gdb --args " \
307         $(srcdir)/script/tests/selftest.sh ${selftest_prefix} all SOCKET_WRAPPER
308
309 wintest: all
310         $(srcdir)/script/tests/selftest.sh ${selftest_prefix} win
311
312 unused_macros:
313         $(srcdir)/script/find_unused_macros.pl `find . -name "*.[ch]"` | sort
314
315 ###############################################################################
316 # File types
317 ###############################################################################
318
319 .SUFFIXES: .x .c .et .y .l .d .o .h .h.gch .a .so .1 .1.xml .3 .3.xml .5 .5.xml .7 .7.xml .8 .8.xml .ho .idl .hd
320
321 .c.ho:
322         @echo "Compiling $< with host compiler"
323         @$(HOSTCC) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) -c $< -o $@
324
325 .c.d:
326         @echo "Generating dependencies for $<"
327         @$(CC) -M -MG -MP -MT $(<:.c=.o) -MT $@ `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) $< -o $@
328
329 .c.hd:
330         @echo "Generating host-compiler dependencies for $<"
331         @$(CC) -M -MG -MP -MT $(<:.c=.ho) -MT $@ `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) $< -o $@
332
333 include/includes.d: include/includes.h
334         @echo "Generating dependencies for $<"
335         @$(CC) -M -MG -MT include/includes.h.gch -MT $@ $(CFLAGS) $< -o $@
336
337 .c.o:
338         @if test -n "$(CC_CHECKER)"; then \
339                 echo "Checking  $< with '$(CC_CHECKER)'"; \
340                 $(CC_CHECKER) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) $(PICFLAG) -c $< -o $@; \
341         fi
342         @echo "Compiling $<"
343         @$(CC) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) $(PICFLAG) -c $< -o $@
344
345 .h.h.gch:
346         @echo "Precompiling $<"
347         @$(CC) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) $(PICFLAG) -c $< -o $@
348
349 .y.c:
350         @echo "Building $< with $(YACC)"
351         @-$(srcdir)/script/yacc_compile.sh "$(YACC)" "$<" "$@"
352
353 .l.c:
354         @echo "Building $< with $(LEX)"
355         @-$(srcdir)/script/lex_compile.sh "$(LEX)" "$<" "$@"
356
357 DOCBOOK_MANPAGE_URL = http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
358
359 .1.xml.1:
360         $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
361
362 .3.xml.3:
363         $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
364
365 .5.xml.5:
366         $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
367
368 .7.xml.7:
369         $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
370
371 .8.xml.8:
372         $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
373
374 DEP_FILES = $(patsubst %.ho,%.hd,$(patsubst %.o,%.d,$(ALL_OBJS))) \
375                    include/includes.d
376
377 dist:: distclean idl_full manpages configure
378
379 configure: 
380         ./autogen.sh
381
382 clean::
383         @echo Removing dependency files
384         @find . -name \*.d -o -name \*.hd | xargs rm -f
385