1 # Copyright (C) 2004-2009 Internet Systems Consortium, Inc. ("ISC")
2 # Copyright (C) 1998-2003 Internet Software Consortium.
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.
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.
16 # Id: rules.in,v 1.68 2009/09/01 18:40:25 jinmei Exp
19 ### Common Makefile rules for BIND 9.
25 ### Note: paths that vary by Makefile MUST NOT be listed
26 ### here, or they won't get expanded correctly.
29 exec_prefix = @exec_prefix@
32 includedir = @includedir@
34 sysconfdir = @sysconfdir@
35 localstatedir = @localstatedir@
37 datarootdir = @datarootdir@
38 export_libdir = @export_libdir@
39 export_includedir = @export_includedir@
45 top_builddir = @BIND9_TOP_BUILDDIR@
50 ### Makefile may define:
53 all: subdirs ${TARGETS}
58 ### Makefile may define:
61 ALL_SUBDIRS = ${SUBDIRS} nulldir
64 # We use a single-colon rule so that additional dependencies of
65 # subdirectories can be specified after the inclusion of this file.
66 # The "depend" target is treated the same way.
69 @for i in ${ALL_SUBDIRS}; do \
70 if [ "$$i" != "nulldir" -a -d $$i ]; then \
71 echo "making all in `pwd`/$$i"; \
72 (cd $$i; ${MAKE} ${MAKEDEFS} DESTDIR="${DESTDIR}" all) || exit 1; \
78 install clean distclean maintainer-clean doc docclean man manclean::
79 @for i in ${ALL_SUBDIRS}; do \
80 if [ "$$i" != "nulldir" -a -d $$i ]; then \
81 echo "making $@ in `pwd`/$$i"; \
82 (cd $$i; ${MAKE} ${MAKEDEFS} DESTDIR="${DESTDIR}" $@) || exit 1; \
89 ### Makefile must define
91 ### Makefile may define
97 ### User may define externally
103 STD_CINCLUDES = @STD_CINCLUDES@
104 STD_CDEFINES = @STD_CDEFINES@
105 STD_CWARNINGS = @STD_CWARNINGS@
107 BUILD_CC = @BUILD_CC@
108 BUILD_CFLAGS = @BUILD_CFLAGS@
109 BUILD_CPPFLAGS = @BUILD_CPPFLAGS@
110 BUILD_LDFLAGS = @BUILD_LDFLAGS@
111 BUILD_LIBS = @BUILD_LIBS@
116 ALWAYS_INCLUDES = -I${top_builddir}
117 ALWAYS_DEFINES = @ALWAYS_DEFINES@
121 ${ALWAYS_INCLUDES} ${CINCLUDES} ${STD_CINCLUDES} \
122 ${ALWAYS_DEFINES} ${CDEFINES} ${STD_CDEFINES}
124 ALL_CFLAGS = ${EXT_CFLAGS} ${ALL_CPPFLAGS} ${CFLAGS} \
125 ${ALWAYS_WARNINGS} ${STD_CWARNINGS} ${CWARNINGS}
128 ${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -c $<
132 LIBTOOL_MODE_COMPILE = ${LIBTOOL} @LIBTOOL_MODE_COMPILE@
133 LIBTOOL_MODE_INSTALL = ${LIBTOOL} @LIBTOOL_MODE_INSTALL@
134 LIBTOOL_MODE_LINK = ${LIBTOOL} @LIBTOOL_MODE_LINK@
137 MKDEP = ${SHELL} ${top_builddir}/make/mkdep
140 ### This is a template compound command to build an executable binary with
141 ### an internal symbol table.
142 ### This process is tricky. We first link all objects including a tentative
143 ### empty symbol table, then get a tentative list of symbols from the resulting
144 ### binary ($@tmp0). Next, we re-link all objects, but this time with the
145 ### symbol table just created ($tmp@1). The set of symbols should be the same,
146 ### but the corresponding addresses would be changed due to the difference on
147 ### the size of symbol tables. So we create the symbol table and re-create the
148 ### objects once again. Finally, we check the symbol table embedded in the
149 ### final binaryis consistent with the binary itself; otherwise the process is
152 ### To minimize the overhead of creating symbol tables, the autoconf switch
153 ### --enable-symtable takes an argument so that the symbol table can be created
154 ### on a per application basis: unless the argument is set to "all", the symbol
155 ### table is created only when a shell (environment) variable "MAKE_SYMTABLE" is
156 ### set to a non-null value in the rule to build the executable binary.
158 ### Each Makefile.in that uses this macro is expected to define "LIBS" and
159 ### "NOSYMLIBS"; the former includes libisc with an empty symbol table, and
160 ### the latter includes libisc without the definition of a symbol table.
161 ### The rule to make the executable binary will look like this
162 ### binary@EXEEXT@: ${OBJS}
163 ### #export MAKE_SYMTABLE="yes"; \ <- enable if symtable is always needed
164 ### export BASEOBJS="${OBJS}"; \
167 ### Normally, ${LIBS} includes all necessary libraries to build the binary;
168 ### there are some exceptions however, where the rule lists some of the
169 ### necessary libraries explicitly in addition to (or instead of) ${LIBS},
171 ### binary@EXEEXT@: ${OBJS}
172 ### cc -o $@ ${OBJS} ${OTHERLIB1} ${OTHERLIB2} ${lIBS}
173 ### in order to modify such a rule to use this compound command, a separate
174 ### variable "LIBS0" should be deinfed for the explicitly listed libraries,
175 ### while making sure ${LIBS} still includes libisc. So the above rule would
176 ### be modified as follows:
177 ### binary@EXEEXT@: ${OBJS}
178 ### export BASEOBJS="${OBJS}"; \
179 ### export LIBS0="${OTHERLIB1} ${OTHERLIB2}"; \
181 ### See bin/check/Makefile.in for a complete example of the use of LIBS0.
183 FINALBUILDCMD = if [ X"${MKSYMTBL_PROGRAM}" = X -o X"$${MAKE_SYMTABLE:-${ALWAYS_MAKE_SYMTABLE}}" = X ] ; then \
184 ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} \
185 -o $@ $${BASEOBJS} $${LIBS0} ${LIBS}; \
188 ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} \
189 -o $@tmp0 $${BASEOBJS} $${LIBS0} ${LIBS} || exit 1; \
190 rm -f $@-symtbl.c $@-symtbl.@O@; \
191 ${MKSYMTBL_PROGRAM} ${top_srcdir}/util/mksymtbl.pl \
192 -o $@-symtbl.c $@tmp0 || exit 1; \
193 $(MAKE) $@-symtbl.@O@ || exit 1; \
195 ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} \
196 -o $@tmp1 $${BASEOBJS} $@-symtbl.@O@ $${LIBS0} ${NOSYMLIBS} || exit 1; \
197 rm -f $@-symtbl.c $@-symtbl.@O@; \
198 ${MKSYMTBL_PROGRAM} ${top_srcdir}/util/mksymtbl.pl \
199 -o $@-symtbl.c $@tmp1 || exit 1; \
200 $(MAKE) $@-symtbl.@O@ || exit 1; \
201 ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} \
202 -o $@tmp2 $${BASEOBJS} $@-symtbl.@O@ $${LIBS0} ${NOSYMLIBS}; \
203 ${MKSYMTBL_PROGRAM} ${top_srcdir}/util/mksymtbl.pl \
204 -o $@-symtbl2.c $@tmp2; \
205 diff $@-symtbl.c $@-symtbl2.c || exit 1;\
207 rm -f $@tmp0 $@tmp1 $@tmp2 $@-symtbl2.c; \
211 superclean: maintainer-clean
213 clean distclean maintainer-clean::
214 rm -f *.@O@ *.o *.lo *.la core *.core *-symtbl.c *tmp0 *tmp1 *tmp2
217 distclean maintainer-clean::
221 @for i in ${ALL_SUBDIRS}; do \
222 if [ "$$i" != "nulldir" -a -d $$i ]; then \
223 echo "making depend in `pwd`/$$i"; \
224 (cd $$i; ${MAKE} ${MAKEDEFS} DESTDIR="${DESTDIR}" $@) || exit 1; \
227 @if [ X"${VPATH}" != X ] ; then \
228 if [ X"${SRCS}" != X -a X"${PSRCS}" != X ] ; then \
229 echo ${MKDEP} -vpath ${VPATH} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \
230 ${MKDEP} -vpath ${VPATH} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \
231 echo ${MKDEP} -vpath ${VPATH} -ap ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \
232 ${MKDEP} -vpath ${VPATH} -ap ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \
234 elif [ X"${SRCS}" != X ] ; then \
235 echo ${MKDEP} -vpath ${VPATH} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \
236 ${MKDEP} -vpath ${VPATH} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \
238 elif [ X"${PSRCS}" != X ] ; then \
239 echo ${MKDEP} -vpath ${VPATH} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \
240 ${MKDEP} -vpath ${VPATH} -p ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \
244 if [ X"${SRCS}" != X -a X"${PSRCS}" != X ] ; then \
245 echo ${MKDEP} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \
246 ${MKDEP} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \
247 echo ${MKDEP} -ap ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \
248 ${MKDEP} -ap ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \
250 elif [ X"${SRCS}" != X ] ; then \
251 echo ${MKDEP} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \
252 ${MKDEP} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \
254 elif [ X"${PSRCS}" != X ] ; then \
255 echo ${MKDEP} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \
256 ${MKDEP} -p ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \
276 INSTALL_PROGRAM = @INSTALL_PROGRAM@
277 LINK_PROGRAM = @LN_S@
278 INSTALL_SCRIPT = @INSTALL_SCRIPT@
279 INSTALL_DATA = @INSTALL_DATA@
282 ### Programs used when generating documentation. It's ok for these
283 ### not to exist when not generating documentation.
286 XSLTPROC = @XSLTPROC@ --novalid --xinclude --nonet
289 PDFLATEX = @PDFLATEX@
293 ### Script language program used to create internal symbol tables
295 MKSYMTBL_PROGRAM = @MKSYMTBL_PROGRAM@
298 ### Switch to create internal symbol table selectively
300 ALWAYS_MAKE_SYMTABLE = @ALWAYS_MAKE_SYMTABLE@
304 ### DocBook -> man page
307 .SUFFIXES: .docbook .html .1 .2 .3 .4 .5 .6 .7 .8
310 ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-docbook-html.xsl $<
313 ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $<
316 ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $<
319 ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $<
322 ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $<
325 ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $<
328 ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $<
331 ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $<
334 ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $<