Avoid autogenerating the Makefile but rather include a data.mk file
[jelmer/samba4-debian.git] / source / Makefile
1 #!gmake
2
3 include mkconfig.mk
4
5 VPATH = $(builddir):$(srcdir):heimdal_build:heimdal/lib/asn1:heimdal/lib/krb5:heimdal/lib/gssapi:heimdal/lib/hdb:heimdal/lib/roken:heimdal/lib/des
6
7 BASEDIR = $(prefix)
8 TORTUREDIR = $(libdir)/torture
9 SWATDIR = $(datadir)/swat
10 JSDIR = $(datadir)/js
11 SETUPDIR = $(datadir)/setup
12 NCALRPCDIR = $(localstatedir)/ncalrpc
13
14 BNLD = $(LD)
15 BNLD_FLAGS = $(LDFLAGS)
16
17 HOSTCC_FLAGS = -D_SAMBA_HOSTCC_ $(CFLAGS)
18 HOSTLD_FLAGS = $(LDFLAGS)
19
20 default: all
21
22 include data.mk
23
24 DEFAULT_HEADERS = $(srcdir)/lib/util/dlinklist.h \
25                   $(srcdir)/version.h
26
27 binaries:: $(BINARIES)
28 libraries:: $(STATIC_LIBS) $(SHARED_LIBS)
29 modules:: $(SHARED_MODULES)
30 headers:: $(PUBLIC_HEADERS) $(DEFAULT_HEADERS)
31 manpages:: $(MANPAGES)
32 all:: showflags $(ALL_PREDEP) bin/asn1_compile bin/compile_et binaries modules pythonmods
33 everything:: all libraries headers
34
35 LD_LIBPATH_OVERRIDE = $(LIB_PATH_VAR)=$(builddir)/bin/shared
36
37 # 'make testsuite' creates all binaries which are
38 # needed by samba3's 'make test' and the build-farm
39 # scripts use that it as fallback in case
40 # 'make everything' fails
41 testsuite:: bin/smbclient bin/cifsdd bin/smbtorture bin/nmblookup
42
43 showlayout:: 
44         @echo 'Samba will be installed into:'
45         @echo '  basedir:     $(BASEDIR)'
46         @echo '  bindir:      $(bindir)'
47         @echo '  sbindir:     $(sbindir)'
48         @echo '  libdir:      $(libdir)'
49         @echo '  modulesdir:  $(modulesdir)'
50         @echo '  includedir:  $(includedir)'
51         @echo '  vardir:      $(localstatedir)'
52         @echo '  privatedir:  $(privatedir)'
53         @echo '  piddir:      $(piddir)'
54         @echo '  lockdir:     $(lockdir)'
55         @echo '  logfilebase: $(logfilebase)'
56         @echo '  setupdir:    $(SETUPDIR)'
57         @echo '  jsdir:       $(JSDIR)'
58         @echo '  swatdir:     $(SWATDIR)'
59         @echo '  mandir:      $(mandir)'
60         @echo '  torturedir:  $(TORTUREDIR)'
61         @echo '  datadir:     $(datadir)'
62         @echo '  winbindd_socket_dir:  $(winbindd_socket_dir)'
63
64 showflags::
65         @echo '  srcdir     = $(srcdir)'
66         @echo '  builddir   = $(builddir)'
67
68 # The permissions to give the executables
69 INSTALLPERMS = 0755
70
71 install:: showlayout everything installbin installdat installswat installmisc installlib \
72         installheader installpc installplugins
73
74 # DESTDIR is used here to prevent packagers wasting their time
75 # duplicating the Makefile. Remove it and you will have the privilege
76 # of packaging each samba release for multiple versions of multiple
77 # distributions and operating systems, or at least supplying patches
78 # to all the packaging files required for this, prior to committing
79 # the removal of DESTDIR. Do not remove it even though you think it
80 # is not used.
81
82 installdirs::
83         @$(SHELL) $(srcdir)/script/installdirs.sh \
84                 $(DESTDIR)$(BASEDIR) \
85                 $(DESTDIR)$(bindir) \
86                 $(DESTDIR)$(sbindir) \
87                 $(DESTDIR)$(TORTUREDIR) \
88                 $(DESTDIR)$(libdir) \
89                 $(DESTDIR)$(modulesdir) \
90                 $(DESTDIR)$(mandir) \
91                 $(DESTDIR)$(localstatedir) \
92                 $(DESTDIR)$(privatedir) \
93                 $(DESTDIR)$(datadir) \
94                 $(DESTDIR)$(piddir) \
95                 $(DESTDIR)$(lockdir) \
96                 $(DESTDIR)$(logfilebase) \
97                 $(DESTDIR)$(privatedir)/tls \
98                 $(DESTDIR)$(includedir) \
99                 $(DESTDIR)$(PKGCONFIGDIR) \
100                 $(DESTDIR)$(sysconfdir) \
101
102 installbin:: $(SBIN_PROGS) $(BIN_PROGS) $(TORTURE_PROGS) installdirs
103         @$(SHELL) $(srcdir)/script/installbin.sh \
104                 $(INSTALLPERMS) \
105                 $(DESTDIR)$(BASEDIR) \
106                 $(DESTDIR)$(sbindir) \
107                 $(DESTDIR)$(libdir) \
108                 $(DESTDIR)$(localstatedir) \
109                 $(SBIN_PROGS)
110         @$(SHELL) $(srcdir)/script/installbin.sh \
111                 $(INSTALLPERMS) \
112                 $(DESTDIR)$(BASEDIR) \
113                 $(DESTDIR)$(bindir) \
114                 $(DESTDIR)$(libdir) \
115                 $(DESTDIR)$(localstatedir) \
116                 $(BIN_PROGS)
117         @$(SHELL) $(srcdir)/script/installtorture.sh \
118                 $(INSTALLPERMS) \
119                 $(DESTDIR)$(TORTUREDIR) \
120                 $(TORTURE_PROGS)
121
122 installlib:: $(INSTALLABLE_SHARED_LIBS) $(STATIC_LIBS) installdirs
123         @$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(libdir) "$(SHLIBEXT)" $(INSTALLABLE_SHARED_LIBS) 
124         #@$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(libdir) "$(STLIBEXT)" $(STATIC_LIBS)
125
126 installheader:: headers installdirs
127         @srcdir=$(srcdir) builddir=$(builddir) $(PERL) $(srcdir)/script/installheader.pl $(DESTDIR)$(includedir) $(PUBLIC_HEADERS) $(DEFAULT_HEADERS)
128
129 installdat:: installdirs
130         @$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(datadir) $(srcdir)
131
132 installswat:: installdirs
133         @$(SHELL) $(srcdir)/script/installswat.sh $(DESTDIR)$(SWATDIR) $(srcdir)
134
135 installman:: manpages installdirs
136         @$(SHELL) $(srcdir)/script/installman.sh $(DESTDIR)$(mandir) $(MANPAGES)
137
138 installmisc:: installdirs
139         @$(SHELL) $(srcdir)/script/installmisc.sh $(srcdir) $(DESTDIR)$(JSDIR) $(DESTDIR)$(SETUPDIR) $(DESTDIR)$(bindir)
140
141 installpc:: installdirs
142         @$(SHELL) $(srcdir)/script/installpc.sh $(builddir) $(DESTDIR)$(PKGCONFIGDIR) $(PC_FILES)
143
144 uninstall:: uninstallbin uninstallman uninstallmisc uninstalllib uninstallheader \
145         uninstallplugins
146
147 uninstallmisc::
148         #FIXME
149
150 uninstallbin::
151         @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(sbindir) $(DESTDIR)$(libdir) $(DESTDIR)$(localstatedir) $(DESTDIR)$(SBIN_PROGS)
152         @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(bindir) $(DESTDIR)$(libdir) $(DESTDIR)$(localstatedir) $(DESTDIR)$(BIN_PROGS)
153         @$(SHELL) $(srcdir)/script/uninstalltorture.sh $(DESTDIR)$(TORTUREDIR) $(TORTURE_PROGS)
154
155 uninstalllib::
156         @$(SHELL) $(srcdir)/script/uninstalllib.sh $(DESTDIR)$(libdir) $(SHARED_LIBS)
157         #@$(SHELL) $(srcdir)/script/uninstalllib.sh $(DESTDIR)$(libdir) $(STATIC_LIBS) 
158
159 uninstallheader::
160         @$(SHELL) $(srcdir)/script/uninstallheader.sh $(DESTDIR)$(includedir) $(PUBLIC_HEADERS)
161
162 uninstallman::
163         @$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(mandir) $(MANPAGES)
164
165 data.mk: config.status $(MK_FILES)
166         ./config.status
167
168 pidl/Makefile: pidl/Makefile.PL
169         cd pidl && $(PERL) Makefile.PL 
170
171 testcov-html:: pidl-testcov
172
173 pidl-testcov: pidl/Makefile
174         cd pidl && cover -test
175
176 installpidl:: pidl/Makefile
177         $(MAKE) -C pidl install
178
179 uninstallpidl:: pidl/Makefile
180         $(MAKE) -C pidl uninstall
181
182 $(IDL_HEADER_FILES) \
183         $(IDL_NDR_PARSE_H_FILES) $(IDL_NDR_PARSE_C_FILES) \
184         $(IDL_NDR_CLIENT_C_FILES) $(IDL_NDR_CLIENT_H_FILES) \
185         $(IDL_NDR_SERVER_C_FILES) $(IDL_SWIG_FILES) \
186         $(IDL_NDR_EJS_C_FILES) $(IDL_NDR_EJS_H_FILES) \
187         $(IDL_NDR_PY_C_FILES) $(IDL_NDR_PY_H_FILES): idl
188
189 idl_full:: pidl/lib/Parse/Pidl/IDL.pm pidl/lib/Parse/Pidl/Expr.pm 
190         @CPP="$(CPP)" PERL="$(PERL)" srcdir=$(srcdir) $(srcdir)/script/build_idl.sh FULL
191
192 idl:: pidl/lib/Parse/Pidl/IDL.pm pidl/lib/Parse/Pidl/Expr.pm 
193         @CPP="$(CPP)" PERL="$(PERL)" srcdir=$(srcdir) $(srcdir)/script/build_idl.sh PARTIAL 
194
195 pidl/lib/Parse/Pidl/IDL.pm: pidl/idl.yp
196         -$(YAPP) -m 'Parse::Pidl::IDL' -o pidl/lib/Parse/Pidl/IDL.pm pidl/idl.yp ||\
197                 touch pidl/lib/Parse/Pidl/IDL.pm 
198
199 pidl/lib/Parse/Pidl/Expr.pm: pidl/idl.yp
200         -$(YAPP) -m 'Parse::Pidl::Expr' -o pidl/lib/Parse/Pidl/Expr.pm pidl/expr.yp ||\
201                 touch pidl/lib/Parse/Pidl/Expr.pm 
202
203 include selftest/config.mk
204 include rules.mk
205
206 showflags::
207         @echo '  pwd        = '`/bin/pwd`