r11306: Move more static Makefile data to main.mk
[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 idl_full: pidl/lib/Parse/Pidl/IDL.pm
143         @CPP="$(CPP)" PERL="$(PERL)" script/build_idl.sh FULL $(PIDL_ARGS)
144
145 idl: pidl/lib/Parse/Pidl/IDL.pm
146         @CPP="$(CPP)" PERL="$(PERL)" script/build_idl.sh PARTIAL $(PIDL_ARGS)
147
148 pidl/lib/Parse/Pidl/IDL.pm: pidl/idl.yp
149         -$(YAPP) -s -m 'Parse::Pidl::IDL' -o pidl/lib/Parse/Pidl/IDL.pm pidl/idl.yp 
150
151 smb_interfaces: pidl/smb_interfaces.pm
152         $(PERL) -Ipidl script/build_smb_interfaces.pl \
153                 include/smb_interfaces.h
154
155 pidl/smb_interfaces.pm: pidl/smb_interfaces.yp
156         -$(YAPP) -s -m 'smb_interfaces' -o pidl/smb_interfaces.pm pidl/smb_interfaces.yp 
157
158 include/config.h:
159         @echo "include/config.h not present"
160         @echo "You need to rerun ./autogen.sh and ./configure"
161         @/bin/false
162
163 include/proto.h: $(PROTO_PROTO_OBJS:.o=.c)
164         @-rm -f include/includes.h.gch
165         @$(SHELL) script/mkproto.sh "$(PERL)" \
166           -h _PROTO_H_ include/proto.h \
167           $(PROTO_PROTO_OBJS)
168         @touch include/proto.h
169
170 proto: include/proto.h
171 pch: include/config.h \
172         include/proto.h \
173         idl \
174         include/includes.h.gch
175
176 basics: include/config.h \
177         include/proto.h \
178         idl \
179         heimdal_basics
180
181 clean: heimdal_clean
182         @echo Removing headers
183         @-rm -f include/proto.h
184         @echo Removing objects
185         @-find . -name '*.o' -exec rm -f '{}' \;
186         @echo Removing binaries
187         @-rm -f $(BIN_PROGS) $(SBIN_PROGS)
188         @echo Removing dummy targets
189         @-rm -f bin/.*_*
190         @echo Removing generated files
191         @-rm -rf librpc/gen_* 
192         @-rm -f lib/registry/regf.h lib/registry/tdr_regf*
193
194 distclean: clean
195         -rm -f bin/.dummy
196         -rm -f include/config.h include/smb_build.h
197         -rm -f Makefile 
198         -rm -f config.status
199         -rm -f config.log config.cache
200         -rm -f samba4-deps.dot
201         -rm -f config.pm config.mk
202         -rm -f lib/registry/winregistry.pc
203
204 removebackup:
205         -rm -f *.bak *~ */*.bak */*~ */*/*.bak */*/*~ */*/*/*.bak */*/*/*~
206
207 realdistclean: distclean removebackup
208         -rm -f include/config.h.in
209         -rm -f include/version.h
210         -rm -f configure
211         -rm -f $(MANPAGES)
212
213 test: $(DEFAULT_TEST_TARGET)
214
215 test-swrap: all
216         ./script/tests/selftest.sh ${selftest_prefix}/st all SOCKET_WRAPPER
217
218 test-noswrap: all
219         ./script/tests/selftest.sh ${selftest_prefix}/st all
220
221 quicktest: all
222         ./script/tests/selftest.sh ${selftest_prefix}/st quick SOCKET_WRAPPER
223
224 valgrindtest: all
225         SMBD_VALGRIND="xterm -n smbd -e valgrind -q --db-attach=yes --num-callers=30" \
226         ./script/tests/selftest.sh ${selftest_prefix}/st quick SOCKET_WRAPPER
227
228 bin/.dummy:
229         @: >> $@ || : > $@
230
231 ###############################################################################
232 # File types
233 ###############################################################################
234
235 .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
236
237 .c.d:
238         @echo "Generating dependencies for $<"
239         @$(CC) -MM -MG -MT $(<:.c=.o) -MF $@ $(CFLAGS) $<
240
241 .y.c:
242         @echo "Building $< with $(YACC)"
243         @-$(srcdir)/script/yacc_compile.sh "$(YACC)" "$<" "$@"
244
245 .l.c:
246         @echo "Building $< with $(LEX)"
247         @-$(srcdir)/script/lex_compile.sh "$(LEX)" "$<" "$@"
248
249 DOCBOOK_MANPAGE_URL = http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
250
251 .1.xml.1:
252         $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
253
254 .3.xml.3:
255         $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
256
257 .5.xml.5:
258         $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
259
260 .7.xml.7:
261         $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<