r12556: added 'make gdbtest'
[jelmer/samba4-debian.git] / source / main.mk
1 all: basics bin/asn1_compile bin/compile_et binaries
2
3 include heimdal_build/config.mk
4 include config.mk
5 include dsdb/config.mk
6 include gtk/config.mk
7 include smbd/config.mk
8 include smbd/process_model.mk
9 include libnet/config.mk
10 include auth/config.mk
11 include nsswitch/config.mk
12 include lib/basic.mk
13 include param/config.mk
14 include smb_server/config.mk
15 include rpc_server/config.mk
16 include ldap_server/config.mk
17 include web_server/config.mk
18 include winbind/config.mk
19 include nbt_server/config.mk
20 include wrepl_server/config.mk
21 include cldap_server/config.mk
22 include utils/net/config.mk
23 include utils/config.mk
24 include ntvfs/config.mk
25 include ntptr/config.mk
26 include torture/config.mk
27 include librpc/config.mk
28 include client/config.mk
29 include libcli/config.mk
30 include scripting/config.mk
31 include kdc/config.mk
32
33 binaries: $(BINARIES)
34 libraries: $(STATIC_LIBS) $(SHARED_LIBS)
35 headers: $(PUBLIC_HEADERS)
36 manpages: $(MANPAGES)
37 everything: all
38
39 showlayout: 
40         @echo "Samba will be installed into:"
41         @echo "  basedir: $(BASEDIR)"
42         @echo "  bindir:  $(BINDIR)"
43         @echo "  sbindir: $(SBINDIR)"
44         @echo "  libdir:  $(LIBDIR)"
45         @echo "  modulesdir:  $(MODULESDIR)"
46         @echo "  includedir:  $(INCLUDEDIR)"
47         @echo "  vardir:  $(VARDIR)"
48         @echo "  privatedir:  $(PRIVATEDIR)"
49         @echo "  piddir:   $(PIDDIR)"
50         @echo "  lockdir:  $(LOCKDIR)"
51         @echo "  logfilebase:  $(LOGFILEBASE)"
52         @echo "  swatdir:  $(SWATDIR)"
53         @echo "  mandir:   $(MANDIR)"
54
55 showflags:
56         @echo "Samba will be compiled with flags:"
57         @echo "  CFLAGS = $(CFLAGS)"
58         @echo "  LDFLAGS = $(LDFLAGS)"
59         @echo "  STLD_FLAGS = $(STLD_FLAGS)"
60         @echo "  SHLD_FLAGS = $(SHLD_FLAGS)"
61         @echo "  LIBS = $(LIBS)"
62
63 # The permissions to give the executables
64 INSTALLPERMS = 0755
65
66 # set these to where to find various files
67 # These can be overridden by command line switches (see smbd(8))
68 # or in smb.conf (see smb.conf(5))
69 CONFIGFILE = $(CONFIGDIR)/smb.conf
70 PKGCONFIGDIR = $(LIBDIR)/pkgconfig
71 LMHOSTSFILE = $(CONFIGDIR)/lmhosts
72
73 PATH_FLAGS = -DCONFIGFILE=\"$(CONFIGFILE)\"  -DSBINDIR=\"$(SBINDIR)\" \
74          -DBINDIR=\"$(BINDIR)\" -DLMHOSTSFILE=\"$(LMHOSTSFILE)\" \
75          -DLOCKDIR=\"$(LOCKDIR)\" -DPIDDIR=\"$(PIDDIR)\" -DLIBDIR=\"$(LIBDIR)\" \
76          -DLOGFILEBASE=\"$(LOGFILEBASE)\" -DSHLIBEXT=\"$(SHLIBEXT)\" \
77          -DCONFIGDIR=\"$(CONFIGDIR)\" -DNCALRPCDIR=\"$(NCALRPCDIR)\" \
78          -DSWATDIR=\"$(SWATDIR)\" -DPRIVATE_DIR=\"$(PRIVATEDIR)\" \
79          -DMODULESDIR=\"$(MODULESDIR)\"
80
81 install: showlayout installbin installdat installswat installmisc installlib \
82         installheader installpc
83
84 # DESTDIR is used here to prevent packagers wasting their time
85 # duplicating the Makefile. Remove it and you will have the privilege
86 # of packaging each samba release for multiple versions of multiple
87 # distributions and operating systems, or at least supplying patches
88 # to all the packaging files required for this, prior to committing
89 # the removal of DESTDIR. Do not remove it even though you think it
90 # is not used.
91
92 installdirs:
93         @$(SHELL) $(srcdir)/script/installdirs.sh \
94                 $(DESTDIR)$(BASEDIR) \
95                 $(DESTDIR)$(BINDIR) \
96                 $(DESTDIR)$(SBINDIR) \
97                 $(DESTDIR)$(LIBDIR) \
98                 $(DESTDIR)$(VARDIR) \
99                 $(DESTDIR)$(PRIVATEDIR) \
100                 $(DESTDIR)$(PIDDIR) \
101                 $(DESTDIR)$(LOCKDIR) \
102                 $(DESTDIR)$(LOGFILEBASE) \
103                 $(DESTDIR)$(PRIVATEDIR)/tls \
104                 $(DESTDIR)$(INCLUDEDIR) \
105                 $(DESTDIR)$(PKGCONFIGDIR)
106
107 installbin: $(SBIN_PROGS) $(BIN_PROGS) installdirs
108         @$(SHELL) $(srcdir)/script/installbin.sh \
109                 $(INSTALLPERMS) \
110                 $(DESTDIR)$(BASEDIR) \
111                 $(DESTDIR)$(SBINDIR) \
112                 $(DESTDIR)$(LIBDIR) \
113                 $(DESTDIR)$(VARDIR) \
114                 $(SBIN_PROGS)
115         @$(SHELL) $(srcdir)/script/installbin.sh \
116                 $(INSTALLPERMS) \
117                 $(DESTDIR)$(BASEDIR) \
118                 $(DESTDIR)$(BINDIR) \
119                 $(DESTDIR)$(LIBDIR) \
120                 $(DESTDIR)$(VARDIR) \
121                 $(BIN_PROGS)
122
123 installlib: libraries installdirs
124         @$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(LIBDIR) $(SHARED_LIBS) 
125         @$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(LIBDIR) $(STATIC_LIBS)
126
127 installheader: headers installdirs
128         @$(SHELL) $(srcdir)/script/installheader.sh $(DESTDIR)$(INCLUDEDIR) $(PUBLIC_HEADERS)
129
130 installdat: installdirs
131         @$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(LIBDIR) $(srcdir)
132
133 installswat: installdirs
134         @$(SHELL) $(srcdir)/script/installswat.sh $(DESTDIR)$(SWATDIR) $(srcdir) $(DESTDIR)$(LIBDIR)
135
136 installman: installdirs
137         @$(SHELL) $(srcdir)/script/installman.sh $(DESTDIR)$(MANDIR) $(MANPAGES)
138
139 installmisc: installdirs
140         @$(SHELL) $(srcdir)/script/installmisc.sh $(srcdir) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(BINDIR)
141
142 installpc: installdirs
143         @$(SHELL) $(srcdir)/script/installpc.sh $(srcdir) $(DESTDIR)$(PKGCONFIGDIR) $(PC_FILES)
144
145 uninstall: uninstallbin uninstallman uninstallmisc uninstalllib uninstallheader
146
147 uninstallmisc:
148         #FIXME
149
150 uninstallbin:
151         @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(SBIN_PROGS)
152         @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(BIN_PROGS)
153
154 uninstalllib:
155         @$(SHELL) $(srcdir)/script/uninstalllib.sh $(DESTDIR)$(LIBDIR) $(SHARED_LIBS)
156         @$(SHELL) $(srcdir)/script/uninstalllib.sh $(DESTDIR)$(LIBDIR) $(STATIC_LIBS) 
157
158 uninstallheader:
159         @$(SHELL) $(srcdir)/script/uninstallheader.sh $(DESTDIR)$(INCLUDEDIR) $(PUBLIC_HEADERS)
160
161 uninstallman:
162         @$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(MANDIR) $(MANPAGES)
163
164 Makefile: config.status $(MK_FILES)
165         ./config.status
166
167 etags:
168         etags `find $(srcdir) -name "*.[ch]"`
169
170 ctags:
171         ctags `find $(srcdir) -name "*.[ch]"`
172
173 pidl/Makefile: pidl/Makefile.PL
174         cd pidl && $(PERL) Makefile.PL
175
176 installpidl: pidl/Makefile
177         cd pidl && $(MAKE) install
178
179 idl_full: pidl/lib/Parse/Pidl/IDL.pm
180         @CPP="$(CPP)" PERL="$(PERL)" script/build_idl.sh FULL $(PIDL_ARGS)
181
182 idl: pidl/lib/Parse/Pidl/IDL.pm
183         @CPP="$(CPP)" PERL="$(PERL)" script/build_idl.sh PARTIAL $(PIDL_ARGS)
184
185 pidl/lib/Parse/Pidl/IDL.pm: pidl/idl.yp
186         -$(YAPP) -s -m 'Parse::Pidl::IDL' -o pidl/lib/Parse/Pidl/IDL.pm pidl/idl.yp 
187
188 smb_interfaces: pidl/smb_interfaces.pm
189         $(PERL) -Ipidl script/build_smb_interfaces.pl \
190                 include/smb_interfaces.h
191
192 pidl/smb_interfaces.pm: pidl/smb_interfaces.yp
193         -$(YAPP) -s -m 'smb_interfaces' -o pidl/smb_interfaces.pm pidl/smb_interfaces.yp 
194
195 include/config.h:
196         @echo "include/config.h not present"
197         @echo "You need to rerun ./autogen.sh and ./configure"
198         @/bin/false
199
200 include/proto.h: $(PROTO_OBJS:.o=.c)
201         @echo "Creating include/proto.h"
202         @$(PERL) script/mkproto.pl --public-define=_PROTO_H_ \
203                 --public=include/proto.h --private=include/proto.h \
204                 $(PROTO_OBJS)
205
206 proto: include/proto.h
207
208 pch: clean_pch include/config.h \
209         include/proto.h \
210         idl \
211         include/includes.h.gch
212
213 libcli/nbt/libnbt.h: libcli/nbt/nbt_proto.h
214 include/includes.h: lib/basic.h libcli/nbt/libnbt.h librpc/ndr/libndr_proto.h librpc/rpc/dcerpc_proto.h auth/credentials/credentials_proto.h
215
216 clean_pch: 
217         -rm -f include/includes.h.gch
218
219 basics: include/config.h \
220         include/proto.h \
221         $(PROTO_HEADERS) \
222         idl \
223         heimdal_basics
224
225 clean: heimdal_clean
226         @echo Removing headers
227         @-rm -f include/proto.h
228         @echo Removing objects
229         @-find . -name '*.o' -exec rm -f '{}' \;
230         @echo Removing hostcc objects
231         @-find . -name '*.ho' -exec rm -f '{}' \;
232         @echo Removing binaries
233         @-rm -f $(BIN_PROGS) $(SBIN_PROGS)
234         @echo Removing libraries
235         @-rm -f bin/*.$(SHLIBEXT).*
236         @echo Removing dummy targets
237         @-rm -f bin/.*_*
238         @echo Removing generated files
239         @-rm -rf librpc/gen_* 
240         @-rm -f lib/registry/regf.h lib/registry/tdr_regf*
241         @echo Removing proto headers
242         @-rm -f $(PROTO_HEADERS)
243
244 distclean: clean
245         -rm -f bin/.dummy 
246         -rm -f include/config.h include/smb_build.h
247         -rm -f Makefile 
248         -rm -f config.status
249         -rm -f config.log config.cache
250         -rm -f samba4-deps.dot
251         -rm -f config.pm config.mk
252
253 removebackup:
254         -rm -f *.bak *~ */*.bak */*~ */*/*.bak */*/*~ */*/*/*.bak */*/*/*~
255
256 realdistclean: distclean removebackup
257         -rm -f include/config.h.in
258         -rm -f include/version.h
259         -rm -f configure
260         -rm -f $(MANPAGES)
261
262 test: $(DEFAULT_TEST_TARGET)
263
264 test-swrap: all
265         ./script/tests/selftest.sh ${selftest_prefix}/st all SOCKET_WRAPPER
266
267 test-noswrap: all
268         ./script/tests/selftest.sh ${selftest_prefix}/st all
269
270 quicktest: all
271         ./script/tests/selftest.sh ${selftest_prefix}/st quick SOCKET_WRAPPER
272
273 valgrindtest: all
274         SMBD_VALGRIND="xterm -n smbd -e valgrind -q --db-attach=yes --num-callers=30" \
275         VALGRIND="valgrind -q --num-callers=30 --log-file=st/valgrind.log" \
276         ./script/tests/selftest.sh ${selftest_prefix}/st quick SOCKET_WRAPPER
277
278 gdbtest: all
279         SMBD_VALGRIND="xterm -n smbd -e gdb --args " \
280         ./script/tests/selftest.sh ${selftest_prefix}/st quick SOCKET_WRAPPER
281
282 bin/.dummy:
283         @: >> $@ || : > $@
284
285 ###############################################################################
286 # File types
287 ###############################################################################
288
289 .c.d:
290         @echo "Generating dependencies for $<"
291         @$(CC) -MM -MG -MT $(<:.c=.o) -MF $@ $(CFLAGS) $<
292
293 .y.c:
294         @echo "Building $< with $(YACC)"
295         @-$(srcdir)/script/yacc_compile.sh "$(YACC)" "$<" "$@"
296
297 .l.c:
298         @echo "Building $< with $(LEX)"
299         @-$(srcdir)/script/lex_compile.sh "$(LEX)" "$<" "$@"
300
301 DOCBOOK_MANPAGE_URL = http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
302
303 .1.xml.1:
304         $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
305
306 .3.xml.3:
307         $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
308
309 .5.xml.5:
310         $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
311
312 .7.xml.7:
313         $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<