s3 swat: Add XSRF protection to status page
[Samba.git] / source3 / samba4.mk
blob10e3f76bbfbe443dcc9a10b971b67afee5017666
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 libclicommonsrcdir := $(samba4srcdir)/../libcli
115 pyscriptsrcdir := $(samba4srcdir)/scripting/python
116 kdcsrcdir := $(samba4srcdir)/kdc
117 smbreadlinesrcdir := $(samba4srcdir)/lib/smbreadline
118 ntp_signdsrcdir := $(samba4srcdir)/ntp_signd
119 tdbsrcdir := $(samba4srcdir)/../lib/tdb
120 ldbsrcdir := $(samba4srcdir)/lib/ldb
121 tallocsrcdir := $(samba4srcdir)/../lib/talloc
122 comsrcdir := $(samba4srcdir)/lib/com
123 override ASN1C = bin/asn1_compile4
124 override ET_COMPILER = bin/compile_et4
125 include $(samba4srcdir)/build/make/python.mk
126 include samba4-data.mk
127 include $(samba4srcdir)/static_deps.mk
129 INSTALLPERMS = 0755
130 $(foreach SCRIPT,$(wildcard scripting/bin/*),$(eval $(call binary_install_template,$(SCRIPT))))
132 $(DESTDIR)$(bindir)/%4: bin/%4 installdirs
133 @mkdir -p $(@D)
134 @echo Installing $(@F) as $@
135 @if test -f $@; then rm -f $@.old; mv $@ $@.old; fi
136 @cp $< $@
137 @chmod $(INSTALLPERMS) $@
139 $(DESTDIR)$(sbindir)/%4: bin/%4 installdirs
140 @mkdir -p $(@D)
141 @echo Installing $(@F) as $@
142 @if test -f $@; then rm -f $@.old; mv $@ $@.old; fi
143 @cp $< $@
144 @chmod $(INSTALLPERMS) $@
146 clean::
147 @echo Removing samba 4 objects
148 @-find $(samba4srcdir) -name '*.o' -exec rm -f '{}' \;
149 @echo Removing samba 4 hostcc objects
150 @-find $(samba4srcdir) -name '*.ho' -exec rm -f '{}' \;
151 @echo Removing samba 4 libraries
152 @-rm -f $(STATIC_LIBS) $(SHARED_LIBS)
153 @-rm -f bin/static/*.a $(shliboutputdir)/*.$(SHLIBEXT) bin/mergedobj/*.o
154 @echo Removing samba 4 modules
155 @-rm -f bin/modules/*/*.$(SHLIBEXT)
156 @-rm -f bin/*_init_module.c
157 @echo Removing samba 4 dummy targets
158 @-rm -f bin/.*_*
159 @echo Removing samba 4 generated files
160 @-rm -f bin/*_init_module.c
161 @-rm -rf $(samba4srcdir)/librpc/gen_*
163 proto:: $(PROTO_HEADERS)
164 modules:: $(PLUGINS)
166 pythonmods:: $(PYTHON_PYS) $(PYTHON_SO)
168 all:: bin/samba4 bin/regpatch4 bin/regdiff4 bin/regshell4 bin/regtree4 bin/smbclient4 bin/wbinfo4 pythonmods setup plugins
169 torture:: bin/smbtorture4
170 everything:: $(patsubst %,%4,$(BINARIES))
171 setup:
172 @ln -sf ../source4/setup setup
174 S4_LD_LIBPATH_OVERRIDE = $(LIB_PATH_VAR)="$(builddir)/bin/shared"
176 SELFTEST4 = $(S4_LD_LIBPATH_OVERRIDE) EXEEXT="4" PYTHON="$(PYTHON)" PERL="$(PERL)" \
177 $(PERL) $(selftestdir)/selftest.pl --prefix=st4 \
178 --builddir=$(builddir) --srcdir=$(samba4srcdir) \
179 --exeext=4 \
180 --expected-failures=$(samba4srcdir)/selftest/knownfail \
181 --format=$(SELFTEST_FORMAT) \
182 --exclude=$(samba4srcdir)/selftest/skip --testlist="$(samba4srcdir)/selftest/tests.sh|" \
183 $(TEST4_OPTIONS)
185 SELFTEST4_NOSLOW_OPTS = --exclude=$(samba4srcdir)/selftest/slow
186 SELFTEST4_QUICK_OPTS = $(SELFTEST4_NOSLOW_OPTS) --quick --include=$(samba4srcdir)/selftest/quick
188 slowtest4:: everything
189 $(SELFTEST4) $(DEFAULT_TEST_OPTIONS) --immediate $(TESTS)
191 test4:: everything
192 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) $(DEFAULT_TEST_OPTIONS) --immediate \
193 $(TESTS)
195 testone4:: everything
196 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) $(DEFAULT_TEST_OPTIONS) --one $(TESTS)
198 test4-swrap:: everything
199 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper --immediate $(TESTS)
201 test4-swrap-pcap:: everything
202 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper-pcap --immediate $(TESTS)
204 test4-swrap-keep-pcap:: everything
205 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper-keep-pcap --immediate $(TESTS)
207 test4-noswrap:: everything
208 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --immediate $(TESTS)
210 quicktest4:: all
211 $(SELFTEST4) $(SELFTEST4_QUICK_OPTS) --socket-wrapper --immediate $(TESTS)
213 quicktestone4:: all
214 $(SELFTEST4) $(SELFTEST4_QUICK_OPTS) --socket-wrapper --one $(TESTS)
216 testenv4:: everything
217 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper --testenv
219 testenv4-%:: everything
220 SELFTEST_TESTENV=$* $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper --testenv
222 test4-%::
223 $(MAKE) test TESTS=$*
225 valgrindtest4:: valgrindtest-all
227 valgrindtest4-quick:: all
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_QUICK_OPTS) --immediate --socket-wrapper $(TESTS)
232 valgrindtest4-all:: 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) --immediate --socket-wrapper $(TESTS)
237 valgrindtest4-env:: everything
238 SMBD_VALGRIND="xterm -n server -e $(selftestdir)/valgrind_run $(LD_LIBPATH_OVERRIDE)" \
239 VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \
240 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper --testenv
242 gdbtest4:: gdbtest4-all
244 gdbtest4-quick:: all
245 SMBD_VALGRIND="xterm -n server -e $(selftestdir)/gdb_run $(LD_LIBPATH_OVERRIDE)" \
246 $(SELFTEST4) $(SELFTEST4_QUICK_OPTS) --immediate --socket-wrapper $(TESTS)
248 gdbtest4-all:: everything
249 SMBD_VALGRIND="xterm -n server -e $(selftestdir)/gdb_run $(LD_LIBPATH_OVERRIDE)" \
250 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --immediate --socket-wrapper $(TESTS)
252 gdbtest4-env:: everything
253 SMBD_VALGRIND="xterm -n server -e $(selftestdir)/gdb_run $(LD_LIBPATH_OVERRIDE)" \
254 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper --testenv
256 plugins: $(PLUGINS)