tsocket: add tsocket_address_bsd_sockaddr() and tsocket_address_bsd_from_sockaddr()
[Samba.git] / source3 / samba4.mk
blob1ad46f22648da3c13409df539f42c5101f955f96
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 uidwrappersrcdir := $(samba4srcdir)/../lib/uid_wrapper
92 libstreamsrcdir := $(samba4srcdir)/lib/stream
93 libutilsrcdir := $(samba4srcdir)/../lib/util
94 libtdrsrcdir := ../lib/tdr
95 libcryptosrcdir := $(samba4srcdir)/../lib/crypto
96 libtorturesrcdir := ../lib/torture
97 libcompressionsrcdir := $(samba4srcdir)/../lib/compression
98 libgencachesrcdir := $(samba4srcdir)/lib
99 paramsrcdir := $(samba4srcdir)/param
100 smb_serversrcdir := $(samba4srcdir)/smb_server
101 rpc_serversrcdir := $(samba4srcdir)/rpc_server
102 ldap_serversrcdir := $(samba4srcdir)/ldap_server
103 web_serversrcdir := $(samba4srcdir)/web_server
104 winbindsrcdir := $(samba4srcdir)/winbind
105 nbt_serversrcdir := $(samba4srcdir)/nbt_server
106 wrepl_serversrcdir := $(samba4srcdir)/wrepl_server
107 cldap_serversrcdir := $(samba4srcdir)/cldap_server
108 librpcsrcdir := $(samba4srcdir)/librpc
109 torturesrcdir := $(samba4srcdir)/torture
110 utilssrcdir := $(samba4srcdir)/utils
111 ntvfssrcdir := $(samba4srcdir)/ntvfs
112 ntptrsrcdir := $(samba4srcdir)/ntptr
113 clientsrcdir := $(samba4srcdir)/client
114 libclisrcdir := $(samba4srcdir)/libcli
115 libclinbtsrcdir := $(samba4srcdir)/../libcli/nbt
116 libclicommonsrcdir := $(samba4srcdir)/../libcli
117 pyscriptsrcdir := $(samba4srcdir)/scripting/python
118 kdcsrcdir := $(samba4srcdir)/kdc
119 smbreadlinesrcdir := $(samba4srcdir)/lib/smbreadline
120 ntp_signdsrcdir := $(samba4srcdir)/ntp_signd
121 tdbsrcdir := $(samba4srcdir)/../lib/tdb
122 ldbsrcdir := $(samba4srcdir)/lib/ldb
123 tallocsrcdir := $(samba4srcdir)/../lib/talloc
124 comsrcdir := $(samba4srcdir)/lib/com
125 override ASN1C = bin/asn1_compile4
126 override ET_COMPILER = bin/compile_et4
127 #include $(samba4srcdir)/build/make/python.mk
128 include samba4-data.mk
129 include $(samba4srcdir)/static_deps.mk
131 INSTALLPERMS = 0755
132 $(foreach SCRIPT,$(wildcard scripting/bin/*),$(eval $(call binary_install_template,$(SCRIPT))))
134 $(DESTDIR)$(bindir)/%4: bin/%4 installdirs
135 @mkdir -p $(@D)
136 @echo Installing $(@F) as $@
137 @if test -f $@; then rm -f $@.old; mv $@ $@.old; fi
138 @cp $< $@
139 @chmod $(INSTALLPERMS) $@
141 $(DESTDIR)$(sbindir)/%4: bin/%4 installdirs
142 @mkdir -p $(@D)
143 @echo Installing $(@F) as $@
144 @if test -f $@; then rm -f $@.old; mv $@ $@.old; fi
145 @cp $< $@
146 @chmod $(INSTALLPERMS) $@
148 clean::
149 @echo Removing samba 4 objects
150 @-find $(samba4srcdir) -name '*.o' -exec rm -f '{}' \;
151 @echo Removing samba 4 hostcc objects
152 @-find $(samba4srcdir) -name '*.ho' -exec rm -f '{}' \;
153 @echo Removing samba 4 libraries
154 @-rm -f $(STATIC_LIBS) $(SHARED_LIBS)
155 @-rm -f bin/static/*.a $(shliboutputdir)/*.$(SHLIBEXT) bin/mergedobj/*.o
156 @echo Removing samba 4 modules
157 @-rm -f bin/modules/*/*.$(SHLIBEXT)
158 @-rm -f bin/*_init_module.c
159 @echo Removing samba 4 dummy targets
160 @-rm -f bin/.*_*
161 @echo Removing samba 4 generated files
162 @-rm -f bin/*_init_module.c
163 @-rm -rf $(samba4srcdir)/librpc/gen_*
165 proto:: $(PROTO_HEADERS)
166 modules:: $(PLUGINS)
168 #pythonmods:: $(PYTHON_PYS) $(PYTHON_SO)
170 all:: bin/samba4 bin/regpatch4 bin/regdiff4 bin/regshell4 bin/regtree4 bin/smbclient4 setup plugins
171 torture:: bin/smbtorture4
174 ## This is a fake rule to stop any python being invoked as currently the
175 ## build system is broken in source3 with python. JRA.
177 installpython:: bin/smbtorture4
179 everything:: $(patsubst %,%4,$(BINARIES))
180 setup:
181 @ln -sf ../source4/setup setup
183 S4_LD_LIBPATH_OVERRIDE = $(LIB_PATH_VAR)="$(builddir)/bin/shared:$$$(LIB_PATH_VAR)"
185 SELFTEST4 = $(S4_LD_LIBPATH_OVERRIDE) EXEEXT="4" PYTHON="$(PYTHON)" PERL="$(PERL)" \
186 $(PERL) $(selftestdir)/selftest.pl --prefix=st4 \
187 --builddir=$(builddir) --srcdir=$(samba4srcdir) \
188 --exeext=4 \
189 --expected-failures=$(samba4srcdir)/selftest/knownfail \
190 --format=$(SELFTEST_FORMAT) \
191 --exclude=$(samba4srcdir)/selftest/skip --testlist="$(samba4srcdir)/selftest/tests.sh|" \
192 $(TEST4_OPTIONS)
194 SELFTEST4_NOSLOW_OPTS = --exclude=$(samba4srcdir)/selftest/slow
195 SELFTEST4_QUICK_OPTS = $(SELFTEST4_NOSLOW_OPTS) --quick --include=$(samba4srcdir)/selftest/quick
197 slowtest4:: everything
198 $(SELFTEST4) $(DEFAULT_TEST_OPTIONS) --immediate $(TESTS)
200 test4:: everything
201 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) $(DEFAULT_TEST_OPTIONS) --immediate \
202 $(TESTS)
204 testone4:: everything
205 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) $(DEFAULT_TEST_OPTIONS) --one $(TESTS)
207 test4-swrap:: everything
208 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper --immediate $(TESTS)
210 test4-swrap-pcap:: everything
211 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper-pcap --immediate $(TESTS)
213 test4-swrap-keep-pcap:: everything
214 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper-keep-pcap --immediate $(TESTS)
216 test4-noswrap:: everything
217 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --immediate $(TESTS)
219 quicktest4:: all
220 $(SELFTEST4) $(SELFTEST4_QUICK_OPTS) --socket-wrapper --immediate $(TESTS)
222 quicktestone4:: all
223 $(SELFTEST4) $(SELFTEST4_QUICK_OPTS) --socket-wrapper --one $(TESTS)
225 testenv4:: everything
226 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper --testenv
228 testenv4-%:: everything
229 SELFTEST_TESTENV=$* $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper --testenv
231 test4-%::
232 $(MAKE) test TESTS=$*
234 valgrindtest4:: valgrindtest-all
236 valgrindtest4-quick:: all
237 SAMBA_VALGRIND="xterm -n server -e $(selftestdir)/valgrind_run $(LD_LIBPATH_OVERRIDE)" \
238 VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \
239 $(SELFTEST4) $(SELFTEST4_QUICK_OPTS) --immediate --socket-wrapper $(TESTS)
241 valgrindtest4-all:: everything
242 SAMBA_VALGRIND="xterm -n server -e $(selftestdir)/valgrind_run $(LD_LIBPATH_OVERRIDE)" \
243 VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \
244 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --immediate --socket-wrapper $(TESTS)
246 valgrindtest4-env:: everything
247 SAMBA_VALGRIND="xterm -n server -e $(selftestdir)/valgrind_run $(LD_LIBPATH_OVERRIDE)" \
248 VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \
249 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper --testenv
251 gdbtest4:: gdbtest4-all
253 gdbtest4-quick:: all
254 SAMBA_VALGRIND="xterm -n server -e $(selftestdir)/gdb_run $(LD_LIBPATH_OVERRIDE)" \
255 $(SELFTEST4) $(SELFTEST4_QUICK_OPTS) --immediate --socket-wrapper $(TESTS)
257 gdbtest4-all:: everything
258 SAMBA_VALGRIND="xterm -n server -e $(selftestdir)/gdb_run $(LD_LIBPATH_OVERRIDE)" \
259 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --immediate --socket-wrapper $(TESTS)
261 gdbtest4-env:: everything
262 SAMBA_VALGRIND="xterm -n server -e $(selftestdir)/gdb_run $(LD_LIBPATH_OVERRIDE)" \
263 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper --testenv
265 plugins: $(PLUGINS)