etc/services - sync with NetBSD-8
[minix.git] / external / bsd / bind / dist / make / rules.in
blob1a8e9ac9174d23be899e83e342e89ffa1d86dfd9
1 # Copyright (C) 2004-2009, 2011-2014  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 ###
17 ### Common Makefile rules for BIND 9.
18 ###
20 ###
21 ### Paths
22 ###
23 ### Note: paths that vary by Makefile MUST NOT be listed
24 ### here, or they won't get expanded correctly.
26 prefix =        @prefix@
27 exec_prefix =   @exec_prefix@
28 bindir =        @bindir@
29 sbindir =       @sbindir@
30 includedir =    @includedir@
31 libdir =        @libdir@
32 sysconfdir =    @sysconfdir@
33 localstatedir = @localstatedir@
34 mandir =        @mandir@
35 datarootdir =   @datarootdir@
37 DESTDIR =
39 @SET_MAKE@
41 top_builddir =  @BIND9_TOP_BUILDDIR@
43 ###
44 ### All
45 ###
46 ### Makefile may define:
47 ###     PREREQS
48 ###     TARGETS
50 all: ${PREREQS} subdirs ${TARGETS} testdirs
52 ###
53 ### Subdirectories
54 ###
55 ### Makefile may define:
56 ###     SUBDIRS
58 ALL_SUBDIRS = ${SUBDIRS} nulldir
59 ALL_TESTDIRS = ${TESTDIRS} nulldir
62 # We use a single-colon rule so that additional dependencies of
63 # subdirectories can be specified after the inclusion of this file.
64 # The "depend" and "testdirs" targets are treated the same way.
66 subdirs:
67         @for i in ${ALL_SUBDIRS}; do \
68                 if [ "$$i" != "nulldir" -a -d $$i ]; then \
69                         echo "making all in `pwd`/$$i"; \
70                         (cd $$i; ${MAKE} ${MAKEDEFS} DESTDIR="${DESTDIR}" all) || exit 1; \
71                 fi; \
72         done
75 # Tests are built after the targets instead of before
77 testdirs:
78         @for i in ${ALL_TESTDIRS}; do \
79                 if [ "$$i" != "nulldir" -a -d $$i ]; then \
80                         echo "making all in `pwd`/$$i"; \
81                         (cd $$i; ${MAKE} ${MAKEDEFS} DESTDIR="${DESTDIR}" all) || exit 1; \
82                 fi; \
83         done
85 install:: all
87 install clean distclean maintainer-clean doc docclean man manclean::
88         @for i in ${ALL_SUBDIRS} ${ALL_TESTDIRS}; do \
89                 if [ "$$i" != "nulldir" -a -d $$i ]; then \
90                         echo "making $@ in `pwd`/$$i"; \
91                         (cd $$i; ${MAKE} ${MAKEDEFS} DESTDIR="${DESTDIR}" $@) || exit 1; \
92                 fi; \
93         done
95 ###
96 ### C Programs
97 ###
98 ### Makefile must define
99 ###     CC
100 ### Makefile may define
101 ###     CFLAGS
102 ###     LDFLAGS
103 ###     CINCLUDES
104 ###     CDEFINES
105 ###     CWARNINGS
106 ### User may define externally
107 ###     EXT_CFLAGS
109 CC =            @CC@
110 CFLAGS =        @CFLAGS@
111 LDFLAGS =       @LDFLAGS@
112 STD_CINCLUDES = @STD_CINCLUDES@
113 STD_CDEFINES =  @STD_CDEFINES@
114 STD_CWARNINGS = @STD_CWARNINGS@
116 BUILD_CC = @BUILD_CC@
117 BUILD_CFLAGS = @BUILD_CFLAGS@
118 BUILD_CPPFLAGS = @BUILD_CPPFLAGS@
119 BUILD_LDFLAGS = @BUILD_LDFLAGS@
120 BUILD_LIBS = @BUILD_LIBS@
122 .SUFFIXES:
123 .SUFFIXES: .c .@O@
125 ALWAYS_INCLUDES = -I${top_builddir} -I${top_srcdir}
126 ALWAYS_DEFINES = @ALWAYS_DEFINES@
127 ALWAYS_WARNINGS =
129 ALL_CPPFLAGS = \
130         ${ALWAYS_INCLUDES} ${CINCLUDES} ${STD_CINCLUDES} \
131         ${ALWAYS_DEFINES} ${CDEFINES} ${STD_CDEFINES}
133 ALL_CFLAGS = ${EXT_CFLAGS} ${ALL_CPPFLAGS} ${CFLAGS} \
134         ${ALWAYS_WARNINGS} ${STD_CWARNINGS} ${CWARNINGS}
136 @BIND9_CO_RULE@
137         ${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -c $<
139 SHELL = @SHELL@
140 LIBTOOL = @LIBTOOL@
141 LIBTOOL_MODE_COMPILE = ${LIBTOOL} @LIBTOOL_MODE_COMPILE@
142 LIBTOOL_MODE_INSTALL = ${LIBTOOL} @LIBTOOL_MODE_INSTALL@
143 LIBTOOL_MODE_LINK = ${LIBTOOL} @LIBTOOL_MODE_LINK@
144 PURIFY = @PURIFY@
146 MKDEP = ${SHELL} ${top_builddir}/make/mkdep
149 ### This is a template compound command to build an executable binary with
150 ### an internal symbol table.
151 ### This process is tricky.  We first link all objects including a tentative
152 ### empty symbol table, then get a tentative list of symbols from the resulting
153 ### binary ($@tmp0).  Next, we re-link all objects, but this time with the
154 ### symbol table just created ($tmp@1).  The set of symbols should be the same,
155 ### but the corresponding addresses would be changed due to the difference on
156 ### the size of symbol tables.  So we create the symbol table and re-create the
157 ### objects once again.  Finally, we check the symbol table embedded in the
158 ### final binaryis consistent with the binary itself; otherwise the process is
159 ### terminated.
161 ### To minimize the overhead of creating symbol tables, the autoconf switch
162 ### --enable-symtable takes an argument so that the symbol table can be created
163 ### on a per application basis: unless the argument is set to "all", the symbol
164 ### table is created only when a shell (environment) variable "MAKE_SYMTABLE" is
165 ### set to a non-null value in the rule to build the executable binary.
167 ### Each Makefile.in that uses this macro is expected to define "LIBS" and
168 ### "NOSYMLIBS"; the former includes libisc with an empty symbol table, and
169 ### the latter includes libisc without the definition of a symbol table.
170 ### The rule to make the executable binary will look like this
171 ### binary@EXEEXT@: ${OBJS}
172 ###     #export MAKE_SYMTABLE="yes"; \  <- enable if symtable is always needed
173 ###     export BASEOBJS="${OBJS}"; \
174 ###     ${FINALBUILDCMD}
176 ### Normally, ${LIBS} includes all necessary libraries to build the binary;
177 ### there are some exceptions however, where the rule lists some of the
178 ### necessary libraries explicitly in addition to (or instead of) ${LIBS},
179 ### like this:
180 ### binary@EXEEXT@: ${OBJS}
181 ###     cc -o $@ ${OBJS} ${OTHERLIB1} ${OTHERLIB2} ${lIBS}
182 ### in order to modify such a rule to use this compound command, a separate
183 ### variable "LIBS0" should be deinfed for the explicitly listed libraries,
184 ### while making sure ${LIBS} still includes libisc.  So the above rule would
185 ### be modified as follows:
186 ### binary@EXEEXT@: ${OBJS}
187 ###     export BASEOBJS="${OBJS}"; \
188 ###     export LIBS0="${OTHERLIB1} ${OTHERLIB2}"; \
189 ###     ${FINALBUILDCMD}
190 ### See bin/check/Makefile.in for a complete example of the use of LIBS0.
192 FINALBUILDCMD = if [ X"${MKSYMTBL_PROGRAM}" = X -o X"$${MAKE_SYMTABLE:-${ALWAYS_MAKE_SYMTABLE}}" = X ] ; then \
193                 ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${ALL_CFLAGS} ${LDFLAGS} \
194                 -o $@ $${BASEOBJS} $${LIBS0} ${LIBS}; \
195         else \
196                 rm -f $@tmp0; \
197                 ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${ALL_CFLAGS} ${LDFLAGS} \
198                 -o $@tmp0 $${BASEOBJS} $${LIBS0} ${LIBS} || exit 1; \
199                 rm -f $@-symtbl.c $@-symtbl.@O@; \
200                 ${MKSYMTBL_PROGRAM} ${top_srcdir}/util/mksymtbl.pl \
201                 -o $@-symtbl.c $@tmp0 || exit 1; \
202                 $(MAKE) $@-symtbl.@O@ || exit 1; \
203                 rm -f $@tmp1; \
204                 ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${ALL_CFLAGS} ${LDFLAGS} \
205                 -o $@tmp1 $${BASEOBJS} $@-symtbl.@O@ $${LIBS0} ${NOSYMLIBS} || exit 1; \
206                 rm -f $@-symtbl.c $@-symtbl.@O@; \
207                 ${MKSYMTBL_PROGRAM} ${top_srcdir}/util/mksymtbl.pl \
208                 -o $@-symtbl.c $@tmp1 || exit 1; \
209                 $(MAKE) $@-symtbl.@O@ || exit 1; \
210                 ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${ALL_CFLAGS} ${LDFLAGS} \
211                 -o $@tmp2 $${BASEOBJS} $@-symtbl.@O@ $${LIBS0} ${NOSYMLIBS}; \
212                 ${MKSYMTBL_PROGRAM} ${top_srcdir}/util/mksymtbl.pl \
213                 -o $@-symtbl2.c $@tmp2; \
214                 count=0; \
215                 until diff $@-symtbl.c $@-symtbl2.c > /dev/null ; \
216                 do \
217                         count=`expr $$count + 1` ; \
218                         test $$count = 42 && exit 1 ; \
219                         rm -f $@-symtbl.c $@-symtbl.@O@; \
220                         ${MKSYMTBL_PROGRAM} ${top_srcdir}/util/mksymtbl.pl \
221                         -o $@-symtbl.c $@tmp2 || exit 1; \
222                         $(MAKE) $@-symtbl.@O@ || exit 1; \
223                         ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${ALL_CFLAGS} \
224                         ${LDFLAGS} -o $@tmp2 $${BASEOBJS} $@-symtbl.@O@ \
225                         $${LIBS0} ${NOSYMLIBS}; \
226                         ${MKSYMTBL_PROGRAM} ${top_srcdir}/util/mksymtbl.pl \
227                         -o $@-symtbl2.c $@tmp2; \
228                 done ; \
229                 mv $@tmp2 $@; \
230                 rm -f $@tmp0 $@tmp1 $@tmp2 $@-symtbl2.c; \
231         fi
233 cleandir: distclean
234 superclean: maintainer-clean
236 clean distclean maintainer-clean::
237         rm -f *.@O@ *.o *.lo *.la core *.core *-symtbl.c *tmp0 *tmp1 *tmp2
238         rm -rf .depend .libs
240 distclean maintainer-clean::
241         rm -f Makefile
243 depend:
244         @for i in ${ALL_SUBDIRS}; do \
245                 if [ "$$i" != "nulldir" -a -d $$i ]; then \
246                         echo "making depend in `pwd`/$$i"; \
247                         (cd $$i; ${MAKE} ${MAKEDEFS} DESTDIR="${DESTDIR}" $@) || exit 1; \
248                 fi; \
249         done
250         @if [ X"${srcdir}" != X. ] ; then \
251                 if [ X"${SRCS}" != X -a X"${PSRCS}" != X ] ; then \
252                         echo ${MKDEP} -vpath ${srcdir} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \
253                         ${MKDEP} -vpath ${srcdir} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \
254                         echo ${MKDEP} -vpath ${srcdir} -ap ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \
255                         ${MKDEP} -vpath ${srcdir} -ap ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \
256                         ${DEPENDEXTRA} \
257                 elif [ X"${SRCS}" != X ] ; then \
258                         echo ${MKDEP} -vpath ${srcdir} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \
259                         ${MKDEP} -vpath ${srcdir} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \
260                         ${DEPENDEXTRA} \
261                 elif [ X"${PSRCS}" != X ] ; then \
262                         echo ${MKDEP} -vpath ${srcdir} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \
263                         ${MKDEP} -vpath ${srcdir} -p ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \
264                         ${DEPENDEXTRA} \
265                 fi \
266         else \
267                 if [ X"${SRCS}" != X -a X"${PSRCS}" != X ] ; then \
268                         echo ${MKDEP} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \
269                         ${MKDEP} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \
270                         echo ${MKDEP} -ap ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \
271                         ${MKDEP} -ap ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \
272                         ${DEPENDEXTRA} \
273                 elif [ X"${SRCS}" != X ] ; then \
274                         echo ${MKDEP} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \
275                         ${MKDEP} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \
276                         ${DEPENDEXTRA} \
277                 elif [ X"${PSRCS}" != X ] ; then \
278                         echo ${MKDEP} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \
279                         ${MKDEP} -p ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \
280                         ${DEPENDEXTRA} \
281                 fi \
282         fi
284 FORCE:
287 ### Libraries
290 AR =            @AR@
291 ARFLAGS =       @ARFLAGS@
292 RANLIB =        @RANLIB@
295 ### Installation
298 INSTALL =               @INSTALL@
299 INSTALL_PROGRAM =       @INSTALL_PROGRAM@
300 LINK_PROGRAM =          @LN_S@
301 INSTALL_SCRIPT =        @INSTALL_SCRIPT@
302 INSTALL_DATA =          @INSTALL_DATA@
303 INSTALL_LIBRARY =       @INSTALL_LIBRARY@
306 ### Programs used when generating documentation.  It's ok for these
307 ### not to exist when not generating documentation.
310 XSLTPROC =              @XSLTPROC@ --novalid --xinclude --nonet
311 PERL =                  @PERL@
312 LATEX =                 @LATEX@
313 PDFLATEX =              @PDFLATEX@
314 W3M =                   @W3M@
317 ### Script language program used to create internal symbol tables
319 MKSYMTBL_PROGRAM =      @MKSYMTBL_PROGRAM@
322 ### Switch to create internal symbol table selectively
324 ALWAYS_MAKE_SYMTABLE =  @ALWAYS_MAKE_SYMTABLE@
327 ### DocBook -> HTML
328 ### DocBook -> man page
331 .SUFFIXES: .docbook .html .1 .2 .3 .4 .5 .6 .7 .8
333 .docbook.html:
334         ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-docbook-html.xsl $<
336 .docbook.1:
337         ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $<
339 .docbook.2:
340         ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $<
342 .docbook.3:
343         ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $<
345 .docbook.4:
346         ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $<
348 .docbook.5:
349         ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $<
351 .docbook.6:
352         ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $<
354 .docbook.7:
355         ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $<
357 .docbook.8:
358         ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $<