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