a0fafec3a31269940ec13290c5b621463a9e5371
[sfrench/samba-autobuild/.git] / source4 / main.mk
1 default: all
2
3 include dynconfig.mk
4 include heimdal_build/config.mk
5 include config.mk
6 include dsdb/config.mk
7 include smbd/config.mk
8 include cluster/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
35 DEFAULT_HEADERS = $(srcdir)/lib/util/dlinklist.h \
36                   $(srcdir)/version.h
37
38 binaries: $(BINARIES)
39 libraries: $(STATIC_LIBS) $(SHARED_LIBS)
40 modules: $(SHARED_MODULES)
41 headers: $(PUBLIC_HEADERS) $(DEFAULT_HEADERS)
42 manpages: $(MANPAGES)
43 all: showflags $(ALL_PREDEP) bin/asn1_compile bin/compile_et binaries modules
44 everything: all libraries headers
45
46 showlayout: 
47         @echo 'Samba will be installed into:'
48         @echo '  basedir:     $(BASEDIR)'
49         @echo '  bindir:      $(BINDIR)'
50         @echo '  sbindir:     $(SBINDIR)'
51         @echo '  libdir:      $(LIBDIR)'
52         @echo '  modulesdir:  $(MODULESDIR)'
53         @echo '  includedir:  $(INCLUDEDIR)'
54         @echo '  vardir:      $(VARDIR)'
55         @echo '  privatedir:  $(PRIVATEDIR)'
56         @echo '  piddir:      $(PIDDIR)'
57         @echo '  lockdir:     $(LOCKDIR)'
58         @echo '  logfilebase: $(LOGFILEBASE)'
59         @echo '  setupdir:    $(SETUPDIR)'
60         @echo '  jsdir:       $(JSDIR)'
61         @echo '  webappsdir:  $(WEBAPPSDIR)'
62         @echo '  servicesdir: $(SERVICESDIR)'
63         @echo '  mandir:      $(MANDIR)'
64         @echo '  torturedir:  $(TORTUREDIR)'
65         @echo '  datadir:     $(DATADIR)'
66         @echo '  winbindd_socket_dir:  $(WINBINDD_SOCKET_DIR)'
67
68 showflags:
69         @echo 'Samba will be compiled with flags:'
70         @echo '  CPP        = $(CPP)'
71         @echo '  CPPFLAGS   = $(CPPFLAGS)'
72         @echo '  CC         = $(CC)'
73         @echo '  CFLAGS     = $(CFLAGS)'
74         @echo '  PICFLAG    = $(PICFLAG)'
75         @echo '  LD         = $(LD)'
76         @echo '  LDFLAGS    = $(LDFLAGS)'
77         @echo '  STLD       = $(STLD)'
78         @echo '  STLD_FLAGS = $(STLD_FLAGS)'
79         @echo '  SHLD       = $(SHLD)'
80         @echo '  SHLD_FLAGS = $(SHLD_FLAGS)'
81         @echo '  SHLIBEXT   = $(SHLIBEXT)'
82         @echo '  srcdir     = $(srcdir)'
83         @echo '  builddir   = $(builddir)'
84         @echo '  pwd        = '`/bin/pwd`
85
86 # The permissions to give the executables
87 INSTALLPERMS = 0755
88
89 install: showlayout everything installbin installdat installwebapps installmisc installlib \
90         installheader installpc installplugins
91
92 # DESTDIR is used here to prevent packagers wasting their time
93 # duplicating the Makefile. Remove it and you will have the privilege
94 # of packaging each samba release for multiple versions of multiple
95 # distributions and operating systems, or at least supplying patches
96 # to all the packaging files required for this, prior to committing
97 # the removal of DESTDIR. Do not remove it even though you think it
98 # is not used.
99
100 installdirs:
101         @$(SHELL) $(srcdir)/script/installdirs.sh \
102                 $(DESTDIR)$(BASEDIR) \
103                 $(DESTDIR)$(BINDIR) \
104                 $(DESTDIR)$(SBINDIR) \
105                 $(DESTDIR)$(TORTUREDIR) \
106                 $(DESTDIR)$(LIBDIR) \
107                 $(DESTDIR)$(MODULESDIR) \
108                 $(DESTDIR)$(MANDIR) \
109                 $(DESTDIR)$(VARDIR) \
110                 $(DESTDIR)$(PRIVATEDIR) \
111                 $(DESTDIR)$(DATADIR) \
112                 $(DESTDIR)$(PIDDIR) \
113                 $(DESTDIR)$(LOCKDIR) \
114                 $(DESTDIR)$(LOGFILEBASE) \
115                 $(DESTDIR)$(PRIVATEDIR)/tls \
116                 $(DESTDIR)$(INCLUDEDIR) \
117                 $(DESTDIR)$(PKGCONFIGDIR) \
118                 $(DESTDIR)$(CONFIGDIR) \
119
120 installbin: $(SBIN_PROGS) $(BIN_PROGS) $(TORTURE_PROGS) installdirs
121         @$(SHELL) $(srcdir)/script/installbin.sh \
122                 $(INSTALLPERMS) \
123                 $(DESTDIR)$(BASEDIR) \
124                 $(DESTDIR)$(SBINDIR) \
125                 $(DESTDIR)$(LIBDIR) \
126                 $(DESTDIR)$(VARDIR) \
127                 $(SBIN_PROGS)
128         @$(SHELL) $(srcdir)/script/installbin.sh \
129                 $(INSTALLPERMS) \
130                 $(DESTDIR)$(BASEDIR) \
131                 $(DESTDIR)$(BINDIR) \
132                 $(DESTDIR)$(LIBDIR) \
133                 $(DESTDIR)$(VARDIR) \
134                 $(BIN_PROGS)
135         @$(SHELL) $(srcdir)/script/installtorture.sh \
136                 $(INSTALLPERMS) \
137                 $(DESTDIR)$(TORTUREDIR) \
138                 $(TORTURE_PROGS)
139
140 installlib: $(INSTALLABLE_SHARED_LIBS) $(STATIC_LIBS) installdirs
141         @$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(LIBDIR) "$(SHLIBEXT)" $(INSTALLABLE_SHARED_LIBS) 
142         #@$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(LIBDIR) "$(STLIBEXT)" $(STATIC_LIBS)
143
144 installheader: headers installdirs
145         @srcdir=$(srcdir) builddir=$(builddir) $(PERL) $(srcdir)/script/installheader.pl $(DESTDIR)$(INCLUDEDIR) $(PUBLIC_HEADERS) $(DEFAULT_HEADERS)
146
147 installdat: installdirs
148         @$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(DATADIR) $(srcdir)
149
150 installwebapps: installdirs
151         @$(SHELL) $(srcdir)/script/installwebapps.sh $(DESTDIR)$(WEBAPPSDIR) $(srcdir)
152         @$(SHELL) $(srcdir)/script/installjsonrpc.sh $(DESTDIR)$(SERVICESDIR) $(srcdir)
153
154 installman: manpages installdirs
155         @$(SHELL) $(srcdir)/script/installman.sh $(DESTDIR)$(MANDIR) $(MANPAGES)
156
157 installmisc: installdirs
158         @$(SHELL) $(srcdir)/script/installmisc.sh $(srcdir) $(DESTDIR)$(JSDIR) $(DESTDIR)$(SETUPDIR) $(DESTDIR)$(BINDIR)
159
160 installpc: installdirs
161         @$(SHELL) $(srcdir)/script/installpc.sh $(builddir) $(DESTDIR)$(PKGCONFIGDIR) $(PC_FILES)
162
163 uninstall: uninstallbin uninstallman uninstallmisc uninstalllib uninstallheader \
164         uninstallplugins
165
166 uninstallmisc:
167         #FIXME
168
169 uninstallbin:
170         @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(SBIN_PROGS)
171         @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(BIN_PROGS)
172         @$(SHELL) $(srcdir)/script/uninstalltorture.sh $(DESTDIR)$(TORTUREDIR) $(TORTURE_PROGS)
173
174 uninstalllib:
175         @$(SHELL) $(srcdir)/script/uninstalllib.sh $(DESTDIR)$(LIBDIR) $(SHARED_LIBS)
176         #@$(SHELL) $(srcdir)/script/uninstalllib.sh $(DESTDIR)$(LIBDIR) $(STATIC_LIBS) 
177
178 uninstallheader:
179         @$(SHELL) $(srcdir)/script/uninstallheader.sh $(DESTDIR)$(INCLUDEDIR) $(PUBLIC_HEADERS)
180
181 uninstallman:
182         @$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(MANDIR) $(MANPAGES)
183
184 Makefile: config.status $(MK_FILES)
185         ./config.status
186
187 etags:
188         etags `find $(srcdir) -name "*.[ch]"`
189
190 ctags:
191         ctags `find $(srcdir) -name "*.[ch]"`
192
193 pidl/Makefile: pidl/Makefile.PL
194         cd pidl && $(PERL) Makefile.PL 
195
196 testcov-html:: pidl-testcov
197
198 pidl-testcov: pidl/Makefile
199         cd pidl && cover -test
200
201 installpidl: pidl/Makefile
202         $(MAKE) -C pidl install
203
204 uninstallpidl: pidl/Makefile
205         $(MAKE) -C pidl uninstall
206
207 $(IDL_HEADER_FILES) \
208         $(IDL_NDR_PARSE_H_FILES) $(IDL_NDR_PARSE_C_FILES) \
209         $(IDL_NDR_CLIENT_C_FILES) $(IDL_NDR_CLIENT_H_FILES) \
210         $(IDL_NDR_SERVER_C_FILES) $(IDL_SWIG_FILES) \
211         $(IDL_NDR_EJS_C_FILES) $(IDL_NDR_EJS_H_FILES): idl
212
213 idl_full: pidl/lib/Parse/Pidl/IDL.pm pidl/lib/Parse/Pidl/Expr.pm 
214         @CPP="$(CPP)" PERL="$(PERL)" srcdir=$(srcdir) $(srcdir)/script/build_idl.sh FULL
215
216 idl: pidl/lib/Parse/Pidl/IDL.pm pidl/lib/Parse/Pidl/Expr.pm 
217         @CPP="$(CPP)" PERL="$(PERL)" srcdir=$(srcdir) $(srcdir)/script/build_idl.sh PARTIAL 
218
219 pidl/lib/Parse/Pidl/IDL.pm: pidl/idl.yp
220         -$(YAPP) -m 'Parse::Pidl::IDL' -o pidl/lib/Parse/Pidl/IDL.pm pidl/idl.yp ||\
221                 touch pidl/lib/Parse/Pidl/IDL.pm 
222
223 pidl/lib/Parse/Pidl/Expr.pm: pidl/idl.yp
224         -$(YAPP) -m 'Parse::Pidl::Expr' -o pidl/lib/Parse/Pidl/Expr.pm pidl/expr.yp ||\
225                 touch pidl/lib/Parse/Pidl/Expr.pm 
226
227 include/config.h:
228         @echo "include/config.h not present"
229         @echo "You need to rerun ./autogen.sh and ./configure"
230         @/bin/false
231
232 $(srcdir)/version.h: $(srcdir)/VERSION
233         @$(SHELL) script/mkversion.sh VERSION $(srcdir)/version.h $(srcdir)/
234
235 regen_version:
236         @$(SHELL) script/mkversion.sh VERSION $(srcdir)/version.h $(srcdir)/
237
238 clean_pch:
239         @echo "Removing precompiled headers"
240         @-rm -f include/includes.h.gch
241
242 pch: clean_pch include/includes.h.gch
243
244 clean:: clean_pch
245         @echo Removing objects
246         @-find . -name '*.o' -exec rm -f '{}' \;
247         @echo Removing hostcc objects
248         @-find . -name '*.ho' -exec rm -f '{}' \;
249         @echo Removing binaries
250         @-rm -f $(BIN_PROGS) $(SBIN_PROGS) $(BINARIES) $(TORTURE_PROGS)
251         @echo Removing libraries
252         @-rm -f $(STATIC_LIBRARIES) $(SHARED_LIBRARIES)
253         @-rm -f bin/static/*.a bin/shared/*.$(SHLIBEXT)
254         @echo Removing modules
255         @-rm -f bin/modules/*/*.$(SHLIBEXT)
256         @-rm -f bin/*_init_module.c
257         @echo Removing dummy targets
258         @-rm -f bin/.*_*
259         @echo Removing generated files
260         @-rm -f bin/*_init_module.c
261         @-rm -rf librpc/gen_* 
262         @echo Removing proto headers
263         @-rm -f $(PROTO_HEADERS)
264
265 distclean: clean
266         -rm -f include/config.h include/config_tmp.h include/build.h
267         -rm -f Makefile 
268         -rm -f config.status
269         -rm -f config.log config.cache
270         -rm -f config.pm config.mk
271         -rm -rf ../webapps/qooxdoo-*-sdk/frontend/framework/.cache
272         -rm -f $(PC_FILES)
273
274 removebackup:
275         -rm -f *.bak *~ */*.bak */*~ */*/*.bak */*/*~ */*/*/*.bak */*/*/*~
276
277 realdistclean: distclean removebackup
278         -rm -f include/config_tmp.h.in
279         -rm -f version.h
280         -rm -f configure
281         -rm -f $(MANPAGES)
282
283 check:: test
284
285 SELFTEST = $(PERL) $(srcdir)/selftest/selftest.pl --prefix=${selftest_prefix} \
286     --builddir=$(builddir) --srcdir=$(srcdir) \
287     --expected-failures=$(srcdir)/samba4-knownfail \
288     --skip=$(srcdir)/samba4-skip \
289     $(TEST_OPTIONS) 
290
291 htmltest: everything
292         $(SELFTEST) $(DEFAULT_TEST_OPTIONS) --format=html $(TESTS)
293
294 test: everything
295         $(SELFTEST) $(DEFAULT_TEST_OPTIONS) --immediate $(TESTS)
296
297 testone: everything
298         $(SELFTEST) $(DEFAULT_TEST_OPTIONS) --one $(TESTS)
299
300 test-swrap: everything
301         $(SELFTEST) --socket-wrapper --immediate $(TESTS)
302
303 test-noswrap: everything
304         $(SELFTEST) --immediate $(TESTS)
305
306 quicktest: all
307         $(SELFTEST) --quick --socket-wrapper --immediate $(TESTS)
308
309 htmlquicktest: all
310         $(SELFTEST) --quick --socket-wrapper --format=html --immediate $(TESTS)
311
312 quicktestone: all
313         $(SELFTEST) --quick --socket-wrapper --one $(TESTS)
314
315 testenv: everything
316         $(SELFTEST) --socket-wrapper --testenv
317
318 valgrindtest: valgrindtest-quick
319
320 valgrindtest-quick: all
321         SMBD_VALGRIND="xterm -n smbd -e valgrind -q --db-attach=yes --num-callers=30" \
322         VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \
323         $(SELFTEST) --quick --immediate --socket-wrapper $(TESTS)
324
325 valgrindtest-all: everything
326         SMBD_VALGRIND="xterm -n smbd -e valgrind -q --db-attach=yes --num-callers=30" \
327         VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \
328         $(SELFTEST) --immediate --socket-wrapper $(TESTS)
329
330 valgrindtest-env: everything
331         SMBD_VALGRIND="xterm -n smbd -e valgrind -q --db-attach=yes --num-callers=30" \
332         VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \
333         $(SELFTEST) --socket-wrapper --testenv
334
335 gdbtest: gdbtest-quick
336
337 gdbtest-quick: all
338         SMBD_VALGRIND="xterm -n smbd -e $(srcdir)/script/gdb_run " \
339         $(SELFTEST) --immediate --quick --socket-wrapper $(TESTS)
340
341 gdbtest-all: everything
342         SMBD_VALGRIND="xterm -n smbd -e $(srcdir)/script/gdb_run " \
343         $(SELFTEST) --immediate --socket-wrapper $(TESTS)
344
345 gdbtest-env: everything
346         SMBD_VALGRIND="xterm -n smbd -e $(srcdir)/script/gdb_run " \
347         $(SELFTEST) --socket-wrapper --testenv
348
349 wintest: all
350         $(SELFTEST) win
351
352 unused_macros:
353         $(srcdir)/script/find_unused_macros.pl `find . -name "*.[ch]"` | sort
354
355 ###############################################################################
356 # File types
357 ###############################################################################
358
359 .SUFFIXES: .x .c .et .y .l .d .o .h .h.gch .a .$(SHLIBEXT) .1 .1.xml .3 .3.xml .5 .5.xml .7 .7.xml .8 .8.xml .ho .idl .hd
360
361 .c.d:
362         @echo "Generating dependencies for $<"
363         @$(DEPENDS)
364
365 .c.hd:
366         @echo "Generating host-compiler dependencies for $<"
367         @$(HDEPENDS)
368
369 include/includes.d: include/includes.h
370         @echo "Generating dependencies for $<"
371         @$(PCHDEPENDS)
372
373 .c.o:
374         @if test -n "$(CC_CHECKER)"; then \
375                 echo "Checking  $< with '$(CC_CHECKER)'"; \
376                 $(CHECK) ; \
377         fi
378         @echo "Compiling $<"
379         @-mkdir -p `dirname $@`
380         @$(COMPILE) && exit 0 ; \
381                 echo "The following command failed:" 1>&2;\
382                 echo "$(COMPILE)" 1>&2;\
383                 $(COMPILE) >/dev/null 2>&1
384
385 .c.ho:
386         @echo "Compiling $< with host compiler"
387         @-mkdir -p `dirname $@`
388         @$(HCOMPILE) && exit 0;\
389                 echo "The following command failed:" 1>&2;\
390                 echo "$(HCOMPILE)" 1>&2;\
391                 $(HCOMPILE) >/dev/null 2>&1
392
393 .h.h.gch:
394         @echo "Precompiling $<"
395         @$(PCHCOMPILE)
396
397 .y.c:
398         @echo "Building $< with $(YACC)"
399         @-$(srcdir)/script/yacc_compile.sh "$(YACC)" "$<" "$@"
400
401 .l.c:
402         @echo "Building $< with $(LEX)"
403         @-$(srcdir)/script/lex_compile.sh "$(LEX)" "$<" "$@"
404
405 DOCBOOK_MANPAGE_URL = http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
406
407 .1.xml.1:
408         $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
409
410 .3.xml.3:
411         $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
412
413 .5.xml.5:
414         $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
415
416 .7.xml.7:
417         $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
418
419 .8.xml.8:
420         $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
421
422 DEP_FILES = $(patsubst %.ho,%.hd,$(patsubst %.o,%.d,$(ALL_OBJS))) \
423                    include/includes.d
424
425 dist:: idl_full manpages configure distclean 
426
427 configure: 
428         ./autogen.sh