nsswitchsrcdir := $(samba4srcdir)/nsswitch
libsrcdir := $(samba4srcdir)/lib
libsocketsrcdir := $(samba4srcdir)/lib/socket
-libcharsetsrcdir := $(samba4srcdir)/lib/charset
+libcharsetsrcdir := $(samba4srcdir)/../lib/util/charset
ldb_sambasrcdir := $(samba4srcdir)/lib/ldb-samba
libtlssrcdir := $(samba4srcdir)/lib/tls
libregistrysrcdir := $(samba4srcdir)/lib/registry
libtdrsrcdir := $(samba4srcdir)/lib/tdr
libdbwrapsrcdir := $(samba4srcdir)/lib/dbwrap
libcryptosrcdir := $(samba4srcdir)/../lib/crypto
-libtorturesrcdir := $(samba4srcdir)/lib/torture
+libtorturesrcdir := ../lib/torture
libcompressionsrcdir := $(samba4srcdir)/../lib/compression
libgencachesrcdir := $(samba4srcdir)/lib
paramsrcdir := $(samba4srcdir)/param
comsrcdir := $(samba4srcdir)/lib/com
override ASN1C = bin/asn1_compile4
override ET_COMPILER = bin/compile_et4
+include $(samba4srcdir)/build/make/python.mk
include samba4-data.mk
include $(samba4srcdir)/static_deps.mk
-include $(samba4srcdir)/build/make/python.mk
INSTALLPERMS = 0755
+$(foreach SCRIPT,$(wildcard scripting/bin/*),$(eval $(call binary_install_template,$(SCRIPT))))
-$(DESTDIR)$(bindir)/%: bin/%4 installdirs
+$(DESTDIR)$(bindir)/%4: bin/%4 installdirs
@mkdir -p $(@D)
@echo Installing $(@F) as $@
@if test -f $@; then rm -f $@.old; mv $@ $@.old; fi
@cp $< $@
@chmod $(INSTALLPERMS) $@
-$(DESTDIR)$(sbindir)/%: bin/%4 installdirs
+$(DESTDIR)$(sbindir)/%4: bin/%4 installdirs
@mkdir -p $(@D)
@echo Installing $(@F) as $@
@if test -f $@; then rm -f $@.old; mv $@ $@.old; fi
proto:: $(PROTO_HEADERS)
modules:: $(PLUGINS)
-all:: basics bin/samba4 bin/regpatch4 bin/regdiff4 bin/regshell4 bin/regtree4 bin/smbclient4
-torture:: basics bin/smbtorture4
-everything:: basics $(patsubst %,%4,$(BINARIES))
+pythonmods:: $(PYTHON_PYS) $(PYTHON_SO)
+
+all:: bin/samba4 bin/regpatch4 bin/regdiff4 bin/regshell4 bin/regtree4 bin/smbclient4
+torture:: bin/smbtorture4
+everything:: $(patsubst %,%4,$(BINARIES))
+
+SELFTEST4 = $(LD_LIBPATH_OVERRIDE) $(PERL) $(selftestdir)/selftest.pl --prefix=st4 \
+ --builddir=$(builddir) --srcdir=$(samba4srcdir) \
+ --expected-failures=$(samba4srcdir)/selftest/knownfail \
+ --format=$(SELFTEST_FORMAT) \
+ --exclude=$(samba4srcdir)/selftest/skip --testlist="$(samba4srcdir)/selftest/tests.sh|" \
+ $(TEST4_OPTIONS)
+
+SELFTEST4_NOSLOW_OPTS = --exclude=$(samba4srcdir)/selftest/slow
+SELFTEST4_QUICK_OPTS = $(SELFTEST4_NOSLOW_OPTS) --quick --include=$(samba4srcdir)/selftest/quick
+
+slowtest4:: everything
+ $(SELFTEST4) $(DEFAULT_TEST_OPTIONS) --immediate $(TESTS)
+
+test4:: everything
+ $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) $(DEFAULT_TEST_OPTIONS) --immediate \
+ $(TESTS)
+
+testone4:: everything
+ $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) $(DEFAULT_TEST_OPTIONS) --one $(TESTS)
+
+test4-swrap:: everything
+ $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper --immediate $(TESTS)
+
+test4-swrap-pcap:: everything
+ $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper-pcap --immediate $(TESTS)
+
+test4-swrap-keep-pcap:: everything
+ $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper-keep-pcap --immediate $(TESTS)
+
+test4-noswrap:: everything
+ $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --immediate $(TESTS)
+
+quicktest4:: all
+ $(SELFTEST4) $(SELFTEST4_QUICK_OPTS) --socket-wrapper --immediate $(TESTS)
+
+quicktestone4:: all
+ $(SELFTEST4) $(SELFTEST4_QUICK_OPTS) --socket-wrapper --one $(TESTS)
+
+testenv4:: everything
+ $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper --testenv
+
+testenv4-%:: everything
+ SELFTEST_TESTENV=$* $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper --testenv
+
+test4-%::
+ $(MAKE) test TESTS=$*
+
+valgrindtest4:: valgrindtest-all
+
+valgrindtest4-quick:: all
+ SMBD_VALGRIND="xterm -n server -e $(selftestdir)/valgrind_run $(LD_LIBPATH_OVERRIDE)" \
+ VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \
+ $(SELFTEST4) $(SELFTEST4_QUICK_OPTS) --immediate --socket-wrapper $(TESTS)
+
+valgrindtest4-all:: everything
+ SMBD_VALGRIND="xterm -n server -e $(selftestdir)/valgrind_run $(LD_LIBPATH_OVERRIDE)" \
+ VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \
+ $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --immediate --socket-wrapper $(TESTS)
+
+valgrindtest4-env:: everything
+ SMBD_VALGRIND="xterm -n server -e $(selftestdir)/valgrind_run $(LD_LIBPATH_OVERRIDE)" \
+ VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \
+ $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper --testenv
+
+gdbtest4:: gdbtest4-all
+gdbtest4-quick:: all
+ SMBD_VALGRIND="xterm -n server -e $(selftestdir)/gdb_run $(LD_LIBPATH_OVERRIDE)" \
+ $(SELFTEST4) $(SELFTEST4_QUICK_OPTS) --immediate --socket-wrapper $(TESTS)
-etags::
- etags --append=yes `find $(samba4srcdir) -name "*.[ch]"`
+gdbtest4-all:: everything
+ SMBD_VALGRIND="xterm -n server -e $(selftestdir)/gdb_run $(LD_LIBPATH_OVERRIDE)" \
+ $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --immediate --socket-wrapper $(TESTS)
-ctags::
- ctags --append=yes `find $(samba4srcdir) -name "*.[ch]"`
+gdbtest4-env:: everything
+ SMBD_VALGRIND="xterm -n server -e $(selftestdir)/gdb_run $(LD_LIBPATH_OVERRIDE)" \
+ $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper --testenv