]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - contrib/bind9/make/rules.in
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / contrib / bind9 / make / rules.in
1 # Copyright (C) 2004-2009, 2011, 2012  Internet Systems Consortium, Inc. ("ISC")
2 # Copyright (C) 1998-2003  Internet Software Consortium.
3 #
4 # Permission to use, copy, modify, and/or distribute this software for any
5 # purpose with or without fee is hereby granted, provided that the above
6 # copyright notice and this permission notice appear in all copies.
7 #
8 # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
9 # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10 # AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
11 # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12 # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
13 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14 # PERFORMANCE OF THIS SOFTWARE.
15
16 # $Id$
17
18 ###
19 ### Common Makefile rules for BIND 9.
20 ###
21
22 ###
23 ### Paths
24 ###
25 ### Note: paths that vary by Makefile MUST NOT be listed
26 ### here, or they won't get expanded correctly.
27
28 prefix =        @prefix@
29 exec_prefix =   @exec_prefix@
30 bindir =        @bindir@
31 sbindir =       @sbindir@
32 includedir =    @includedir@
33 libdir =        @libdir@
34 sysconfdir =    @sysconfdir@
35 localstatedir = @localstatedir@
36 mandir =        @mandir@
37 datarootdir =   @datarootdir@
38 export_libdir = @export_libdir@
39 export_includedir = @export_includedir@
40
41 DESTDIR =
42
43 @SET_MAKE@
44
45 top_builddir =  @BIND9_TOP_BUILDDIR@
46
47 ###
48 ### All
49 ###
50 ### Makefile may define:
51 ###     TARGETS
52
53 all: subdirs ${TARGETS} testdirs
54
55 ###
56 ### Subdirectories
57 ###
58 ### Makefile may define:
59 ###     SUBDIRS
60
61 ALL_SUBDIRS = ${SUBDIRS} nulldir
62 ALL_TESTDIRS = ${TESTDIRS} nulldir
63
64 #
65 # We use a single-colon rule so that additional dependencies of
66 # subdirectories can be specified after the inclusion of this file.
67 # The "depend" and "testdirs" targets are treated the same way.
68 #
69 subdirs:
70         @for i in ${ALL_SUBDIRS}; do \
71                 if [ "$$i" != "nulldir" -a -d $$i ]; then \
72                         echo "making all in `pwd`/$$i"; \
73                         (cd $$i; ${MAKE} ${MAKEDEFS} DESTDIR="${DESTDIR}" all) || exit 1; \
74                 fi; \
75         done
76
77 #
78 # Tests are built after the targets instead of before
79 #
80 testdirs:
81         @for i in ${ALL_TESTDIRS}; do \
82                 if [ "$$i" != "nulldir" -a -d $$i ]; then \
83                         echo "making all in `pwd`/$$i"; \
84                         (cd $$i; ${MAKE} ${MAKEDEFS} DESTDIR="${DESTDIR}" all) || exit 1; \
85                 fi; \
86         done
87
88 install:: all
89
90 install clean distclean maintainer-clean doc docclean man manclean::
91         @for i in ${ALL_SUBDIRS} ${ALL_TESTDIRS}; do \
92                 if [ "$$i" != "nulldir" -a -d $$i ]; then \
93                         echo "making $@ in `pwd`/$$i"; \
94                         (cd $$i; ${MAKE} ${MAKEDEFS} DESTDIR="${DESTDIR}" $@) || exit 1; \
95                 fi; \
96         done
97
98 ###
99 ### C Programs
100 ###
101 ### Makefile must define
102 ###     CC
103 ### Makefile may define
104 ###     CFLAGS
105 ###     LDFLAGS
106 ###     CINCLUDES
107 ###     CDEFINES
108 ###     CWARNINGS
109 ### User may define externally
110 ###     EXT_CFLAGS
111
112 CC =            @CC@
113 CFLAGS =        @CFLAGS@
114 LDFLAGS =       @LDFLAGS@
115 STD_CINCLUDES = @STD_CINCLUDES@
116 STD_CDEFINES =  @STD_CDEFINES@
117 STD_CWARNINGS = @STD_CWARNINGS@
118
119 BUILD_CC = @BUILD_CC@
120 BUILD_CFLAGS = @BUILD_CFLAGS@
121 BUILD_CPPFLAGS = @BUILD_CPPFLAGS@
122 BUILD_LDFLAGS = @BUILD_LDFLAGS@
123 BUILD_LIBS = @BUILD_LIBS@
124
125 .SUFFIXES:
126 .SUFFIXES: .c .@O@
127
128 ALWAYS_INCLUDES = -I${top_builddir}
129 ALWAYS_DEFINES = @ALWAYS_DEFINES@
130 ALWAYS_WARNINGS =
131
132 ALL_CPPFLAGS = \
133         ${ALWAYS_INCLUDES} ${CINCLUDES} ${STD_CINCLUDES} \
134         ${ALWAYS_DEFINES} ${CDEFINES} ${STD_CDEFINES}
135
136 ALL_CFLAGS = ${EXT_CFLAGS} ${ALL_CPPFLAGS} ${CFLAGS} \
137         ${ALWAYS_WARNINGS} ${STD_CWARNINGS} ${CWARNINGS}
138
139 @BIND9_CO_RULE@
140         ${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -c $<
141
142 SHELL = @SHELL@
143 LIBTOOL = @LIBTOOL@
144 LIBTOOL_MODE_COMPILE = ${LIBTOOL} @LIBTOOL_MODE_COMPILE@
145 LIBTOOL_MODE_INSTALL = ${LIBTOOL} @LIBTOOL_MODE_INSTALL@
146 LIBTOOL_MODE_LINK = ${LIBTOOL} @LIBTOOL_MODE_LINK@
147 PURIFY = @PURIFY@
148
149 MKDEP = ${SHELL} ${top_builddir}/make/mkdep
150
151 ###
152 ### This is a template compound command to build an executable binary with
153 ### an internal symbol table.
154 ### This process is tricky.  We first link all objects including a tentative
155 ### empty symbol table, then get a tentative list of symbols from the resulting
156 ### binary ($@tmp0).  Next, we re-link all objects, but this time with the
157 ### symbol table just created ($tmp@1).  The set of symbols should be the same,
158 ### but the corresponding addresses would be changed due to the difference on
159 ### the size of symbol tables.  So we create the symbol table and re-create the
160 ### objects once again.  Finally, we check the symbol table embedded in the
161 ### final binaryis consistent with the binary itself; otherwise the process is
162 ### terminated.
163 ###
164 ### To minimize the overhead of creating symbol tables, the autoconf switch
165 ### --enable-symtable takes an argument so that the symbol table can be created
166 ### on a per application basis: unless the argument is set to "all", the symbol
167 ### table is created only when a shell (environment) variable "MAKE_SYMTABLE" is
168 ### set to a non-null value in the rule to build the executable binary.
169 ###
170 ### Each Makefile.in that uses this macro is expected to define "LIBS" and
171 ### "NOSYMLIBS"; the former includes libisc with an empty symbol table, and
172 ### the latter includes libisc without the definition of a symbol table.
173 ### The rule to make the executable binary will look like this
174 ### binary@EXEEXT@: ${OBJS}
175 ###     #export MAKE_SYMTABLE="yes"; \  <- enable if symtable is always needed
176 ###     export BASEOBJS="${OBJS}"; \
177 ###     ${FINALBUILDCMD}
178 ###
179 ### Normally, ${LIBS} includes all necessary libraries to build the binary;
180 ### there are some exceptions however, where the rule lists some of the
181 ### necessary libraries explicitly in addition to (or instead of) ${LIBS},
182 ### like this:
183 ### binary@EXEEXT@: ${OBJS}
184 ###     cc -o $@ ${OBJS} ${OTHERLIB1} ${OTHERLIB2} ${lIBS}
185 ### in order to modify such a rule to use this compound command, a separate
186 ### variable "LIBS0" should be deinfed for the explicitly listed libraries,
187 ### while making sure ${LIBS} still includes libisc.  So the above rule would
188 ### be modified as follows:
189 ### binary@EXEEXT@: ${OBJS}
190 ###     export BASEOBJS="${OBJS}"; \
191 ###     export LIBS0="${OTHERLIB1} ${OTHERLIB2}"; \
192 ###     ${FINALBUILDCMD}
193 ### See bin/check/Makefile.in for a complete example of the use of LIBS0.
194 ###
195 FINALBUILDCMD = if [ X"${MKSYMTBL_PROGRAM}" = X -o X"$${MAKE_SYMTABLE:-${ALWAYS_MAKE_SYMTABLE}}" = X ] ; then \
196                 ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} \
197                 -o $@ $${BASEOBJS} $${LIBS0} ${LIBS}; \
198         else \
199                 rm -f $@tmp0; \
200                 ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} \
201                 -o $@tmp0 $${BASEOBJS} $${LIBS0} ${LIBS} || exit 1; \
202                 rm -f $@-symtbl.c $@-symtbl.@O@; \
203                 ${MKSYMTBL_PROGRAM} ${top_srcdir}/util/mksymtbl.pl \
204                 -o $@-symtbl.c $@tmp0 || exit 1; \
205                 $(MAKE) $@-symtbl.@O@ || exit 1; \
206                 rm -f $@tmp1; \
207                 ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} \
208                 -o $@tmp1 $${BASEOBJS} $@-symtbl.@O@ $${LIBS0} ${NOSYMLIBS} || exit 1; \
209                 rm -f $@-symtbl.c $@-symtbl.@O@; \
210                 ${MKSYMTBL_PROGRAM} ${top_srcdir}/util/mksymtbl.pl \
211                 -o $@-symtbl.c $@tmp1 || exit 1; \
212                 $(MAKE) $@-symtbl.@O@ || exit 1; \
213                 ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} \
214                 -o $@tmp2 $${BASEOBJS} $@-symtbl.@O@ $${LIBS0} ${NOSYMLIBS}; \
215                 ${MKSYMTBL_PROGRAM} ${top_srcdir}/util/mksymtbl.pl \
216                 -o $@-symtbl2.c $@tmp2; \
217                 count=0; \
218                 until diff $@-symtbl.c $@-symtbl2.c > /dev/null ; \
219                 do \
220                         count=`expr $$count + 1` ; \
221                         test $$count = 42 && exit 1 ; \
222                         rm -f $@-symtbl.c $@-symtbl.@O@; \
223                         ${MKSYMTBL_PROGRAM} ${top_srcdir}/util/mksymtbl.pl \
224                         -o $@-symtbl.c $@tmp2 || exit 1; \
225                         $(MAKE) $@-symtbl.@O@ || exit 1; \
226                         ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
227                         ${LDFLAGS} -o $@tmp2 $${BASEOBJS} $@-symtbl.@O@ \
228                         $${LIBS0} ${NOSYMLIBS}; \
229                         ${MKSYMTBL_PROGRAM} ${top_srcdir}/util/mksymtbl.pl \
230                         -o $@-symtbl2.c $@tmp2; \
231                 done ; \
232                 mv $@tmp2 $@; \
233                 rm -f $@tmp0 $@tmp1 $@tmp2 $@-symtbl2.c; \
234         fi
235
236 cleandir: distclean
237 superclean: maintainer-clean
238
239 clean distclean maintainer-clean::
240         rm -f *.@O@ *.o *.lo *.la core *.core *-symtbl.c *tmp0 *tmp1 *tmp2
241         rm -rf .depend .libs
242
243 distclean maintainer-clean::
244         rm -f Makefile
245
246 depend:
247         @for i in ${ALL_SUBDIRS}; do \
248                 if [ "$$i" != "nulldir" -a -d $$i ]; then \
249                         echo "making depend in `pwd`/$$i"; \
250                         (cd $$i; ${MAKE} ${MAKEDEFS} DESTDIR="${DESTDIR}" $@) || exit 1; \
251                 fi; \
252         done
253         @if [ X"${srcdir}" != X. ] ; then \
254                 if [ X"${SRCS}" != X -a X"${PSRCS}" != X ] ; then \
255                         echo ${MKDEP} -vpath ${srcdir} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \
256                         ${MKDEP} -vpath ${srcdir} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \
257                         echo ${MKDEP} -vpath ${srcdir} -ap ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \
258                         ${MKDEP} -vpath ${srcdir} -ap ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \
259                         ${DEPENDEXTRA} \
260                 elif [ X"${SRCS}" != X ] ; then \
261                         echo ${MKDEP} -vpath ${srcdir} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \
262                         ${MKDEP} -vpath ${srcdir} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \
263                         ${DEPENDEXTRA} \
264                 elif [ X"${PSRCS}" != X ] ; then \
265                         echo ${MKDEP} -vpath ${srcdir} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \
266                         ${MKDEP} -vpath ${srcdir} -p ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \
267                         ${DEPENDEXTRA} \
268                 fi \
269         else \
270                 if [ X"${SRCS}" != X -a X"${PSRCS}" != X ] ; then \
271                         echo ${MKDEP} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \
272                         ${MKDEP} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \
273                         echo ${MKDEP} -ap ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \
274                         ${MKDEP} -ap ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \
275                         ${DEPENDEXTRA} \
276                 elif [ X"${SRCS}" != X ] ; then \
277                         echo ${MKDEP} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \
278                         ${MKDEP} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \
279                         ${DEPENDEXTRA} \
280                 elif [ X"${PSRCS}" != X ] ; then \
281                         echo ${MKDEP} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \
282                         ${MKDEP} -p ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \
283                         ${DEPENDEXTRA} \
284                 fi \
285         fi
286
287 FORCE:
288
289 ###
290 ### Libraries
291 ###
292
293 AR =            @AR@
294 ARFLAGS =       @ARFLAGS@
295 RANLIB =        @RANLIB@
296
297 ###
298 ### Installation
299 ###
300
301 INSTALL =               @INSTALL@
302 INSTALL_PROGRAM =       @INSTALL_PROGRAM@
303 LINK_PROGRAM =          @LN_S@
304 INSTALL_SCRIPT =        @INSTALL_SCRIPT@
305 INSTALL_DATA =          @INSTALL_DATA@
306
307 ###
308 ### Programs used when generating documentation.  It's ok for these
309 ### not to exist when not generating documentation.
310 ###
311
312 XSLTPROC =              @XSLTPROC@ --novalid --xinclude --nonet
313 PERL =                  @PERL@
314 LATEX =                 @LATEX@
315 PDFLATEX =              @PDFLATEX@
316 W3M =                   @W3M@
317
318 ###
319 ### Script language program used to create internal symbol tables
320 ###
321 MKSYMTBL_PROGRAM =      @MKSYMTBL_PROGRAM@
322
323 ###
324 ### Switch to create internal symbol table selectively
325 ###
326 ALWAYS_MAKE_SYMTABLE =  @ALWAYS_MAKE_SYMTABLE@
327
328 ###
329 ### DocBook -> HTML
330 ### DocBook -> man page
331 ###
332
333 .SUFFIXES: .docbook .html .1 .2 .3 .4 .5 .6 .7 .8
334
335 .docbook.html:
336         ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-docbook-html.xsl $<
337
338 .docbook.1:
339         ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $<
340
341 .docbook.2:
342         ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $<
343
344 .docbook.3:
345         ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $<
346
347 .docbook.4:
348         ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $<
349
350 .docbook.5:
351         ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $<
352
353 .docbook.6:
354         ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $<
355
356 .docbook.7:
357         ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $<
358
359 .docbook.8:
360         ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $<