r18913: an attempt to get tdb/ldb working on the HPUX box 'gwen'. This idea
[Samba.git] / source / main.mk
blob7151ebb70b0e22b6df88d0e13db32912e50d8d83
1 all: showflags $(ALL_PREDEP) bin/asn1_compile bin/compile_et binaries libraries modules
3 include dynconfig.mk
4 include heimdal_build/config.mk
5 include config.mk
6 include dsdb/config.mk
7 include gtk/config.mk
8 include smbd/config.mk
9 include smbd/process_model.mk
10 include libnet/config.mk
11 include auth/config.mk
12 include nsswitch/config.mk
13 include lib/basic.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
33 include kdc/config.mk
34 include passdb/config.mk
36 DEFAULT_HEADERS = $(srcdir)/include/core.h \
37 $(srcdir)/lib/util/dlinklist.h \
38 $(srcdir)/version.h
40 binaries: $(BINARIES)
41 libraries: $(STATIC_LIBS) $(SHARED_LIBS)
42 modules: $(SHARED_MODULES)
43 headers: $(PUBLIC_HEADERS) $(DEFAULT_HEADERS)
44 manpages: $(MANPAGES)
45 everything: all
47 showlayout:
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 ' datadir: $(DATADIR)'
65 @echo ' winbindd_socket_dir: $(WINBINDD_SOCKET_DIR)'
67 showflags:
68 @echo 'Samba will be compiled with flags:'
69 @echo ' CPP = $(CPP)'
70 @echo ' CPPFLAGS = $(CPPFLAGS)'
71 @echo ' CC = $(CC)'
72 @echo ' CFLAGS = $(CFLAGS)'
73 @echo ' PICFLAG = $(PICFLAG)'
74 @echo ' LD = $(LD)'
75 @echo ' LDFLAGS = $(LDFLAGS)'
76 @echo ' STLD = $(STLD)'
77 @echo ' STLD_FLAGS = $(STLD_FLAGS)'
78 @echo ' SHLD = $(SHLD)'
79 @echo ' SHLD_FLAGS = $(SHLD_FLAGS)'
80 @echo ' SHLIBEXT = $(SHLIBEXT)'
82 # The permissions to give the executables
83 INSTALLPERMS = 0755
85 # set these to where to find various files
86 # These can be overridden by command line switches (see smbd(8))
87 # or in smb.conf (see smb.conf(5))
88 CONFIGFILE = $(CONFIGDIR)/smb.conf
89 PKGCONFIGDIR = $(LIBDIR)/pkgconfig
90 LMHOSTSFILE = $(CONFIGDIR)/lmhosts
92 install: showlayout installbin installdat installswat installmisc installlib \
93 installheader installpc installplugins
95 # DESTDIR is used here to prevent packagers wasting their time
96 # duplicating the Makefile. Remove it and you will have the privilege
97 # of packaging each samba release for multiple versions of multiple
98 # distributions and operating systems, or at least supplying patches
99 # to all the packaging files required for this, prior to committing
100 # the removal of DESTDIR. Do not remove it even though you think it
101 # is not used.
103 installdirs:
104 @$(SHELL) $(srcdir)/script/installdirs.sh \
105 $(DESTDIR)$(BASEDIR) \
106 $(DESTDIR)$(BINDIR) \
107 $(DESTDIR)$(SBINDIR) \
108 $(DESTDIR)$(LIBDIR) \
109 $(DESTDIR)$(MODULESDIR) \
110 $(DESTDIR)$(MANDIR) \
111 $(DESTDIR)$(VARDIR) \
112 $(DESTDIR)$(PRIVATEDIR) \
113 $(DESTDIR)$(DATADIR) \
114 $(DESTDIR)$(PIDDIR) \
115 $(DESTDIR)$(LOCKDIR) \
116 $(DESTDIR)$(LOGFILEBASE) \
117 $(DESTDIR)$(PRIVATEDIR)/tls \
118 $(DESTDIR)$(INCLUDEDIR) \
119 $(DESTDIR)$(PKGCONFIGDIR) \
120 $(DESTDIR)$(CONFIGDIR) \
122 installbin: $(SBIN_PROGS) $(BIN_PROGS) installdirs
123 @$(SHELL) $(srcdir)/script/installbin.sh \
124 $(INSTALLPERMS) \
125 $(DESTDIR)$(BASEDIR) \
126 $(DESTDIR)$(SBINDIR) \
127 $(DESTDIR)$(LIBDIR) \
128 $(DESTDIR)$(VARDIR) \
129 $(SBIN_PROGS)
130 @$(SHELL) $(srcdir)/script/installbin.sh \
131 $(INSTALLPERMS) \
132 $(DESTDIR)$(BASEDIR) \
133 $(DESTDIR)$(BINDIR) \
134 $(DESTDIR)$(LIBDIR) \
135 $(DESTDIR)$(VARDIR) \
136 $(BIN_PROGS)
138 installlib: $(INSTALLABLE_SHARED_LIBS) $(STATIC_LIBS) installdirs
139 @$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(LIBDIR) "$(SHLIBEXT)" $(INSTALLABLE_SHARED_LIBS)
140 @$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(LIBDIR) "$(STLIBEXT)" $(STATIC_LIBS)
142 installheader: headers installdirs
143 @$(PERL) $(srcdir)/script/installheader.pl $(DESTDIR)$(INCLUDEDIR) $(PUBLIC_HEADERS) $(DEFAULT_HEADERS)
145 installdat: installdirs
146 @$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(DATADIR) $(srcdir)
148 installswat: installdirs
149 @$(SHELL) $(srcdir)/script/installswat.sh $(DESTDIR)$(SWATDIR) $(srcdir)
151 installman: manpages installdirs
152 @$(SHELL) $(srcdir)/script/installman.sh $(DESTDIR)$(MANDIR) $(MANPAGES)
154 installmisc: installdirs
155 @$(SHELL) $(srcdir)/script/installmisc.sh $(srcdir) $(DESTDIR)$(JSDIR) $(DESTDIR)$(SETUPDIR) $(DESTDIR)$(BINDIR)
157 installpc: installdirs
158 @$(SHELL) $(srcdir)/script/installpc.sh $(builddir) $(DESTDIR)$(PKGCONFIGDIR) $(PC_FILES)
160 uninstall: uninstallbin uninstallman uninstallmisc uninstalllib uninstallheader \
161 uninstallplugins
163 uninstallmisc:
164 #FIXME
166 uninstallbin:
167 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(SBIN_PROGS)
168 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(BIN_PROGS)
170 uninstalllib:
171 @$(SHELL) $(srcdir)/script/uninstalllib.sh $(DESTDIR)$(LIBDIR) $(SHARED_LIBS)
172 @$(SHELL) $(srcdir)/script/uninstalllib.sh $(DESTDIR)$(LIBDIR) $(STATIC_LIBS)
174 uninstallheader:
175 @$(SHELL) $(srcdir)/script/uninstallheader.sh $(DESTDIR)$(INCLUDEDIR) $(PUBLIC_HEADERS)
177 uninstallman:
178 @$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(MANDIR) $(MANPAGES)
180 Makefile: config.status $(MK_FILES)
181 ./config.status
183 etags:
184 etags `find $(srcdir) -name "*.[ch]"`
186 ctags:
187 ctags `find $(srcdir) -name "*.[ch]"`
189 pidl/Makefile: pidl/Makefile.PL
190 cd pidl && $(PERL) Makefile.PL
192 installpidl: pidl/Makefile
193 $(MAKE) -C pidl install
195 uninstallpidl: pidl/Makefile
196 $(MAKE) -C pidl uninstall
198 $(IDL_HEADER_FILES) \
199 $(IDL_NDR_PARSE_H_FILES) $(IDL_NDR_PARSE_C_FILES) \
200 $(IDL_NDR_CLIENT_C_FILES) $(IDL_NDR_CLIENT_H_FILES) \
201 $(IDL_NDR_SERVER_C_FILES) $(IDL_SWIG_FILES) \
202 $(IDL_NDR_EJS_C_FILES) $(IDL_NDR_EJS_H_FILES): idl
204 idl_full: pidl/lib/Parse/Pidl/IDL.pm
205 @CPP="$(CPP)" PERL="$(PERL)" srcdir=$(srcdir) $(srcdir)/script/build_idl.sh FULL $(PIDL_ARGS)
207 idl: pidl/lib/Parse/Pidl/IDL.pm
208 @CPP="$(CPP)" PERL="$(PERL)" srcdir=$(srcdir) $(srcdir)/script/build_idl.sh PARTIAL $(PIDL_ARGS)
210 pidl/lib/Parse/Pidl/IDL.pm: pidl/idl.yp
211 -$(YAPP) -s -m 'Parse::Pidl::IDL' -o pidl/lib/Parse/Pidl/IDL.pm pidl/idl.yp ||\
212 touch pidl/lib/Parse/Pidl/IDL.pm
214 smb_interfaces: pidl/smb_interfaces.pm
215 $(PERL) -Ipidl $(srcdir)/script/build_smb_interfaces.pl \
216 include/smb_interfaces.h
218 pidl/smb_interfaces.pm: pidl/smb_interfaces.yp
219 -$(YAPP) -s -m 'smb_interfaces' -o pidl/smb_interfaces.pm pidl/smb_interfaces.yp ||\
220 touch pidl/smb_interfaces.pm
222 include/config.h:
223 @echo "include/config.h not present"
224 @echo "You need to rerun ./autogen.sh and ./configure"
225 @/bin/false
227 $(srcdir)/version.h: $(srcdir)/VERSION
228 @$(SHELL) script/mkversion.sh VERSION $(srcdir)/version.h $(srcdir)/
230 regen_version:
231 @$(SHELL) script/mkversion.sh VERSION $(srcdir)/version.h $(srcdir)/
233 clean_pch:
234 @echo "Removing precompiled headers"
235 @-rm -f include/includes.h.gch
237 pch: clean_pch include/includes.h.gch
239 clean:: clean_pch
240 @echo Removing objects
241 @-find . -name '*.o' -exec rm -f '{}' \;
242 @echo Removing hostcc objects
243 @-find . -name '*.ho' -exec rm -f '{}' \;
244 @echo Removing binaries
245 @-rm -f $(BIN_PROGS) $(SBIN_PROGS) $(BINARIES)
246 @echo Removing libraries
247 @-rm -f $(STATIC_LIBRARIES) $(SHARED_LIBRARIES)
248 @-rm -f bin/*.$(SHLIBEXT)*
249 @-rm -f bin/*.a
250 @echo Removing modules
251 @-rm -f bin/modules/*/*.$(SHLIBEXT)
252 @-rm -f bin/*_init_module.c
253 @echo Removing dummy targets
254 @-rm -f bin/.*_*
255 @echo Removing generated files
256 @-rm -f bin/*_init_module.c
257 @-rm -rf librpc/gen_*
258 @echo Removing proto headers
259 @-rm -f $(PROTO_HEADERS)
261 distclean: clean
262 -rm -f include/config.h include/config_tmp.h include/build.h
263 -rm -f Makefile
264 -rm -f config.status
265 -rm -f config.log config.cache
266 -rm -f config.pm config.mk
267 -rm -f $(PC_FILES)
269 removebackup:
270 -rm -f *.bak *~ */*.bak */*~ */*/*.bak */*/*~ */*/*/*.bak */*/*/*~
272 realdistclean: distclean removebackup
273 -rm -f include/config_tmp.h.in
274 -rm -f version.h
275 -rm -f configure
276 -rm -f $(MANPAGES)
278 test: $(DEFAULT_TEST_TARGET)
280 test-swrap: all
281 $(srcdir)/script/tests/selftest.sh ${selftest_prefix} all SOCKET_WRAPPER
283 test-noswrap: all
284 $(srcdir)/script/tests/selftest.sh ${selftest_prefix} all
286 quicktest: all
287 $(srcdir)/script/tests/selftest.sh ${selftest_prefix} quick SOCKET_WRAPPER
289 testenv: all
290 $(srcdir)/script/tests/selftest.sh ${selftest_prefix} xterm SOCKET_WRAPPER
292 valgrindtest: valgrindtest-quick
294 valgrindtest-quick: all
295 SMBD_VALGRIND="xterm -n smbd -e valgrind -q --db-attach=yes --num-callers=30" \
296 VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \
297 $(srcdir)/script/tests/selftest.sh ${selftest_prefix} quick SOCKET_WRAPPER
299 valgrindtest-all: all
300 SMBD_VALGRIND="xterm -n smbd -e valgrind -q --db-attach=yes --num-callers=30" \
301 VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \
302 $(srcdir)/script/tests/selftest.sh ${selftest_prefix} all SOCKET_WRAPPER
304 gdbtest: gdbtest-quick
306 gdbtest-quick: all
307 SMBD_VALGRIND="xterm -n smbd -e gdb --args " \
308 $(srcdir)/script/tests/selftest.sh ${selftest_prefix} quick SOCKET_WRAPPER
310 gdbtest-all: all
311 SMBD_VALGRIND="xterm -n smbd -e gdb --args " \
312 $(srcdir)/script/tests/selftest.sh ${selftest_prefix} all SOCKET_WRAPPER
314 wintest: all
315 $(srcdir)/script/tests/selftest.sh ${selftest_prefix} win
317 unused_macros:
318 $(srcdir)/script/find_unused_macros.pl `find . -name "*.[ch]"` | sort
320 ###############################################################################
321 # File types
322 ###############################################################################
324 .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
326 .c.d:
327 @echo "Generating dependencies for $<"
328 @$(CC) -M -MG -MP -MT $(<:.c=.o) -MT $@ `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) $< -o $@
330 .c.hd:
331 @echo "Generating host-compiler dependencies for $<"
332 @$(CC) -M -MG -MP -MT $(<:.c=.ho) -MT $@ `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) $< -o $@
334 include/includes.d: include/includes.h
335 @echo "Generating dependencies for $<"
336 @$(CC) -M -MG -MT include/includes.h.gch -MT $@ $(CFLAGS) $< -o $@
339 # $< is broken in older BSD versions:
340 # when $@ is foo/bar.o, $< could be torture/foo/bar.c
341 # if it also exists. So better use $* which is foo/bar
342 # and append .c manually to get foo/bar.c
344 .c.o:
345 @if test -n "$(CC_CHECKER)"; then \
346 echo "Checking $*.c with '$(CC_CHECKER)'"; \
347 $(CC_CHECKER) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) $(PICFLAG) -c $*.c -o $@; \
349 @echo "Compiling $*.c"
350 @$(CC) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) $(PICFLAG) -c $*.c -o $@ && exit 0;\
351 echo "The following command failed:" 1>&2;\
352 echo "$(CC) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) $(PICFLAG) -c $*.c -o $@" 1>&2;\
353 $(CC) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) $(PICFLAG) -c $*.c -o $@ >/dev/null 2>&1
355 .c.ho:
356 @echo "Compiling $*.c with host compiler"
357 @$(HOSTCC) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) -c $*.c -o $@ && exit 0;\
358 echo "The following command failed:" 1>&2;\
359 echo "$(HOSTCC) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) -c $*.c -o $@" 1>&2;\
360 $(HOSTCC) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) -c $*.c -o $@ >/dev/null 2>&1
362 .h.h.gch:
363 @echo "Precompiling $<"
364 @$(CC) -Ilib/replace `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) $(PICFLAG) -c $< -o $@
366 .y.c:
367 @echo "Building $< with $(YACC)"
368 @-$(srcdir)/script/yacc_compile.sh "$(YACC)" "$<" "$@"
370 .l.c:
371 @echo "Building $< with $(LEX)"
372 @-$(srcdir)/script/lex_compile.sh "$(LEX)" "$<" "$@"
374 DOCBOOK_MANPAGE_URL = http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
376 .1.xml.1:
377 $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
379 .3.xml.3:
380 $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
382 .5.xml.5:
383 $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
385 .7.xml.7:
386 $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
388 .8.xml.8:
389 $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
391 DEP_FILES = $(patsubst %.ho,%.hd,$(patsubst %.o,%.d,$(ALL_OBJS))) \
392 include/includes.d
394 dist:: distclean idl_full manpages configure
396 configure:
397 ./autogen.sh
399 clean::
400 @echo Removing dependency files
401 @find . -name \*.d -o -name \*.hd | xargs rm -f