s3:docs: add a manpage for idmap_tdb2
[Samba.git] / source3 / samba4.mk
blobc79694edb0ad4f5bcc83dcd76b1f1ac2a90dd93e
1 # samba 4 bits
3 PROG_LD = $(LD)
4 BNLD = $(CC)
5 HOSTLD = $(CC)
6 PARTLINK = $(PROG_LD) -r
7 MDLD = $(SHLD)
8 MDLD_FLAGS = $(LDSHFLAGS)
9 shliboutputdir = bin/shared
11 samba4srcdir = $(srcdir)/../source4
13 # Flags used for the samba 4 files
14 # $(srcdir)/include is required for config.h
15 SAMBA4_CFLAGS = -I.. -I$(samba4srcdir) -I$(samba4srcdir)/include \
16 -I$(samba4srcdir)/../lib/replace -I$(samba4srcdir)/lib \
17 -I$(heimdalsrcdir)/lib/hcrypto -I$(tallocdir) \
18 -I$(srcdir)/include -D_SAMBA_BUILD_=4 -DHAVE_CONFIG_H
20 .SUFFIXES: .ho
22 # No cross compilation for now, thanks
23 .c.ho:
24 @if (: >> $@ || : > $@) >/dev/null 2>&1; then rm -f $@; else \
25 dir=`echo $@ | sed 's,/[^/]*$$,,;s,^$$,.,'` $(MAKEDIR); fi
26 @if test -n "$(CC_CHECKER)"; then \
27 echo "Checking $*.c with '$(CC_CHECKER)'";\
28 $(CHECK_CC); \
30 @echo Compiling $*.c
31 @$(COMPILE) && exit 0;\
32 echo "The following command failed:" 1>&2;\
33 echo "$(subst ",\",$(COMPILE_CC))" 1>&2;\
34 $(COMPILE_CC) >/dev/null 2>&1
36 # The order really does matter here! GNU Make 3.80 will break if the more specific
37 # overrides are not specified first.
38 ifeq ($(MAKE_VERSION),3.81)
39 %.o: CFLAGS+=$(FLAGS)
40 ../librpc/gen_ndr/%_c.o: CFLAGS=$(SAMBA4_CFLAGS)
41 ../librpc/gen_ndr/py_%.o: CFLAGS=$(SAMBA4_CFLAGS)
42 $(samba4srcdir)/%.o: CFLAGS=$(SAMBA4_CFLAGS)
43 $(samba4srcdir)/%.ho: CFLAGS=$(SAMBA4_CFLAGS)
44 $(heimdalsrcdir)/%.o: CFLAGS=-I$(heimdalbuildsrcdir) $(SAMBA4_CFLAGS) -I$(srcdir)
45 $(heimdalsrcdir)/%.ho: CFLAGS=-I$(heimdalbuildsrcdir) $(SAMBA4_CFLAGS) -I$(srcdir)
46 else
47 $(heimdalsrcdir)/%.o: CFLAGS=-I$(heimdalbuildsrcdir) $(SAMBA4_CFLAGS) -I$(srcdir)
48 $(heimdalsrcdir)/%.ho: CFLAGS=-I$(heimdalbuildsrcdir) $(SAMBA4_CFLAGS) -I$(srcdir)
49 $(samba4srcdir)/%.o: CFLAGS=$(SAMBA4_CFLAGS)
50 $(samba4srcdir)/%.ho: CFLAGS=$(SAMBA4_CFLAGS)
51 ../librpc/gen_ndr/%_c.o: CFLAGS=$(SAMBA4_CFLAGS)
52 ../librpc/gen_ndr/py_%.o: CFLAGS=$(SAMBA4_CFLAGS)
53 %.o: CFLAGS+=$(FLAGS)
54 endif
56 # Create a static library
57 %.a:
58 @echo Linking $@
59 @rm -f $@
60 @mkdir -p $(@D)
61 @$(AR) -rc $@ $^
63 pidldir = $(samba4srcdir)/../pidl
64 include $(pidldir)/config.mk
65 include samba4-config.mk
66 include samba4-templates.mk
68 zlibsrcdir := $(samba4srcdir)/../lib/zlib
69 dynconfigsrcdir := $(samba4srcdir)/dynconfig
70 heimdalsrcdir := $(samba4srcdir)/heimdal
71 dsdbsrcdir := $(samba4srcdir)/dsdb
72 smbdsrcdir := $(samba4srcdir)/smbd
73 clustersrcdir := $(samba4srcdir)/cluster
74 libnetsrcdir := $(samba4srcdir)/libnet
75 authsrcdir := $(samba4srcdir)/auth
76 nsswitchsrcdir := $(samba4srcdir)/../nsswitch
77 libsrcdir := $(samba4srcdir)/lib
78 libsocketsrcdir := $(samba4srcdir)/lib/socket
79 libcharsetsrcdir := $(samba4srcdir)/../lib/util/charset
80 ldb_sambasrcdir := $(samba4srcdir)/lib/ldb-samba
81 libtlssrcdir := $(samba4srcdir)/lib/tls
82 libregistrysrcdir := $(samba4srcdir)/lib/registry
83 libmessagingsrcdir := $(samba4srcdir)/lib/messaging
84 libteventsrcdir := $(samba4srcdir)/../lib/tevent
85 libeventssrcdir := $(samba4srcdir)/lib/events
86 libcmdlinesrcdir := $(samba4srcdir)/lib/cmdline
87 poptsrcdir := $(samba4srcdir)/../lib/popt
88 socketwrappersrcdir := $(samba4srcdir)/../lib/socket_wrapper
89 nsswrappersrcdir := $(samba4srcdir)/../lib/nss_wrapper
90 libstreamsrcdir := $(samba4srcdir)/lib/stream
91 libutilsrcdir := $(samba4srcdir)/../lib/util
92 libtdrsrcdir := $(samba4srcdir)/lib/tdr
93 libcryptosrcdir := $(samba4srcdir)/../lib/crypto
94 libtorturesrcdir := ../lib/torture
95 libcompressionsrcdir := $(samba4srcdir)/../lib/compression
96 libgencachesrcdir := $(samba4srcdir)/lib
97 paramsrcdir := $(samba4srcdir)/param
98 smb_serversrcdir := $(samba4srcdir)/smb_server
99 rpc_serversrcdir := $(samba4srcdir)/rpc_server
100 ldap_serversrcdir := $(samba4srcdir)/ldap_server
101 web_serversrcdir := $(samba4srcdir)/web_server
102 winbindsrcdir := $(samba4srcdir)/winbind
103 nbt_serversrcdir := $(samba4srcdir)/nbt_server
104 wrepl_serversrcdir := $(samba4srcdir)/wrepl_server
105 cldap_serversrcdir := $(samba4srcdir)/cldap_server
106 librpcsrcdir := $(samba4srcdir)/librpc
107 torturesrcdir := $(samba4srcdir)/torture
108 utilssrcdir := $(samba4srcdir)/utils
109 ntvfssrcdir := $(samba4srcdir)/ntvfs
110 ntptrsrcdir := $(samba4srcdir)/ntptr
111 clientsrcdir := $(samba4srcdir)/client
112 libclisrcdir := $(samba4srcdir)/libcli
113 libclinbtsrcdir := $(samba4srcdir)/../libcli/nbt
114 pyscriptsrcdir := $(samba4srcdir)/scripting/python
115 kdcsrcdir := $(samba4srcdir)/kdc
116 smbreadlinesrcdir := $(samba4srcdir)/lib/smbreadline
117 ntp_signdsrcdir := $(samba4srcdir)/ntp_signd
118 tdbsrcdir := $(samba4srcdir)/../lib/tdb
119 ldbsrcdir := $(samba4srcdir)/lib/ldb
120 tallocsrcdir := $(samba4srcdir)/../lib/talloc
121 comsrcdir := $(samba4srcdir)/lib/com
122 override ASN1C = bin/asn1_compile4
123 override ET_COMPILER = bin/compile_et4
124 include $(samba4srcdir)/build/make/python.mk
125 include samba4-data.mk
126 include $(samba4srcdir)/static_deps.mk
128 INSTALLPERMS = 0755
129 $(foreach SCRIPT,$(wildcard scripting/bin/*),$(eval $(call binary_install_template,$(SCRIPT))))
131 $(DESTDIR)$(bindir)/%4: bin/%4 installdirs
132 @mkdir -p $(@D)
133 @echo Installing $(@F) as $@
134 @if test -f $@; then rm -f $@.old; mv $@ $@.old; fi
135 @cp $< $@
136 @chmod $(INSTALLPERMS) $@
138 $(DESTDIR)$(sbindir)/%4: bin/%4 installdirs
139 @mkdir -p $(@D)
140 @echo Installing $(@F) as $@
141 @if test -f $@; then rm -f $@.old; mv $@ $@.old; fi
142 @cp $< $@
143 @chmod $(INSTALLPERMS) $@
145 clean::
146 @echo Removing samba 4 objects
147 @-find $(samba4srcdir) -name '*.o' -exec rm -f '{}' \;
148 @echo Removing samba 4 hostcc objects
149 @-find $(samba4srcdir) -name '*.ho' -exec rm -f '{}' \;
150 @echo Removing samba 4 libraries
151 @-rm -f $(STATIC_LIBS) $(SHARED_LIBS)
152 @-rm -f bin/static/*.a $(shliboutputdir)/*.$(SHLIBEXT) bin/mergedobj/*.o
153 @echo Removing samba 4 modules
154 @-rm -f bin/modules/*/*.$(SHLIBEXT)
155 @-rm -f bin/*_init_module.c
156 @echo Removing samba 4 dummy targets
157 @-rm -f bin/.*_*
158 @echo Removing samba 4 generated files
159 @-rm -f bin/*_init_module.c
160 @-rm -rf $(samba4srcdir)/librpc/gen_*
162 proto:: $(PROTO_HEADERS)
163 modules:: $(PLUGINS)
165 pythonmods:: $(PYTHON_PYS) $(PYTHON_SO)
167 all:: bin/samba4 bin/regpatch4 bin/regdiff4 bin/regshell4 bin/regtree4 bin/smbclient4 bin/wbinfo4 pythonmods setup plugins
168 torture:: bin/smbtorture4
169 everything:: $(patsubst %,%4,$(BINARIES))
170 setup:
171 @ln -sf ../source4/setup setup
173 SELFTEST4 = $(LD_LIBPATH_OVERRIDE) $(PERL) $(selftestdir)/selftest.pl --prefix=st4 \
174 --builddir=$(builddir) --srcdir=$(samba4srcdir) \
175 --expected-failures=$(samba4srcdir)/selftest/knownfail \
176 --format=$(SELFTEST_FORMAT) \
177 --exclude=$(samba4srcdir)/selftest/skip --testlist="$(samba4srcdir)/selftest/tests.sh|" \
178 $(TEST4_OPTIONS)
180 SELFTEST4_NOSLOW_OPTS = --exclude=$(samba4srcdir)/selftest/slow
181 SELFTEST4_QUICK_OPTS = $(SELFTEST4_NOSLOW_OPTS) --quick --include=$(samba4srcdir)/selftest/quick
183 slowtest4:: everything
184 $(SELFTEST4) $(DEFAULT_TEST_OPTIONS) --immediate $(TESTS)
186 test4:: everything
187 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) $(DEFAULT_TEST_OPTIONS) --immediate \
188 $(TESTS)
190 testone4:: everything
191 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) $(DEFAULT_TEST_OPTIONS) --one $(TESTS)
193 test4-swrap:: everything
194 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper --immediate $(TESTS)
196 test4-swrap-pcap:: everything
197 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper-pcap --immediate $(TESTS)
199 test4-swrap-keep-pcap:: everything
200 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper-keep-pcap --immediate $(TESTS)
202 test4-noswrap:: everything
203 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --immediate $(TESTS)
205 quicktest4:: all
206 $(SELFTEST4) $(SELFTEST4_QUICK_OPTS) --socket-wrapper --immediate $(TESTS)
208 quicktestone4:: all
209 $(SELFTEST4) $(SELFTEST4_QUICK_OPTS) --socket-wrapper --one $(TESTS)
211 testenv4:: everything
212 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper --testenv
214 testenv4-%:: everything
215 SELFTEST_TESTENV=$* $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper --testenv
217 test4-%::
218 $(MAKE) test TESTS=$*
220 valgrindtest4:: valgrindtest-all
222 valgrindtest4-quick:: all
223 SMBD_VALGRIND="xterm -n server -e $(selftestdir)/valgrind_run $(LD_LIBPATH_OVERRIDE)" \
224 VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \
225 $(SELFTEST4) $(SELFTEST4_QUICK_OPTS) --immediate --socket-wrapper $(TESTS)
227 valgrindtest4-all:: everything
228 SMBD_VALGRIND="xterm -n server -e $(selftestdir)/valgrind_run $(LD_LIBPATH_OVERRIDE)" \
229 VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \
230 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --immediate --socket-wrapper $(TESTS)
232 valgrindtest4-env:: everything
233 SMBD_VALGRIND="xterm -n server -e $(selftestdir)/valgrind_run $(LD_LIBPATH_OVERRIDE)" \
234 VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \
235 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper --testenv
237 gdbtest4:: gdbtest4-all
239 gdbtest4-quick:: all
240 SMBD_VALGRIND="xterm -n server -e $(selftestdir)/gdb_run $(LD_LIBPATH_OVERRIDE)" \
241 $(SELFTEST4) $(SELFTEST4_QUICK_OPTS) --immediate --socket-wrapper $(TESTS)
243 gdbtest4-all:: everything
244 SMBD_VALGRIND="xterm -n server -e $(selftestdir)/gdb_run $(LD_LIBPATH_OVERRIDE)" \
245 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --immediate --socket-wrapper $(TESTS)
247 gdbtest4-env:: everything
248 SMBD_VALGRIND="xterm -n server -e $(selftestdir)/gdb_run $(LD_LIBPATH_OVERRIDE)" \
249 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper --testenv
251 plugins: $(PLUGINS)