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