Fix breakage for connect function after API change (connect -> connect_fn)
[Samba.git] / source3 / samba4.mk
blob653ae254640db7075524a2752e72948f00a5ebae
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 libwbclientsrcdir := $(nsswitchsrcdir)/libwbclient
78 libsrcdir := $(samba4srcdir)/lib
79 libsocketsrcdir := $(samba4srcdir)/lib/socket
80 libcharsetsrcdir := $(samba4srcdir)/../lib/util/charset
81 ldb_sambasrcdir := $(samba4srcdir)/lib/ldb-samba
82 libtlssrcdir := $(samba4srcdir)/lib/tls
83 libregistrysrcdir := $(samba4srcdir)/lib/registry
84 libmessagingsrcdir := $(samba4srcdir)/lib/messaging
85 libteventsrcdir := $(samba4srcdir)/../lib/tevent
86 libeventssrcdir := $(samba4srcdir)/lib/events
87 libcmdlinesrcdir := $(samba4srcdir)/lib/cmdline
88 poptsrcdir := $(samba4srcdir)/../lib/popt
89 socketwrappersrcdir := $(samba4srcdir)/../lib/socket_wrapper
90 nsswrappersrcdir := $(samba4srcdir)/../lib/nss_wrapper
91 libstreamsrcdir := $(samba4srcdir)/lib/stream
92 libutilsrcdir := $(samba4srcdir)/../lib/util
93 libtdrsrcdir := ../lib/tdr
94 libcryptosrcdir := $(samba4srcdir)/../lib/crypto
95 libtorturesrcdir := ../lib/torture
96 libcompressionsrcdir := $(samba4srcdir)/../lib/compression
97 libgencachesrcdir := $(samba4srcdir)/lib
98 paramsrcdir := $(samba4srcdir)/param
99 smb_serversrcdir := $(samba4srcdir)/smb_server
100 rpc_serversrcdir := $(samba4srcdir)/rpc_server
101 ldap_serversrcdir := $(samba4srcdir)/ldap_server
102 web_serversrcdir := $(samba4srcdir)/web_server
103 winbindsrcdir := $(samba4srcdir)/winbind
104 nbt_serversrcdir := $(samba4srcdir)/nbt_server
105 wrepl_serversrcdir := $(samba4srcdir)/wrepl_server
106 cldap_serversrcdir := $(samba4srcdir)/cldap_server
107 librpcsrcdir := $(samba4srcdir)/librpc
108 torturesrcdir := $(samba4srcdir)/torture
109 utilssrcdir := $(samba4srcdir)/utils
110 ntvfssrcdir := $(samba4srcdir)/ntvfs
111 ntptrsrcdir := $(samba4srcdir)/ntptr
112 clientsrcdir := $(samba4srcdir)/client
113 libclisrcdir := $(samba4srcdir)/libcli
114 libclinbtsrcdir := $(samba4srcdir)/../libcli/nbt
115 libclicommonsrcdir := $(samba4srcdir)/../libcli
116 pyscriptsrcdir := $(samba4srcdir)/scripting/python
117 kdcsrcdir := $(samba4srcdir)/kdc
118 smbreadlinesrcdir := $(samba4srcdir)/lib/smbreadline
119 ntp_signdsrcdir := $(samba4srcdir)/ntp_signd
120 tdbsrcdir := $(samba4srcdir)/../lib/tdb
121 ldbsrcdir := $(samba4srcdir)/lib/ldb
122 tallocsrcdir := $(samba4srcdir)/../lib/talloc
123 comsrcdir := $(samba4srcdir)/lib/com
124 override ASN1C = bin/asn1_compile4
125 override ET_COMPILER = bin/compile_et4
126 include $(samba4srcdir)/build/make/python.mk
127 include samba4-data.mk
128 include $(samba4srcdir)/static_deps.mk
130 INSTALLPERMS = 0755
131 $(foreach SCRIPT,$(wildcard scripting/bin/*),$(eval $(call binary_install_template,$(SCRIPT))))
133 $(DESTDIR)$(bindir)/%4: bin/%4 installdirs
134 @mkdir -p $(@D)
135 @echo Installing $(@F) as $@
136 @if test -f $@; then rm -f $@.old; mv $@ $@.old; fi
137 @cp $< $@
138 @chmod $(INSTALLPERMS) $@
140 $(DESTDIR)$(sbindir)/%4: bin/%4 installdirs
141 @mkdir -p $(@D)
142 @echo Installing $(@F) as $@
143 @if test -f $@; then rm -f $@.old; mv $@ $@.old; fi
144 @cp $< $@
145 @chmod $(INSTALLPERMS) $@
147 clean::
148 @echo Removing samba 4 objects
149 @-find $(samba4srcdir) -name '*.o' -exec rm -f '{}' \;
150 @echo Removing samba 4 hostcc objects
151 @-find $(samba4srcdir) -name '*.ho' -exec rm -f '{}' \;
152 @echo Removing samba 4 libraries
153 @-rm -f $(STATIC_LIBS) $(SHARED_LIBS)
154 @-rm -f bin/static/*.a $(shliboutputdir)/*.$(SHLIBEXT) bin/mergedobj/*.o
155 @echo Removing samba 4 modules
156 @-rm -f bin/modules/*/*.$(SHLIBEXT)
157 @-rm -f bin/*_init_module.c
158 @echo Removing samba 4 dummy targets
159 @-rm -f bin/.*_*
160 @echo Removing samba 4 generated files
161 @-rm -f bin/*_init_module.c
162 @-rm -rf $(samba4srcdir)/librpc/gen_*
164 proto:: $(PROTO_HEADERS)
165 modules:: $(PLUGINS)
167 pythonmods:: $(PYTHON_PYS) $(PYTHON_SO)
169 all:: bin/samba4 bin/regpatch4 bin/regdiff4 bin/regshell4 bin/regtree4 bin/smbclient4 bin/wbinfo4 pythonmods setup plugins
170 torture:: bin/smbtorture4
171 everything:: $(patsubst %,%4,$(BINARIES))
172 setup:
173 @ln -sf ../source4/setup setup
175 S4_LD_LIBPATH_OVERRIDE = $(LIB_PATH_VAR)="$(builddir)/bin/shared:$$$(LIB_PATH_VAR)"
177 SELFTEST4 = $(S4_LD_LIBPATH_OVERRIDE) EXEEXT="4" PYTHON="$(PYTHON)" PERL="$(PERL)" \
178 $(PERL) $(selftestdir)/selftest.pl --prefix=st4 \
179 --builddir=$(builddir) --srcdir=$(samba4srcdir) \
180 --exeext=4 \
181 --expected-failures=$(samba4srcdir)/selftest/knownfail \
182 --format=$(SELFTEST_FORMAT) \
183 --exclude=$(samba4srcdir)/selftest/skip --testlist="$(samba4srcdir)/selftest/tests.sh|" \
184 $(TEST4_OPTIONS)
186 SELFTEST4_NOSLOW_OPTS = --exclude=$(samba4srcdir)/selftest/slow
187 SELFTEST4_QUICK_OPTS = $(SELFTEST4_NOSLOW_OPTS) --quick --include=$(samba4srcdir)/selftest/quick
189 slowtest4:: everything
190 $(SELFTEST4) $(DEFAULT_TEST_OPTIONS) --immediate $(TESTS)
192 test4:: everything
193 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) $(DEFAULT_TEST_OPTIONS) --immediate \
194 $(TESTS)
196 testone4:: everything
197 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) $(DEFAULT_TEST_OPTIONS) --one $(TESTS)
199 test4-swrap:: everything
200 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper --immediate $(TESTS)
202 test4-swrap-pcap:: everything
203 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper-pcap --immediate $(TESTS)
205 test4-swrap-keep-pcap:: everything
206 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper-keep-pcap --immediate $(TESTS)
208 test4-noswrap:: everything
209 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --immediate $(TESTS)
211 quicktest4:: all
212 $(SELFTEST4) $(SELFTEST4_QUICK_OPTS) --socket-wrapper --immediate $(TESTS)
214 quicktestone4:: all
215 $(SELFTEST4) $(SELFTEST4_QUICK_OPTS) --socket-wrapper --one $(TESTS)
217 testenv4:: everything
218 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper --testenv
220 testenv4-%:: everything
221 SELFTEST_TESTENV=$* $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper --testenv
223 test4-%::
224 $(MAKE) test TESTS=$*
226 valgrindtest4:: valgrindtest-all
228 valgrindtest4-quick:: all
229 SAMBA_VALGRIND="xterm -n server -e $(selftestdir)/valgrind_run $(LD_LIBPATH_OVERRIDE)" \
230 VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \
231 $(SELFTEST4) $(SELFTEST4_QUICK_OPTS) --immediate --socket-wrapper $(TESTS)
233 valgrindtest4-all:: everything
234 SAMBA_VALGRIND="xterm -n server -e $(selftestdir)/valgrind_run $(LD_LIBPATH_OVERRIDE)" \
235 VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \
236 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --immediate --socket-wrapper $(TESTS)
238 valgrindtest4-env:: everything
239 SAMBA_VALGRIND="xterm -n server -e $(selftestdir)/valgrind_run $(LD_LIBPATH_OVERRIDE)" \
240 VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \
241 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper --testenv
243 gdbtest4:: gdbtest4-all
245 gdbtest4-quick:: all
246 SAMBA_VALGRIND="xterm -n server -e $(selftestdir)/gdb_run $(LD_LIBPATH_OVERRIDE)" \
247 $(SELFTEST4) $(SELFTEST4_QUICK_OPTS) --immediate --socket-wrapper $(TESTS)
249 gdbtest4-all:: everything
250 SAMBA_VALGRIND="xterm -n server -e $(selftestdir)/gdb_run $(LD_LIBPATH_OVERRIDE)" \
251 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --immediate --socket-wrapper $(TESTS)
253 gdbtest4-env:: everything
254 SAMBA_VALGRIND="xterm -n server -e $(selftestdir)/gdb_run $(LD_LIBPATH_OVERRIDE)" \
255 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper --testenv
257 plugins: $(PLUGINS)