s4-server: pre-open the main ldb databases in the server
[kai/samba.git] / source4 / Makefile
1 #!gmake
2 # The Samba 4 Makefile.
3 # This file is *NOT* autogenerated.
4 #
5 .DEFAULT_GOAL := all
6
7 default: all
8
9 include mkconfig.mk
10
11 pidldir := $(srcdir)/../pidl
12
13 basedir = $(prefix)
14 torturedir = ../lib/torture
15 swatdir = $(datadir)/swat
16 setupdir = $(datadir)/setup
17 ncalrpcdir = $(localstatedir)/ncalrpc
18 shliboutputdir = $(builddir)/bin/shared
19
20 BNLD = $(LD)
21 BNLD_FLAGS = $(LDFLAGS) $(SYS_LDFLAGS)
22
23 HOSTCC_FLAGS = -D_SAMBA_HOSTCC_ $(CFLAGS)
24 HOSTLD_FLAGS = $(LDFLAGS) $(SYS_LDFLAGS)
25
26 $(srcdir)/version.h: $(srcdir)/VERSION
27         @$(SHELL) script/mkversion.sh VERSION $(srcdir)/version.h $(srcdir)/
28
29 ifneq ($(automatic_dependencies),yes)
30 ALL_PREDEP = basics
31 .NOTPARALLEL:
32 endif
33
34 regen_version::
35         @$(SHELL) script/mkversion.sh VERSION $(srcdir)/version.h $(srcdir)/
36
37 clean_pch::
38         @echo "Removing precompiled headers"
39         @-rm -f include/includes.h.gch
40
41 pch:: clean_pch include/includes.h.gch
42
43 .DEFAULT_GOAL := all
44
45 ifneq ($(automatic_dependencies),yes)
46 ALL_PREDEP = basics
47 .NOTPARALLEL:
48 endif
49
50 base_srcdirs = $(srcdir) ../librpc/ ../lib/ ../libcli ../libgpo ../nsswitch ../libds
51
52 include $(srcdir)/build/make/rules.mk
53 include $(srcdir)/build/make/python.mk
54 zlibsrcdir := ../lib/zlib
55 dynconfigsrcdir := dynconfig
56 heimdalsrcdir := heimdal
57 dsdbsrcdir := dsdb
58 smbdsrcdir := smbd
59 clustersrcdir := cluster
60 libnetsrcdir := libnet
61 authsrcdir := auth
62 nsswitchsrcdir := ../nsswitch
63 libwbclientsrcdir := ../nsswitch/libwbclient
64 libsrcdir := lib
65 libsocketsrcdir := lib/socket
66 libcharsetsrcdir := ../lib/util/charset
67 ldb_sambasrcdir := lib/ldb-samba
68 tdbsrcdir := ../lib/tdb
69 ldbsrcdir := lib/ldb
70 libtlssrcdir := lib/tls
71 libregistrysrcdir := lib/registry
72 smbreadlinesrcdir := lib/smbreadline
73 libmessagingsrcdir := lib/messaging
74 libteventsrcdir := ../lib/tevent
75 libeventssrcdir := lib/events
76 libcmdlinesrcdir := lib/cmdline
77 poptsrcdir := ../lib/popt
78 socketwrappersrcdir := ../lib/socket_wrapper
79 nsswrappersrcdir := ../lib/nss_wrapper
80 uidwrappersrcdir := ../lib/uid_wrapper
81 appwebsrcdir := lib/appweb
82 libstreamsrcdir := lib/stream
83 libutilsrcdir := ../lib/util
84 libtdrsrcdir := ../lib/tdr
85 libcryptosrcdir := ../lib/crypto
86 libtorturesrcdir := ../lib/torture
87 smb_serversrcdir := smb_server
88 libcompressionsrcdir := ../lib/compression
89 libgencachesrcdir := lib
90 paramsrcdir := param
91 rpc_serversrcdir := rpc_server
92 ldap_serversrcdir := ldap_server
93 web_serversrcdir := web_server
94 winbindsrcdir := winbind
95 nbt_serversrcdir := nbt_server
96 wrepl_serversrcdir := wrepl_server
97 cldap_serversrcdir := cldap_server
98 utilssrcdir := utils
99 clientsrcdir := client
100 torturesrcdir := torture
101 ntvfssrcdir := ntvfs
102 ntptrsrcdir := ntptr
103 librpcsrcdir := librpc
104 libclisrcdir := libcli
105 libclicommonsrcdir := ../libcli
106 libclinbtsrcdir := ../libcli/nbt
107 pyscriptsrcdir := $(srcdir)/scripting/python
108 kdcsrcdir := kdc
109 ntp_signdsrcdir := ntp_signd
110 wmisrcdir := lib/wmi
111 tallocsrcdir := ../lib/talloc
112 comsrcdir := $(srcdir)/lib/com
113 libgpodir := libgpo
114
115 include data.mk
116
117 INSTALL_SCRIPTS = $(addprefix scripting/bin/, \
118         autoidl \
119         samba3dump \
120         rpcclient \
121         smbstatus)
122
123 $(foreach SCRIPT,$(INSTALL_SCRIPTS),$(eval $(call binary_install_template,$(SCRIPT))))
124
125 $(DESTDIR)$(bindir)/%: scripting/bin/% installdirs
126         @mkdir -p $(@D)
127         @echo Installing $(@F) as $@
128         @if test -f $@; then echo -n ""; rm -f $@.old; mv $@ $@.old; fi
129         @cp $< $@
130         @chmod $(INSTALLPERMS) $@
131
132 pythonmods:: $(PYTHON_PYS) $(PYTHON_SO)
133
134 DEP_FILES = $(patsubst %.ho,%.hd,$(patsubst %.o,%.d,$(ALL_OBJS))) \
135                    include/includes.d
136
137 ifeq ($(automatic_dependencies),yes)
138 ifneq ($(MAKECMDGOALS),clean)
139 ifneq ($(MAKECMDGOALS),distclean)
140 ifneq ($(MAKECMDGOALS),realdistclean)
141 ifneq ($(SKIP_DEP_FILES),yes)
142 -include $(DEP_FILES)
143 endif
144 endif
145 endif
146 endif
147
148 ifneq ($(SKIP_DEP_FILES),yes)
149 clean::
150         @echo Removing dependency files
151         @find . -name '*.d' -o -name '*.hd' | xargs rm -f
152 endif
153 else
154 include $(srcdir)/static_deps.mk
155 endif
156
157 clean::
158         @find $(base_srcdirs) -name '*.o' -o -name '*.ho' | xargs rm -f
159
160 PUBLIC_HEADERS += ./version.h
161
162 libraries:: $(STATIC_LIBS) $(SHARED_LIBS)
163 modules:: $(PLUGINS)
164 headers:: $(PUBLIC_HEADERS)
165 manpages:: $(MANPAGES)
166 all:: showflags $(ALL_PREDEP) binaries modules pythonmods libraries headers
167 everything:: all
168
169 LD_LIBPATH_OVERRIDE = $(LIB_PATH_VAR)=$(shliboutputdir):$$$(LIB_PATH_VAR)
170
171 # 'make testsuite' creates all binaries which are
172 # needed by samba3's 'make test' and the build-farm
173 # scripts use that it as fallback in case
174 # 'make everything' fails
175 testsuite:: bin/smbclient bin/cifsdd bin/smbtorture bin/nmblookup
176
177 showlayout:: 
178         @echo 'Samba will be installed into:'
179         @echo '  basedir:     $(basedir)'
180         @echo '  bindir:      $(bindir)'
181         @echo '  sbindir:     $(sbindir)'
182         @echo '  libdir:      $(libdir)'
183         @echo '  modulesdir:  $(modulesdir)'
184         @echo '  includedir:  $(includedir)'
185         @echo '  vardir:      $(localstatedir)'
186         @echo '  privatedir:  $(privatedir)'
187         @echo '  piddir:      $(piddir)'
188         @echo '  lockdir:     $(lockdir)'
189         @echo '  logfilebase: $(logfilebase)'
190         @echo '  setupdir:    $(setupdir)'
191         @echo '  swatdir:     $(swatdir)'
192         @echo '  mandir:      $(mandir)'
193         @echo '  torturedir:  $(torturedir)'
194         @echo '  datadir:     $(datadir)'
195         @echo '  winbindd_socket_dir:  $(winbindd_socket_dir)'
196         @echo '  ntp_signd_socket_dir:  $(ntp_signd_socket_dir)'
197
198 showflags::
199         @echo '  srcdir     = $(srcdir)'
200         @echo '  builddir   = $(builddir)'
201
202 # The permissions to give the executables
203 INSTALLPERMS = 0755
204
205 install:: showlayout everything installbin installsbin installdat installmisc \
206               installlib installheader installpc installplugins
207
208 # DESTDIR is used here to prevent packagers wasting their time
209 # duplicating the Makefile. Remove it and you will have the privilege
210 # of packaging each samba release for multiple versions of multiple
211 # distributions and operating systems, or at least supplying patches
212 # to all the packaging files required for this, prior to committing
213 # the removal of DESTDIR. Do not remove it even though you think it
214 # is not used.
215
216 installdirs::
217         @$(SHELL) $(srcdir)/script/installdirs.sh \
218                 $(DESTDIR)$(basedir) \
219                 $(DESTDIR)$(bindir) \
220                 $(DESTDIR)$(sbindir) \
221                 $(DESTDIR)$(torturedir) \
222                 $(DESTDIR)$(libdir) \
223                 $(DESTDIR)$(modulesdir) \
224                 $(DESTDIR)$(mandir) \
225                 $(DESTDIR)$(localstatedir) \
226                 $(DESTDIR)$(localstatedir)/lib \
227                 $(DESTDIR)$(localstatedir)/run \
228                 $(DESTDIR)$(privatedir) \
229                 $(DESTDIR)$(datadir) \
230                 $(DESTDIR)$(piddir) \
231                 $(DESTDIR)$(lockdir) \
232                 $(DESTDIR)$(logfilebase) \
233                 $(DESTDIR)$(privatedir)/tls \
234                 $(DESTDIR)$(includedir) \
235                 $(DESTDIR)$(pkgconfigdir) \
236                 $(DESTDIR)$(sysconfdir)
237
238 installbin:: installdirs
239
240 installplugins::
241
242 installlib:: $(SHARED_LIBS) $(STATIC_LIBS) installdirs
243         @$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(libdir) "$(SHLIBEXT)" $(SHARED_LIBS) 
244         #@$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(libdir) "$(STLIBEXT)" $(STATIC_LIBS)
245
246 installheader:: headers installdirs
247         @srcdir=$(srcdir) builddir=$(builddir) $(PERL) $(srcdir)/script/installheader.pl $(DESTDIR)$(includedir) $(PUBLIC_HEADERS)
248
249 installdat:: installdirs
250         @$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(datadir) $(srcdir)
251
252 installman:: manpages installdirs
253         @$(SHELL) $(srcdir)/script/installman.sh $(DESTDIR)$(mandir) $(MANPAGES)
254
255 installmisc:: installdirs
256         @$(SHELL) $(srcdir)/script/installmisc.sh $(srcdir) $(DESTDIR)$(setupdir)
257
258 installpc:: installdirs
259         @$(SHELL) $(srcdir)/script/installpc.sh $(builddir) $(DESTDIR)$(pkgconfigdir) $(PC_FILES)
260
261 uninstall:: uninstallbin uninstallsbin uninstalldat uninstallmisc uninstalllib uninstallheader \
262                         uninstallman uninstallpc uninstallplugins
263
264 uninstallmisc::
265         @echo "Removing MISC files"
266         @rm -rf $(DESTDIR)$(setupdir)/*
267
268 $(DESTDIR)$(bindir)/%: bin/% installdirs
269         @mkdir -p $(@D)
270         @echo Installing $(@F) as $@
271         @if test -f $@; then echo -n ""; rm -f $@.old; mv $@ $@.old; fi
272         @cp $< $@
273         @chmod $(INSTALLPERMS) $@
274
275 $(DESTDIR)$(sbindir)/%: bin/% installdirs
276         @mkdir -p $(@D)
277         @echo Installing $(@F) as $@
278         @if test -f $@; then echo -n ""; rm -f $@.old; mv $@ $@.old; fi
279         @cp $< $@
280         @chmod $(INSTALLPERMS) $@
281
282 uninstalldat::
283         @echo "Removing DAT files"
284         @rm -fr $(DESTDIR)$(datadir)/*
285
286 uninstallbin::
287
288 uninstalllib::
289         @echo "Removing libraries"
290         @$(SHELL) $(srcdir)/script/uninstalllib.sh $(DESTDIR)$(libdir) $(SHARED_LIBS)
291
292 uninstallheader::
293         @echo "Removing headers"
294         @rm -fr $(DESTDIR)$(includedir)/*
295
296 uninstallman::
297         @echo "Removing manpages"
298         @$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(mandir) $(MANPAGES)
299
300 uninstallplugins::
301
302 uninstallpc::
303         @echo "Removing package configurations"
304         @cd $(DESTDIR)$(pkgconfigdir); rm -f $(notdir $(PC_FILES))
305
306 config.status:
307         @echo "config.status does not exist. Please run ./configure."
308         @/bin/false
309
310 data.mk: config.status $(MK_FILES)
311         ./config.status
312
313 testcov-html:: 
314
315 include $(pidldir)/config.mk
316 selftestdir := $(srcdir)/../selftest
317 include $(srcdir)/selftest/config.mk
318
319 showflags::
320         @echo '  pwd        = '`/bin/pwd`