s4 - Create default modules directory.
[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 $(DESTDIR)$(bindir)/%: scripting/bin/% installdirs
118         @mkdir -p $(@D)
119         @echo Installing $(@F) as $@
120         @if test -f $@; then echo -n ""; rm -f $@.old; mv $@ $@.old; fi
121         @cp $< $@
122         @chmod $(INSTALLPERMS) $@
123
124 pythonmods:: $(PYTHON_PYS) $(PYTHON_SO)
125
126 DEP_FILES = $(patsubst %.ho,%.hd,$(patsubst %.o,%.d,$(ALL_OBJS))) \
127                    include/includes.d
128
129 ifeq ($(automatic_dependencies),yes)
130 ifneq ($(MAKECMDGOALS),clean)
131 ifneq ($(MAKECMDGOALS),distclean)
132 ifneq ($(MAKECMDGOALS),realdistclean)
133 ifneq ($(SKIP_DEP_FILES),yes)
134 -include $(DEP_FILES)
135 endif
136 endif
137 endif
138 endif
139
140 ifneq ($(SKIP_DEP_FILES),yes)
141 clean::
142         @echo Removing dependency files
143         @find . -name '*.d' -o -name '*.hd' | xargs rm -f
144 endif
145 else
146 include $(srcdir)/static_deps.mk
147 endif
148
149 clean::
150         @find $(base_srcdirs) -name '*.o' -o -name '*.ho' | xargs rm -f
151
152 PUBLIC_HEADERS += ./version.h
153
154 libraries:: $(STATIC_LIBS) $(SHARED_LIBS)
155 modules:: $(PLUGINS)
156 headers:: $(PUBLIC_HEADERS)
157 manpages:: $(MANPAGES)
158 all:: showflags $(ALL_PREDEP) binaries modules pythonmods libraries headers
159 everything:: all
160
161 LD_LIBPATH_OVERRIDE = $(LIB_PATH_VAR)=$(shliboutputdir):$$$(LIB_PATH_VAR)
162
163 # 'make testsuite' creates all binaries which are
164 # needed by samba3's 'make test' and the build-farm
165 # scripts use that it as fallback in case
166 # 'make everything' fails
167 testsuite:: bin/smbclient bin/cifsdd bin/smbtorture bin/nmblookup
168
169 showlayout:: 
170         @echo 'Samba will be installed into:'
171         @echo '  basedir:     $(basedir)'
172         @echo '  bindir:      $(bindir)'
173         @echo '  sbindir:     $(sbindir)'
174         @echo '  libdir:      $(libdir)'
175         @echo '  modulesdir:  $(modulesdir)'
176         @echo '  includedir:  $(includedir)'
177         @echo '  vardir:      $(localstatedir)'
178         @echo '  privatedir:  $(privatedir)'
179         @echo '  piddir:      $(piddir)'
180         @echo '  lockdir:     $(lockdir)'
181         @echo '  logfilebase: $(logfilebase)'
182         @echo '  setupdir:    $(setupdir)'
183         @echo '  swatdir:     $(swatdir)'
184         @echo '  mandir:      $(mandir)'
185         @echo '  torturedir:  $(torturedir)'
186         @echo '  datadir:     $(datadir)'
187         @echo '  winbindd_socket_dir:  $(winbindd_socket_dir)'
188         @echo '  ntp_signd_socket_dir:  $(ntp_signd_socket_dir)'
189
190 showflags::
191         @echo '  srcdir     = $(srcdir)'
192         @echo '  builddir   = $(builddir)'
193
194 # The permissions to give the executables
195 INSTALLPERMS = 0755
196
197 install:: showlayout everything installbin installsbin installdat installmisc \
198               installlib installheader installpc installplugins
199
200 # DESTDIR is used here to prevent packagers wasting their time
201 # duplicating the Makefile. Remove it and you will have the privilege
202 # of packaging each samba release for multiple versions of multiple
203 # distributions and operating systems, or at least supplying patches
204 # to all the packaging files required for this, prior to committing
205 # the removal of DESTDIR. Do not remove it even though you think it
206 # is not used.
207
208 installdirs::
209         @$(SHELL) $(srcdir)/script/installdirs.sh \
210                 $(DESTDIR)$(basedir) \
211                 $(DESTDIR)$(bindir) \
212                 $(DESTDIR)$(sbindir) \
213                 $(DESTDIR)$(torturedir) \
214                 $(DESTDIR)$(libdir) \
215                 $(DESTDIR)$(modulesdir) \
216                 $(DESTDIR)$(modulesdir)/ldb \
217                 $(DESTDIR)$(mandir) \
218                 $(DESTDIR)$(localstatedir) \
219                 $(DESTDIR)$(localstatedir)/lib \
220                 $(DESTDIR)$(localstatedir)/run \
221                 $(DESTDIR)$(privatedir) \
222                 $(DESTDIR)$(datadir) \
223                 $(DESTDIR)$(piddir) \
224                 $(DESTDIR)$(lockdir) \
225                 $(DESTDIR)$(logfilebase) \
226                 $(DESTDIR)$(privatedir)/tls \
227                 $(DESTDIR)$(includedir) \
228                 $(DESTDIR)$(pkgconfigdir) \
229                 $(DESTDIR)$(sysconfdir)
230
231 installbin:: installdirs
232
233 installplugins::
234
235 installlib:: $(SHARED_LIBS) $(STATIC_LIBS) installdirs
236         @$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(libdir) "$(SHLIBEXT)" $(SHARED_LIBS) 
237         #@$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(libdir) "$(STLIBEXT)" $(STATIC_LIBS)
238
239 installheader:: headers installdirs
240         @srcdir=$(srcdir) builddir=$(builddir) $(PERL) $(srcdir)/script/installheader.pl $(DESTDIR)$(includedir) $(PUBLIC_HEADERS)
241
242 installdat:: installdirs
243         @$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(datadir) $(srcdir)
244
245 installman:: manpages installdirs
246         @$(SHELL) $(srcdir)/script/installman.sh $(DESTDIR)$(mandir) $(MANPAGES)
247
248 installmisc:: installdirs
249         @$(SHELL) $(srcdir)/script/installmisc.sh $(srcdir) $(DESTDIR)$(setupdir) $(DESTDIR)$(bindir) $(DESTDIR)$(sbindir) $(pythondir)
250
251 installpc:: installdirs
252         @$(SHELL) $(srcdir)/script/installpc.sh $(builddir) $(DESTDIR)$(pkgconfigdir) $(PC_FILES)
253
254 uninstall:: uninstallbin uninstallsbin uninstalldat uninstallmisc uninstalllib uninstallheader \
255                         uninstallman uninstallpc uninstallplugins
256
257 uninstallmisc::
258         @echo "Removing MISC files"
259         @rm -rf $(DESTDIR)$(setupdir)/*
260
261 $(DESTDIR)$(bindir)/%: bin/% installdirs
262         @mkdir -p $(@D)
263         @echo Installing $(@F) as $@
264         @if test -f $@; then echo -n ""; rm -f $@.old; mv $@ $@.old; fi
265         @cp $< $@
266         @chmod $(INSTALLPERMS) $@
267
268 $(DESTDIR)$(sbindir)/%: 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 uninstalldat::
276         @echo "Removing DAT files"
277         @rm -fr $(DESTDIR)$(datadir)/*
278
279 uninstallbin::
280
281 uninstalllib::
282         @echo "Removing libraries"
283         @$(SHELL) $(srcdir)/script/uninstalllib.sh $(DESTDIR)$(libdir) $(SHARED_LIBS)
284
285 uninstallheader::
286         @echo "Removing headers"
287         @rm -fr $(DESTDIR)$(includedir)/*
288
289 uninstallman::
290         @echo "Removing manpages"
291         @$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(mandir) $(MANPAGES)
292
293 uninstallplugins::
294
295 uninstallpc::
296         @echo "Removing package configurations"
297         @cd $(DESTDIR)$(pkgconfigdir); rm -f $(notdir $(PC_FILES))
298
299 config.status:
300         @echo "config.status does not exist. Please run ./configure."
301         @/bin/false
302
303 data.mk: config.status $(MK_FILES)
304         ./config.status
305
306 testcov-html:: 
307
308 include $(pidldir)/config.mk
309 selftestdir := $(srcdir)/../selftest
310 include $(srcdir)/selftest/config.mk
311
312 showflags::
313         @echo '  pwd        = '`/bin/pwd`