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