Merge branch 'master' of ssh://jra@git.samba.org/data/git/samba
[Samba.git] / source3 / samba4.mk
blob715961e4de545c09a82b4539826a8e3c8fc53e54
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 S4_LD_LIBPATH_OVERRIDE = $(LIB_PATH_VAR)="$(builddir)/bin/shared"
175 SELFTEST4 = $(S4_LD_LIBPATH_OVERRIDE) EXEEXT="4" $(PERL) $(selftestdir)/selftest.pl --prefix=st4 \
176 --builddir=$(builddir) --srcdir=$(samba4srcdir) \
177 --exeext=4 \
178 --expected-failures=$(samba4srcdir)/selftest/knownfail \
179 --format=$(SELFTEST_FORMAT) \
180 --exclude=$(samba4srcdir)/selftest/skip --testlist="$(samba4srcdir)/selftest/tests.sh|" \
181 $(TEST4_OPTIONS)
183 SELFTEST4_NOSLOW_OPTS = --exclude=$(samba4srcdir)/selftest/slow
184 SELFTEST4_QUICK_OPTS = $(SELFTEST4_NOSLOW_OPTS) --quick --include=$(samba4srcdir)/selftest/quick
186 slowtest4:: everything
187 $(SELFTEST4) $(DEFAULT_TEST_OPTIONS) --immediate $(TESTS)
189 test4:: everything
190 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) $(DEFAULT_TEST_OPTIONS) --immediate \
191 $(TESTS)
193 testone4:: everything
194 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) $(DEFAULT_TEST_OPTIONS) --one $(TESTS)
196 test4-swrap:: everything
197 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper --immediate $(TESTS)
199 test4-swrap-pcap:: everything
200 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper-pcap --immediate $(TESTS)
202 test4-swrap-keep-pcap:: everything
203 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper-keep-pcap --immediate $(TESTS)
205 test4-noswrap:: everything
206 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --immediate $(TESTS)
208 quicktest4:: all
209 $(SELFTEST4) $(SELFTEST4_QUICK_OPTS) --socket-wrapper --immediate $(TESTS)
211 quicktestone4:: all
212 $(SELFTEST4) $(SELFTEST4_QUICK_OPTS) --socket-wrapper --one $(TESTS)
214 testenv4:: everything
215 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper --testenv
217 testenv4-%:: everything
218 SELFTEST_TESTENV=$* $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper --testenv
220 test4-%::
221 $(MAKE) test TESTS=$*
223 valgrindtest4:: valgrindtest-all
225 valgrindtest4-quick:: all
226 SMBD_VALGRIND="xterm -n server -e $(selftestdir)/valgrind_run $(LD_LIBPATH_OVERRIDE)" \
227 VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \
228 $(SELFTEST4) $(SELFTEST4_QUICK_OPTS) --immediate --socket-wrapper $(TESTS)
230 valgrindtest4-all:: everything
231 SMBD_VALGRIND="xterm -n server -e $(selftestdir)/valgrind_run $(LD_LIBPATH_OVERRIDE)" \
232 VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \
233 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --immediate --socket-wrapper $(TESTS)
235 valgrindtest4-env:: everything
236 SMBD_VALGRIND="xterm -n server -e $(selftestdir)/valgrind_run $(LD_LIBPATH_OVERRIDE)" \
237 VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \
238 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper --testenv
240 gdbtest4:: gdbtest4-all
242 gdbtest4-quick:: all
243 SMBD_VALGRIND="xterm -n server -e $(selftestdir)/gdb_run $(LD_LIBPATH_OVERRIDE)" \
244 $(SELFTEST4) $(SELFTEST4_QUICK_OPTS) --immediate --socket-wrapper $(TESTS)
246 gdbtest4-all:: everything
247 SMBD_VALGRIND="xterm -n server -e $(selftestdir)/gdb_run $(LD_LIBPATH_OVERRIDE)" \
248 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --immediate --socket-wrapper $(TESTS)
250 gdbtest4-env:: everything
251 SMBD_VALGRIND="xterm -n server -e $(selftestdir)/gdb_run $(LD_LIBPATH_OVERRIDE)" \
252 $(SELFTEST4) $(SELFTEST4_NOSLOW_OPTS) --socket-wrapper --testenv
254 plugins: $(PLUGINS)