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