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