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