1#!gmake
2# The Samba 4 Makefile.
3# This file is *NOT* autogenerated.
4#
5.DEFAULT_GOAL := all
6
7default: all
8
9include mkconfig.mk
10
11pidldir := $(srcdir)/../pidl
12
13basedir = $(prefix)
14torturedir = ../lib/torture
15swatdir = $(datadir)/swat
16setupdir = $(datadir)/setup
17ncalrpcdir = $(localstatedir)/ncalrpc
18shliboutputdir = $(builddir)/bin/shared
19
20BNLD = $(LD)
21BNLD_FLAGS = $(LDFLAGS) $(SYS_LDFLAGS)
22
23HOSTCC_FLAGS = -D_SAMBA_HOSTCC_ $(CFLAGS)
24HOSTLD_FLAGS = $(LDFLAGS) $(SYS_LDFLAGS)
25
26$(srcdir)/version.h: $(srcdir)/VERSION
27	@$(SHELL) script/mkversion.sh VERSION $(srcdir)/version.h $(srcdir)/
28
29ifneq ($(automatic_dependencies),yes)
30ALL_PREDEP = basics
31.NOTPARALLEL:
32endif
33
34regen_version::
35	@$(SHELL) script/mkversion.sh VERSION $(srcdir)/version.h $(srcdir)/
36
37clean_pch::
38	@echo "Removing precompiled headers"
39	@-rm -f include/includes.h.gch
40
41pch:: clean_pch include/includes.h.gch
42
43.DEFAULT_GOAL := all
44
45ifneq ($(automatic_dependencies),yes)
46ALL_PREDEP = basics
47.NOTPARALLEL:
48endif
49
50base_srcdirs = $(srcdir) ../librpc/ ../lib/ ../libcli ../libgpo ../nsswitch ../libds
51
52include $(srcdir)/build/make/rules.mk
53include $(srcdir)/build/make/python.mk
54zlibsrcdir := ../lib/zlib
55dynconfigsrcdir := dynconfig
56heimdalsrcdir := heimdal
57dsdbsrcdir := dsdb
58smbdsrcdir := smbd
59clustersrcdir := cluster
60libnetsrcdir := libnet
61authsrcdir := auth
62nsswitchsrcdir := ../nsswitch
63libwbclientsrcdir := ../nsswitch/libwbclient
64libsrcdir := lib
65libsocketsrcdir := lib/socket
66libcharsetsrcdir := ../lib/util/charset
67ldb_sambasrcdir := lib/ldb-samba
68tdbsrcdir := ../lib/tdb
69ldbsrcdir := lib/ldb
70libtlssrcdir := lib/tls
71libregistrysrcdir := lib/registry
72smbreadlinesrcdir := lib/smbreadline
73libmessagingsrcdir := lib/messaging
74libteventsrcdir := ../lib/tevent
75libeventssrcdir := lib/events
76libcmdlinesrcdir := lib/cmdline
77poptsrcdir := ../lib/popt
78socketwrappersrcdir := ../lib/socket_wrapper
79nsswrappersrcdir := ../lib/nss_wrapper
80uidwrappersrcdir := ../lib/uid_wrapper
81appwebsrcdir := lib/appweb
82libstreamsrcdir := lib/stream
83libutilsrcdir := ../lib/util
84libtdrsrcdir := ../lib/tdr
85libcryptosrcdir := ../lib/crypto
86libtorturesrcdir := ../lib/torture
87smb_serversrcdir := smb_server
88libcompressionsrcdir := ../lib/compression
89libgencachesrcdir := lib
90paramsrcdir := param
91rpc_serversrcdir := rpc_server
92ldap_serversrcdir := ldap_server
93web_serversrcdir := web_server
94winbindsrcdir := winbind
95nbt_serversrcdir := nbt_server
96wrepl_serversrcdir := wrepl_server
97cldap_serversrcdir := cldap_server
98utilssrcdir := utils
99clientsrcdir := client
100torturesrcdir := torture
101ntvfssrcdir := ntvfs
102ntptrsrcdir := ntptr
103librpcsrcdir := librpc
104libclisrcdir := libcli
105libclicommonsrcdir := ../libcli
106libclinbtsrcdir := ../libcli/nbt
107pyscriptsrcdir := $(srcdir)/scripting/python
108kdcsrcdir := kdc
109ntp_signdsrcdir := ntp_signd
110wmisrcdir := lib/wmi
111tallocsrcdir := ../lib/talloc
112comsrcdir := $(srcdir)/lib/com
113libgpodir := libgpo
114
115include data.mk
116
117INSTALL_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
132pythonmods:: $(PYTHON_PYS) $(PYTHON_SO)
133
134DEP_FILES = $(patsubst %.ho,%.hd,$(patsubst %.o,%.d,$(ALL_OBJS))) \
135		   include/includes.d
136
137ifeq ($(automatic_dependencies),yes)
138ifneq ($(MAKECMDGOALS),clean)
139ifneq ($(MAKECMDGOALS),distclean)
140ifneq ($(MAKECMDGOALS),realdistclean)
141ifneq ($(SKIP_DEP_FILES),yes)
142-include $(DEP_FILES)
143endif
144endif
145endif
146endif
147
148ifneq ($(SKIP_DEP_FILES),yes)
149clean::
150	@echo Removing dependency files
151	@find . -name '*.d' -o -name '*.hd' | xargs rm -f
152endif
153else
154include $(srcdir)/static_deps.mk
155endif
156
157clean::
158	@find $(base_srcdirs) -name '*.o' -o -name '*.ho' | xargs rm -f
159
160PUBLIC_HEADERS += ./version.h
161
162libraries:: $(STATIC_LIBS) $(SHARED_LIBS)
163modules:: $(PLUGINS)
164headers:: $(PUBLIC_HEADERS)
165manpages:: $(MANPAGES)
166all:: showflags $(ALL_PREDEP) binaries modules pythonmods libraries headers
167everything:: all
168
169LD_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
175testsuite:: bin/smbclient bin/cifsdd bin/smbtorture bin/nmblookup
176
177showlayout:: 
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
198showflags::
199	@echo '  srcdir     = $(srcdir)'
200	@echo '  builddir   = $(builddir)'
201
202# The permissions to give the executables
203INSTALLPERMS = 0755
204
205install:: 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
216installdirs::
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
238installbin:: installdirs
239
240installplugins::
241
242installlib:: $(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
246installheader:: headers installdirs
247	@srcdir=$(srcdir) builddir=$(builddir) $(PERL) $(srcdir)/script/installheader.pl $(DESTDIR)$(includedir) $(PUBLIC_HEADERS)
248
249installdat:: installdirs
250	@$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(datadir) $(srcdir)
251
252installman:: manpages installdirs
253	@$(SHELL) $(srcdir)/script/installman.sh $(DESTDIR)$(mandir) $(MANPAGES)
254
255installmisc:: installdirs
256	@$(SHELL) $(srcdir)/script/installmisc.sh $(srcdir) $(DESTDIR)$(setupdir)
257
258installpc:: installdirs
259	@$(SHELL) $(srcdir)/script/installpc.sh $(builddir) $(DESTDIR)$(pkgconfigdir) $(PC_FILES)
260
261uninstall:: uninstallbin uninstallsbin uninstalldat uninstallmisc uninstalllib uninstallheader \
262			uninstallman uninstallpc uninstallplugins
263
264uninstallmisc::
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
282uninstalldat::
283	@echo "Removing DAT files"
284	@rm -fr $(DESTDIR)$(datadir)/*
285
286uninstallbin::
287
288uninstalllib::
289	@echo "Removing libraries"
290	@$(SHELL) $(srcdir)/script/uninstalllib.sh $(DESTDIR)$(libdir) $(SHARED_LIBS)
291
292uninstallheader::
293	@echo "Removing headers"
294	@rm -fr $(DESTDIR)$(includedir)/*
295
296uninstallman::
297	@echo "Removing manpages"
298	@$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(mandir) $(MANPAGES)
299
300uninstallplugins::
301
302uninstallpc::
303	@echo "Removing package configurations"
304	@cd $(DESTDIR)$(pkgconfigdir); rm -f $(notdir $(PC_FILES))
305
306config.status:
307	@echo "config.status does not exist. Please run ./configure."
308	@/bin/false
309
310data.mk: config.status $(MK_FILES)
311	./config.status
312
313testcov-html:: 
314
315include $(pidldir)/config.mk
316selftestdir := $(srcdir)/../selftest
317include $(srcdir)/selftest/config.mk
318
319showflags::
320	@echo '  pwd        = '`/bin/pwd`
321