r25996: build: rename LD -> BNLD and LDFLAGS -> BNLD_FLAGS
[sfrench/samba-autobuild/.git] / source4 / main.mk
1 default: all
2
3 include dynconfig.mk
4 include heimdal_build/config.mk
5 include config.mk
6 include dsdb/config.mk
7 include smbd/config.mk
8 include cluster/config.mk
9 include smbd/process_model.mk
10 include libnet/config.mk
11 include auth/config.mk
12 include nsswitch/config.mk
13 include lib/basic.mk
14 include param/config.mk
15 include smb_server/config.mk
16 include rpc_server/config.mk
17 include ldap_server/config.mk
18 include web_server/config.mk
19 include winbind/config.mk
20 include nbt_server/config.mk
21 include wrepl_server/config.mk
22 include cldap_server/config.mk
23 include utils/net/config.mk
24 include utils/config.mk
25 include ntvfs/config.mk
26 include ntptr/config.mk
27 include torture/config.mk
28 include librpc/config.mk
29 include client/config.mk
30 include libcli/config.mk
31 include scripting/ejs/config.mk
32 include scripting/swig/config.mk
33 include kdc/config.mk
34
35 DEFAULT_HEADERS = $(srcdir)/lib/util/dlinklist.h \
36                   $(srcdir)/version.h
37
38 binaries: $(BINARIES)
39 libraries: $(STATIC_LIBS) $(SHARED_LIBS)
40 modules: $(SHARED_MODULES)
41 headers: $(PUBLIC_HEADERS) $(DEFAULT_HEADERS)
42 manpages: $(MANPAGES)
43 all: showflags $(ALL_PREDEP) bin/asn1_compile bin/compile_et binaries modules
44 everything: all libraries headers
45
46 # 'make testsuite' creates all binaries which are
47 # needed by samba3's 'make test' and the build-farm
48 # scripts use that it as fallback in case
49 # 'make everything' fails
50 testsuite: bin/smbclient bin/cifsdd bin/smbtorture bin/nmblookup
51
52 showlayout: 
53         @echo 'Samba will be installed into:'
54         @echo '  basedir:     $(BASEDIR)'
55         @echo '  bindir:      $(BINDIR)'
56         @echo '  sbindir:     $(SBINDIR)'
57         @echo '  libdir:      $(LIBDIR)'
58         @echo '  modulesdir:  $(MODULESDIR)'
59         @echo '  includedir:  $(INCLUDEDIR)'
60         @echo '  vardir:      $(VARDIR)'
61         @echo '  privatedir:  $(PRIVATEDIR)'
62         @echo '  piddir:      $(PIDDIR)'
63         @echo '  lockdir:     $(LOCKDIR)'
64         @echo '  logfilebase: $(LOGFILEBASE)'
65         @echo '  setupdir:    $(SETUPDIR)'
66         @echo '  jsdir:       $(JSDIR)'
67         @echo '  swatdir:     $(SWATDIR)'
68         @echo '  mandir:      $(MANDIR)'
69         @echo '  torturedir:  $(TORTUREDIR)'
70         @echo '  datadir:     $(DATADIR)'
71         @echo '  winbindd_socket_dir:  $(WINBINDD_SOCKET_DIR)'
72
73 showflags:
74         @echo 'Samba will be compiled with flags:'
75         @echo '  CPP        = $(CPP)'
76         @echo '  CPPFLAGS   = $(CPPFLAGS)'
77         @echo '  CC         = $(CC)'
78         @echo '  CFLAGS     = $(CFLAGS)'
79         @echo '  PICFLAG    = $(PICFLAG)'
80         @echo '  BNLD       = $(BNLD)'
81         @echo '  BNLD_FLAGS = $(BNLD_FLAGS)'
82         @echo '  STLD       = $(STLD)'
83         @echo '  STLD_FLAGS = $(STLD_FLAGS)'
84         @echo '  SHLD       = $(SHLD)'
85         @echo '  SHLD_FLAGS = $(SHLD_FLAGS)'
86         @echo '  MDLD       = $(MDLD)'
87         @echo '  MDLD_FLAGS = $(MDLD_FLAGS)'
88         @echo '  SHLIBEXT   = $(SHLIBEXT)'
89         @echo '  srcdir     = $(srcdir)'
90         @echo '  builddir   = $(builddir)'
91         @echo '  pwd        = '`/bin/pwd`
92
93 # The permissions to give the executables
94 INSTALLPERMS = 0755
95
96 install: showlayout everything installbin installdat installswat installmisc installlib \
97         installheader installpc installplugins
98
99 # DESTDIR is used here to prevent packagers wasting their time
100 # duplicating the Makefile. Remove it and you will have the privilege
101 # of packaging each samba release for multiple versions of multiple
102 # distributions and operating systems, or at least supplying patches
103 # to all the packaging files required for this, prior to committing
104 # the removal of DESTDIR. Do not remove it even though you think it
105 # is not used.
106
107 installdirs:
108         @$(SHELL) $(srcdir)/script/installdirs.sh \
109                 $(DESTDIR)$(BASEDIR) \
110                 $(DESTDIR)$(BINDIR) \
111                 $(DESTDIR)$(SBINDIR) \
112                 $(DESTDIR)$(TORTUREDIR) \
113                 $(DESTDIR)$(LIBDIR) \
114                 $(DESTDIR)$(MODULESDIR) \
115                 $(DESTDIR)$(MANDIR) \
116                 $(DESTDIR)$(VARDIR) \
117                 $(DESTDIR)$(PRIVATEDIR) \
118                 $(DESTDIR)$(DATADIR) \
119                 $(DESTDIR)$(PIDDIR) \
120                 $(DESTDIR)$(LOCKDIR) \
121                 $(DESTDIR)$(LOGFILEBASE) \
122                 $(DESTDIR)$(PRIVATEDIR)/tls \
123                 $(DESTDIR)$(INCLUDEDIR) \
124                 $(DESTDIR)$(PKGCONFIGDIR) \
125                 $(DESTDIR)$(CONFIGDIR) \
126
127 installbin: $(SBIN_PROGS) $(BIN_PROGS) $(TORTURE_PROGS) installdirs
128         @$(SHELL) $(srcdir)/script/installbin.sh \
129                 $(INSTALLPERMS) \
130                 $(DESTDIR)$(BASEDIR) \
131                 $(DESTDIR)$(SBINDIR) \
132                 $(DESTDIR)$(LIBDIR) \
133                 $(DESTDIR)$(VARDIR) \
134                 $(SBIN_PROGS)
135         @$(SHELL) $(srcdir)/script/installbin.sh \
136                 $(INSTALLPERMS) \
137                 $(DESTDIR)$(BASEDIR) \
138                 $(DESTDIR)$(BINDIR) \
139                 $(DESTDIR)$(LIBDIR) \
140                 $(DESTDIR)$(VARDIR) \
141                 $(BIN_PROGS)
142         @$(SHELL) $(srcdir)/script/installtorture.sh \
143                 $(INSTALLPERMS) \
144                 $(DESTDIR)$(TORTUREDIR) \
145                 $(TORTURE_PROGS)
146
147 installlib: $(INSTALLABLE_SHARED_LIBS) $(STATIC_LIBS) installdirs
148         @$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(LIBDIR) "$(SHLIBEXT)" $(INSTALLABLE_SHARED_LIBS) 
149         #@$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(LIBDIR) "$(STLIBEXT)" $(STATIC_LIBS)
150
151 installheader: headers installdirs
152         @srcdir=$(srcdir) builddir=$(builddir) $(PERL) $(srcdir)/script/installheader.pl $(DESTDIR)$(INCLUDEDIR) $(PUBLIC_HEADERS) $(DEFAULT_HEADERS)
153
154 installdat: installdirs
155         @$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(DATADIR) $(srcdir)
156
157 installswat: installdirs
158         @$(SHELL) $(srcdir)/script/installswat.sh $(DESTDIR)$(SWATDIR) $(srcdir)
159
160 installman: manpages installdirs
161         @$(SHELL) $(srcdir)/script/installman.sh $(DESTDIR)$(MANDIR) $(MANPAGES)
162
163 installmisc: installdirs
164         @$(SHELL) $(srcdir)/script/installmisc.sh $(srcdir) $(DESTDIR)$(JSDIR) $(DESTDIR)$(SETUPDIR) $(DESTDIR)$(BINDIR)
165
166 installpc: installdirs
167         @$(SHELL) $(srcdir)/script/installpc.sh $(builddir) $(DESTDIR)$(PKGCONFIGDIR) $(PC_FILES)
168
169 uninstall: uninstallbin uninstallman uninstallmisc uninstalllib uninstallheader \
170         uninstallplugins
171
172 uninstallmisc:
173         #FIXME
174
175 uninstallbin:
176         @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(SBIN_PROGS)
177         @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(BIN_PROGS)
178         @$(SHELL) $(srcdir)/script/uninstalltorture.sh $(DESTDIR)$(TORTUREDIR) $(TORTURE_PROGS)
179
180 uninstalllib:
181         @$(SHELL) $(srcdir)/script/uninstalllib.sh $(DESTDIR)$(LIBDIR) $(SHARED_LIBS)
182         #@$(SHELL) $(srcdir)/script/uninstalllib.sh $(DESTDIR)$(LIBDIR) $(STATIC_LIBS) 
183
184 uninstallheader:
185         @$(SHELL) $(srcdir)/script/uninstallheader.sh $(DESTDIR)$(INCLUDEDIR) $(PUBLIC_HEADERS)
186
187 uninstallman:
188         @$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(MANDIR) $(MANPAGES)
189
190 Makefile: config.status $(MK_FILES)
191         ./config.status
192
193 etags:
194         etags `find $(srcdir) -name "*.[ch]"`
195
196 ctags:
197         ctags `find $(srcdir) -name "*.[ch]"`
198
199 pidl/Makefile: pidl/Makefile.PL
200         cd pidl && $(PERL) Makefile.PL 
201
202 testcov-html:: pidl-testcov
203
204 pidl-testcov: pidl/Makefile
205         cd pidl && cover -test
206
207 installpidl: pidl/Makefile
208         $(MAKE) -C pidl install
209
210 uninstallpidl: pidl/Makefile
211         $(MAKE) -C pidl uninstall
212
213 $(IDL_HEADER_FILES) \
214         $(IDL_NDR_PARSE_H_FILES) $(IDL_NDR_PARSE_C_FILES) \
215         $(IDL_NDR_CLIENT_C_FILES) $(IDL_NDR_CLIENT_H_FILES) \
216         $(IDL_NDR_SERVER_C_FILES) $(IDL_SWIG_FILES) \
217         $(IDL_NDR_EJS_C_FILES) $(IDL_NDR_EJS_H_FILES): idl
218
219 idl_full: pidl/lib/Parse/Pidl/IDL.pm pidl/lib/Parse/Pidl/Expr.pm 
220         @CPP="$(CPP)" PERL="$(PERL)" srcdir=$(srcdir) $(srcdir)/script/build_idl.sh FULL
221
222 idl: pidl/lib/Parse/Pidl/IDL.pm pidl/lib/Parse/Pidl/Expr.pm 
223         @CPP="$(CPP)" PERL="$(PERL)" srcdir=$(srcdir) $(srcdir)/script/build_idl.sh PARTIAL 
224
225 pidl/lib/Parse/Pidl/IDL.pm: pidl/idl.yp
226         -$(YAPP) -m 'Parse::Pidl::IDL' -o pidl/lib/Parse/Pidl/IDL.pm pidl/idl.yp ||\
227                 touch pidl/lib/Parse/Pidl/IDL.pm 
228
229 pidl/lib/Parse/Pidl/Expr.pm: pidl/idl.yp
230         -$(YAPP) -m 'Parse::Pidl::Expr' -o pidl/lib/Parse/Pidl/Expr.pm pidl/expr.yp ||\
231                 touch pidl/lib/Parse/Pidl/Expr.pm 
232
233 include/config.h:
234         @echo "include/config.h not present"
235         @echo "You need to rerun ./autogen.sh and ./configure"
236         @/bin/false
237
238 $(srcdir)/version.h: $(srcdir)/VERSION
239         @$(SHELL) script/mkversion.sh VERSION $(srcdir)/version.h $(srcdir)/
240
241 regen_version:
242         @$(SHELL) script/mkversion.sh VERSION $(srcdir)/version.h $(srcdir)/
243
244 clean_pch:
245         @echo "Removing precompiled headers"
246         @-rm -f include/includes.h.gch
247
248 pch: clean_pch include/includes.h.gch
249
250 clean:: clean_pch
251         @echo Removing objects
252         @-find . -name '*.o' -exec rm -f '{}' \;
253         @echo Removing hostcc objects
254         @-find . -name '*.ho' -exec rm -f '{}' \;
255         @echo Removing binaries
256         @-rm -f $(BIN_PROGS) $(SBIN_PROGS) $(BINARIES) $(TORTURE_PROGS)
257         @echo Removing libraries
258         @-rm -f $(STATIC_LIBRARIES) $(SHARED_LIBRARIES)
259         @-rm -f bin/static/*.a bin/shared/*.$(SHLIBEXT)
260         @echo Removing modules
261         @-rm -f bin/modules/*/*.$(SHLIBEXT)
262         @-rm -f bin/*_init_module.c
263         @echo Removing dummy targets
264         @-rm -f bin/.*_*
265         @echo Removing generated files
266         @-rm -f bin/*_init_module.c
267         @-rm -rf librpc/gen_* 
268         @echo Removing proto headers
269         @-rm -f $(PROTO_HEADERS)
270
271 distclean: clean
272         -rm -f include/config.h include/config_tmp.h include/build.h
273         -rm -f Makefile 
274         -rm -f config.status
275         -rm -f config.log config.cache
276         -rm -f config.pm config.mk
277         -rm -f $(PC_FILES)
278
279 removebackup:
280         -rm -f *.bak *~ */*.bak */*~ */*/*.bak */*/*~ */*/*/*.bak */*/*/*~
281
282 realdistclean: distclean removebackup
283         -rm -f include/config_tmp.h.in
284         -rm -f version.h
285         -rm -f configure
286         -rm -f $(MANPAGES)
287
288 check:: test
289
290 include selftest/config.mk
291
292 unused_macros:
293         $(srcdir)/script/find_unused_macros.pl `find . -name "*.[ch]"` | sort
294
295 ###############################################################################
296 # File types
297 ###############################################################################
298
299 .SUFFIXES: .x .c .et .y .l .d .o .h .h.gch .a .$(SHLIBEXT) .1 .1.xml .3 .3.xml .5 .5.xml .7 .7.xml .8 .8.xml .ho .idl .hd
300
301 .c.d:
302         @echo "Generating dependencies for $<"
303         @$(DEPENDS)
304
305 .c.hd:
306         @echo "Generating host-compiler dependencies for $<"
307         @$(HDEPENDS)
308
309 include/includes.d: include/includes.h
310         @echo "Generating dependencies for $<"
311         @$(PCHDEPENDS)
312
313 .c.o:
314         @if test -n "$(CC_CHECKER)"; then \
315                 echo "Checking  $< with '$(CC_CHECKER)'"; \
316                 $(CHECK) ; \
317         fi
318         @echo "Compiling $<"
319         @-mkdir -p `dirname $@`
320         @$(COMPILE) && exit 0 ; \
321                 echo "The following command failed:" 1>&2;\
322                 echo "$(COMPILE)" 1>&2;\
323                 $(COMPILE) >/dev/null 2>&1
324
325 .c.ho:
326         @echo "Compiling $< with host compiler"
327         @-mkdir -p `dirname $@`
328         @$(HCOMPILE) && exit 0;\
329                 echo "The following command failed:" 1>&2;\
330                 echo "$(HCOMPILE)" 1>&2;\
331                 $(HCOMPILE) >/dev/null 2>&1
332
333 .h.h.gch:
334         @echo "Precompiling $<"
335         @$(PCHCOMPILE)
336
337 .y.c:
338         @echo "Building $< with $(YACC)"
339         @-$(srcdir)/script/yacc_compile.sh "$(YACC)" "$<" "$@"
340
341 .l.c:
342         @echo "Building $< with $(LEX)"
343         @-$(srcdir)/script/lex_compile.sh "$(LEX)" "$<" "$@"
344
345 DOCBOOK_MANPAGE_URL = http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
346
347 .1.xml.1:
348         $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
349
350 .3.xml.3:
351         $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
352
353 .5.xml.5:
354         $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
355
356 .7.xml.7:
357         $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
358
359 .8.xml.8:
360         $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
361
362 DEP_FILES = $(patsubst %.ho,%.hd,$(patsubst %.o,%.d,$(ALL_OBJS))) \
363                    include/includes.d
364
365 dist:: idl_full manpages configure distclean 
366
367 configure: 
368         ./autogen.sh