1 all: showflags $(ALL_PREDEP) bin/asn1_compile bin/compile_et binaries libraries modules
4 include heimdal_build/config.mk
9 include smbd/process_model.mk
10 include libnet/config.mk
11 include auth/config.mk
12 include nsswitch/config.mk
14 include param/config.mk
15 include smb_server/config.mk
16 include rpc_server/config.mk
17 include ldap_server/config.mk
18 include web_server/config.mk
19 include winbind/config.mk
20 include nbt_server/config.mk
21 include wrepl_server/config.mk
22 include cldap_server/config.mk
23 include utils/net/config.mk
24 include utils/config.mk
25 include ntvfs/config.mk
26 include ntptr/config.mk
27 include torture/config.mk
28 include librpc/config.mk
29 include client/config.mk
30 include libcli/config.mk
31 include scripting/ejs/config.mk
32 include scripting/swig/config.mk
34 include passdb/config.mk
36 DEFAULT_HEADERS = $(srcdir)/include/core.h \
37 $(srcdir)/lib/util/dlinklist.h \
41 libraries: $(STATIC_LIBS) $(SHARED_LIBS)
42 modules: $(SHARED_MODULES)
43 headers: $(PUBLIC_HEADERS) $(DEFAULT_HEADERS)
48 @echo 'Samba will be installed into:'
49 @echo ' basedir: $(BASEDIR)'
50 @echo ' bindir: $(BINDIR)'
51 @echo ' sbindir: $(SBINDIR)'
52 @echo ' libdir: $(LIBDIR)'
53 @echo ' modulesdir: $(MODULESDIR)'
54 @echo ' includedir: $(INCLUDEDIR)'
55 @echo ' vardir: $(VARDIR)'
56 @echo ' privatedir: $(PRIVATEDIR)'
57 @echo ' piddir: $(PIDDIR)'
58 @echo ' lockdir: $(LOCKDIR)'
59 @echo ' logfilebase: $(LOGFILEBASE)'
60 @echo ' setupdir: $(SETUPDIR)'
61 @echo ' jsdir: $(JSDIR)'
62 @echo ' swatdir: $(SWATDIR)'
63 @echo ' mandir: $(MANDIR)'
64 @echo ' torturedir: $(TORTUREDIR)'
65 @echo ' datadir: $(DATADIR)'
66 @echo ' winbindd_socket_dir: $(WINBINDD_SOCKET_DIR)'
69 @echo 'Samba will be compiled with flags:'
71 @echo ' CPPFLAGS = $(CPPFLAGS)'
73 @echo ' CFLAGS = $(CFLAGS)'
74 @echo ' PICFLAG = $(PICFLAG)'
76 @echo ' LDFLAGS = $(LDFLAGS)'
77 @echo ' STLD = $(STLD)'
78 @echo ' STLD_FLAGS = $(STLD_FLAGS)'
79 @echo ' SHLD = $(SHLD)'
80 @echo ' SHLD_FLAGS = $(SHLD_FLAGS)'
81 @echo ' SHLIBEXT = $(SHLIBEXT)'
83 # The permissions to give the executables
86 # set these to where to find various files
87 # These can be overridden by command line switches (see smbd(8))
88 # or in smb.conf (see smb.conf(5))
89 CONFIGFILE = $(CONFIGDIR)/smb.conf
90 PKGCONFIGDIR = $(LIBDIR)/pkgconfig
91 LMHOSTSFILE = $(CONFIGDIR)/lmhosts
93 install: showlayout installbin installdat installswat installmisc installlib \
94 installheader installpc installplugins
96 # DESTDIR is used here to prevent packagers wasting their time
97 # duplicating the Makefile. Remove it and you will have the privilege
98 # of packaging each samba release for multiple versions of multiple
99 # distributions and operating systems, or at least supplying patches
100 # to all the packaging files required for this, prior to committing
101 # the removal of DESTDIR. Do not remove it even though you think it
105 @$(SHELL) $(srcdir)/script/installdirs.sh \
106 $(DESTDIR)$(BASEDIR) \
107 $(DESTDIR)$(BINDIR) \
108 $(DESTDIR)$(SBINDIR) \
109 $(DESTDIR)$(TORTUREDIR) \
110 $(DESTDIR)$(LIBDIR) \
111 $(DESTDIR)$(MODULESDIR) \
112 $(DESTDIR)$(MANDIR) \
113 $(DESTDIR)$(VARDIR) \
114 $(DESTDIR)$(PRIVATEDIR) \
115 $(DESTDIR)$(DATADIR) \
116 $(DESTDIR)$(PIDDIR) \
117 $(DESTDIR)$(LOCKDIR) \
118 $(DESTDIR)$(LOGFILEBASE) \
119 $(DESTDIR)$(PRIVATEDIR)/tls \
120 $(DESTDIR)$(INCLUDEDIR) \
121 $(DESTDIR)$(PKGCONFIGDIR) \
122 $(DESTDIR)$(CONFIGDIR) \
124 installbin: $(SBIN_PROGS) $(BIN_PROGS) installdirs
125 @$(SHELL) $(srcdir)/script/installbin.sh \
127 $(DESTDIR)$(BASEDIR) \
128 $(DESTDIR)$(SBINDIR) \
129 $(DESTDIR)$(LIBDIR) \
130 $(DESTDIR)$(VARDIR) \
132 @$(SHELL) $(srcdir)/script/installbin.sh \
134 $(DESTDIR)$(BASEDIR) \
135 $(DESTDIR)$(BINDIR) \
136 $(DESTDIR)$(LIBDIR) \
137 $(DESTDIR)$(VARDIR) \
139 @$(SHELL) $(srcdir)/script/installbin.sh \
141 $(DESTDIR)$(BASEDIR) \
142 $(DESTDIR)$(TORTUREDIR) \
143 $(DESTDIR)$(LIBDIR) \
144 $(DESTDIR)$(VARDIR) \
147 installlib: $(INSTALLABLE_SHARED_LIBS) $(STATIC_LIBS) installdirs
148 @$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(LIBDIR) "$(SHLIBEXT)" $(INSTALLABLE_SHARED_LIBS)
149 @$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(LIBDIR) "$(STLIBEXT)" $(STATIC_LIBS)
151 installheader: headers installdirs
152 @$(PERL) $(srcdir)/script/installheader.pl $(DESTDIR)$(INCLUDEDIR) $(PUBLIC_HEADERS) $(DEFAULT_HEADERS)
154 installdat: installdirs
155 @$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(DATADIR) $(srcdir)
157 installswat: installdirs
158 @$(SHELL) $(srcdir)/script/installswat.sh $(DESTDIR)$(SWATDIR) $(srcdir)
160 installman: manpages installdirs
161 @$(SHELL) $(srcdir)/script/installman.sh $(DESTDIR)$(MANDIR) $(MANPAGES)
163 installmisc: installdirs
164 @$(SHELL) $(srcdir)/script/installmisc.sh $(srcdir) $(DESTDIR)$(JSDIR) $(DESTDIR)$(SETUPDIR) $(DESTDIR)$(BINDIR)
166 installpc: installdirs
167 @$(SHELL) $(srcdir)/script/installpc.sh $(builddir) $(DESTDIR)$(PKGCONFIGDIR) $(PC_FILES)
169 uninstall: uninstallbin uninstallman uninstallmisc uninstalllib uninstallheader \
176 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(SBIN_PROGS)
177 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(BIN_PROGS)
178 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(TORTUREDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(TORTURE_PROGS)
181 @$(SHELL) $(srcdir)/script/uninstalllib.sh $(DESTDIR)$(LIBDIR) $(SHARED_LIBS)
182 @$(SHELL) $(srcdir)/script/uninstalllib.sh $(DESTDIR)$(LIBDIR) $(STATIC_LIBS)
185 @$(SHELL) $(srcdir)/script/uninstallheader.sh $(DESTDIR)$(INCLUDEDIR) $(PUBLIC_HEADERS)
188 @$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(MANDIR) $(MANPAGES)
190 Makefile: config.status $(MK_FILES)
194 etags `find $(srcdir) -name "*.[ch]"`
197 ctags `find $(srcdir) -name "*.[ch]"`
199 pidl/Makefile: pidl/Makefile.PL
200 cd pidl && $(PERL) Makefile.PL
202 installpidl: pidl/Makefile
203 $(MAKE) -C pidl install
205 uninstallpidl: pidl/Makefile
206 $(MAKE) -C pidl uninstall
208 $(IDL_HEADER_FILES) \
209 $(IDL_NDR_PARSE_H_FILES) $(IDL_NDR_PARSE_C_FILES) \
210 $(IDL_NDR_CLIENT_C_FILES) $(IDL_NDR_CLIENT_H_FILES) \
211 $(IDL_NDR_SERVER_C_FILES) $(IDL_SWIG_FILES) \
212 $(IDL_NDR_EJS_C_FILES) $(IDL_NDR_EJS_H_FILES): idl
214 idl_full: pidl/lib/Parse/Pidl/IDL.pm
215 @CPP="$(CPP)" PERL="$(PERL)" srcdir=$(srcdir) $(srcdir)/script/build_idl.sh FULL $(PIDL_ARGS)
217 idl: pidl/lib/Parse/Pidl/IDL.pm
218 @CPP="$(CPP)" PERL="$(PERL)" srcdir=$(srcdir) $(srcdir)/script/build_idl.sh PARTIAL $(PIDL_ARGS)
220 pidl/lib/Parse/Pidl/IDL.pm: pidl/idl.yp
221 -$(YAPP) -s -m 'Parse::Pidl::IDL' -o pidl/lib/Parse/Pidl/IDL.pm pidl/idl.yp ||\
222 touch pidl/lib/Parse/Pidl/IDL.pm
224 smb_interfaces: pidl/smb_interfaces.pm
225 $(PERL) -Ipidl $(srcdir)/script/build_smb_interfaces.pl \
226 include/smb_interfaces.h
228 pidl/smb_interfaces.pm: pidl/smb_interfaces.yp
229 -$(YAPP) -s -m 'smb_interfaces' -o pidl/smb_interfaces.pm pidl/smb_interfaces.yp ||\
230 touch pidl/smb_interfaces.pm
233 @echo "include/config.h not present"
234 @echo "You need to rerun ./autogen.sh and ./configure"
237 $(srcdir)/version.h: $(srcdir)/VERSION
238 @$(SHELL) script/mkversion.sh VERSION $(srcdir)/version.h $(srcdir)/
241 @$(SHELL) script/mkversion.sh VERSION $(srcdir)/version.h $(srcdir)/
244 @echo "Removing precompiled headers"
245 @-rm -f include/includes.h.gch
247 pch: clean_pch include/includes.h.gch
250 @echo Removing objects
251 @-find . -name '*.o' -exec rm -f '{}' \;
252 @echo Removing hostcc objects
253 @-find . -name '*.ho' -exec rm -f '{}' \;
254 @echo Removing binaries
255 @-rm -f $(BIN_PROGS) $(SBIN_PROGS) $(BINARIES) $(TORTURE_PROGS)
256 @echo Removing libraries
257 @-rm -f $(STATIC_LIBRARIES) $(SHARED_LIBRARIES)
258 @-rm -f bin/*.$(SHLIBEXT)*
260 @echo Removing modules
261 @-rm -f bin/modules/*/*.$(SHLIBEXT)
262 @-rm -f bin/*_init_module.c
263 @echo Removing dummy targets
265 @echo Removing generated files
266 @-rm -f bin/*_init_module.c
267 @-rm -rf librpc/gen_*
268 @echo Removing proto headers
269 @-rm -f $(PROTO_HEADERS)
272 -rm -f include/config.h include/config_tmp.h include/build.h
275 -rm -f config.log config.cache
276 -rm -f config.pm config.mk
280 -rm -f *.bak *~ */*.bak */*~ */*/*.bak */*/*~ */*/*/*.bak */*/*/*~
282 realdistclean: distclean removebackup
283 -rm -f include/config_tmp.h.in
288 test: $(DEFAULT_TEST_TARGET)
291 $(srcdir)/script/tests/selftest.sh ${selftest_prefix} all SOCKET_WRAPPER
294 $(srcdir)/script/tests/selftest.sh ${selftest_prefix} all
297 $(srcdir)/script/tests/selftest.sh ${selftest_prefix} quick SOCKET_WRAPPER
300 $(srcdir)/script/tests/selftest.sh ${selftest_prefix} xterm SOCKET_WRAPPER
302 valgrindtest: valgrindtest-quick
304 valgrindtest-quick: all
305 SMBD_VALGRIND="xterm -n smbd -e valgrind -q --db-attach=yes --num-callers=30" \
306 VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \
307 $(srcdir)/script/tests/selftest.sh ${selftest_prefix} quick SOCKET_WRAPPER
309 valgrindtest-all: all
310 SMBD_VALGRIND="xterm -n smbd -e valgrind -q --db-attach=yes --num-callers=30" \
311 VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \
312 $(srcdir)/script/tests/selftest.sh ${selftest_prefix} all SOCKET_WRAPPER
314 gdbtest: gdbtest-quick
317 SMBD_VALGRIND="xterm -n smbd -e gdb --args " \
318 $(srcdir)/script/tests/selftest.sh ${selftest_prefix} quick SOCKET_WRAPPER
321 SMBD_VALGRIND="xterm -n smbd -e gdb --args " \
322 $(srcdir)/script/tests/selftest.sh ${selftest_prefix} all SOCKET_WRAPPER
325 $(srcdir)/script/tests/selftest.sh ${selftest_prefix} win
328 $(srcdir)/script/find_unused_macros.pl `find . -name "*.[ch]"` | sort
330 ###############################################################################
332 ###############################################################################
334 .SUFFIXES: .x .c .et .y .l .d .o .h .h.gch .a .so .1 .1.xml .3 .3.xml .5 .5.xml .7 .7.xml .8 .8.xml .ho .idl .hd
337 @echo "Generating dependencies for $<"
338 @$(CC) -M -MG -MP -MT $(<:.c=.o) -MT $@ `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) $< -o $@
341 @echo "Generating host-compiler dependencies for $<"
342 @$(CC) -M -MG -MP -MT $(<:.c=.ho) -MT $@ `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) $< -o $@
344 include/includes.d: include/includes.h
345 @echo "Generating dependencies for $<"
346 @$(CC) -M -MG -MT include/includes.h.gch -MT $@ $(CFLAGS) $< -o $@
349 # $< is broken in older BSD versions:
350 # when $@ is foo/bar.o, $< could be torture/foo/bar.c
351 # if it also exists. So better use $* which is foo/bar
352 # and append .c manually to get foo/bar.c
355 @if test -n "$(CC_CHECKER)"; then \
356 echo "Checking $*.c with '$(CC_CHECKER)'"; \
357 $(CC_CHECKER) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) $(PICFLAG) -c $*.c -o $@; \
359 @echo "Compiling $*.c"
360 @$(CC) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) $(PICFLAG) -c $*.c -o $@ && exit 0;\
361 echo "The following command failed:" 1>&2;\
362 echo "$(CC) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) $(PICFLAG) -c $*.c -o $@" 1>&2;\
363 $(CC) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) $(PICFLAG) -c $*.c -o $@ >/dev/null 2>&1
366 @echo "Compiling $*.c with host compiler"
367 @$(HOSTCC) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) -c $*.c -o $@ && exit 0;\
368 echo "The following command failed:" 1>&2;\
369 echo "$(HOSTCC) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) -c $*.c -o $@" 1>&2;\
370 $(HOSTCC) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) -c $*.c -o $@ >/dev/null 2>&1
373 @echo "Precompiling $<"
374 @$(CC) -Ilib/replace `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) $(PICFLAG) -c $< -o $@
377 @echo "Building $< with $(YACC)"
378 @-$(srcdir)/script/yacc_compile.sh "$(YACC)" "$<" "$@"
381 @echo "Building $< with $(LEX)"
382 @-$(srcdir)/script/lex_compile.sh "$(LEX)" "$<" "$@"
384 DOCBOOK_MANPAGE_URL = http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
387 $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
390 $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
393 $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
396 $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
399 $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
401 DEP_FILES = $(patsubst %.ho,%.hd,$(patsubst %.o,%.d,$(ALL_OBJS))) \
404 dist:: distclean idl_full manpages configure
410 @echo Removing dependency files
411 @find . -name \*.d -o -name \*.hd | xargs rm -f