/* * dnsutl - utilities to make DNS easier to configure * Copyright (C) 1991-1993, 1995, 1996, 1999-2001, 2006, 2007 Peter Miller * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see * . */ /* * You may want to change some of these options. * ([debug] must be defined, even if empty, use comments.) * * Change ``main.h'' to add the DEBUG define. * All files reference this file, so this will cause recompilation * of all files, both in the change and in the baseline. */ debug = -g; /* * Unlink targets before running recipe bodies. */ set unlink; /* * Create directories above targets before running recipe bodies. */ set mkdir; /* * Update file times if necessary, to ensure outputs are newer then inputs. * On fast machines, that happens frequently for transitive dependencies. */ set time-adjust; /* * Make sure the [project], [change] and [version] variables are set. */ #ifndef project echo "The [project] variable was not set from the command line." set silent; echo "If you want to do a build with is not a development build" set silent; echo "or an integration build, use the make command, not cook." set silent; fail; #endif #ifndef change echo "The [change] variable was not set from the command line." set silent; echo "If you want to do a build with is not a development build" set silent; echo "or an integration build, use the make command, not cook." set silent; fail; #endif #ifndef version echo "The [version] variable was not set from the command line." set silent; echo "If you want to do a build with is not a development build" set silent; echo "or an integration build, use the make command, not cook." set silent; fail; #endif #ifndef arch echo "The [arch] variable was not set from the command line." set silent; echo "If you want to do a build with is not a development build" set silent; echo "or an integration build, use the make command, not cook." set silent; fail; #endif /* * The first item in search list should be the absolute path of the * current directory. Assume that it is. */ search_list = .; search_tmp = [tail [split ':' [search_path]]]; /* * Try to shorten the search path in command lines, too. * * This takes a little getting used to.... * 1. For development builds, the search path is dev dir, then branch bl, * then ... project bl. Thus, bl in a dev dir winds up pointing to * the branch repository. * 2. For integration builds, aegis deliberately omits the branch * baseline from the path, but include's the branch's parents and * ancestors. Thus, bl in an int dir winds up pointing to the * branch's parent's reporitory. * The idea is that integration builds in a branch are like a * development build of the branch's dev dir. */ search_name = bl; loop { search_dir = [head [search_tmp]]; if [not [search_dir]] then loopstop; search_tmp = [tail [search_tmp]]; if [not [exists [search_name]]] then ln -s [search_dir] [search_name] set clearstat; search_list = [search_list] [search_name]; search_name = [search_name]bl; } /* * If this is a development build, the version will be x.y.Czzz, * so look to see if there is a C in the version string. */ if [match_mask %1C%2 [version]] then { /* * The develop_begin_command in the config file * always creates the "bl" symbolic link. */ baseline = bl; } if [not [defined baseline]] then { /* * Turn on aggressive updating to ensure the smallest possible * range of mod times at aeipass. This also ensures mod time * consistency on fast machines. */ set time-adjust-back; } else { /* * Use finger prints for development builds. * They avoid much of the tedium. */ set fingerprint; } /* * determine the short version: * no change or delta number */ version_short = [fromto %1.C%2 %1 [subst D C [version]]]; version_shorter = [split "." [version_short]] _ _; version_shorter = [unsplit "." [word 1 [version_shorter]] [word 2 [version_shorter]]]; project_short = [fromto %.[version_short] % [project]]; project_minus = [project_short]-[version_short]; /* * This file is generated by autoconf. * It is architecture specific. * If it is not found (not cooked yet) the following * symbols will be undefined. * * Must be included *after* the search_list is defined. */ #include-cooked [arch]/etc/Howto.conf if [not [defined prefix]] then prefix = /usr/local; if [not [defined exec_prefix]] then exec_prefix = [prefix]; if [not [defined yacc]] then yacc = yacc; if [not [defined libs]] then libs = ; if [not [defined cc]] then cc = ['if' [find_command gcc] 'then' gcc 'else' cc]; /* * The default recipe */ all = [arch]/common/config.h [arch]/Makefile ; all: [all]; /* * The source files. * This is given to us by aegis. */ vs_file = common/patchlevel.h; change_files = [collect aegis -l chafil -ter -p [project] -c [change]] [vs_file] ; project_files = [collect aegis -l profil -ter -p [project] -c [change]] ; source_files = [sort [stringset [project_files] [change_files]]] ; version_obj_file = [arch]/common/version-stmp.o; common_lib_obj = [stringset [fromto common/%0%.c [arch]/common/%0%.o [match_mask common/%0%.c [source_files]] ] [fromto common/%0%.y [arch]/common/%0%.gen.o [match_mask common/%0%.y [source_files]] ] - [version_obj_file] ] ; common_obj = [arch]/common/libcommon.a [version_obj_file] ; /* * Form the list of commands from the source file names. * This means we don't need to change the cookbook for every new command. */ commands = [fromto %/main.c % [match_mask dns%/main.c [source_files]]]; loop cmd = [commands] { all += [arch]/bin/[cmd]; [cmd]_obj = [fromto [cmd]/%0%.c [arch]/[cmd]/%0%.o [match_mask [cmd]/%0%.c [source_files]] ] [fromto [cmd]/%0%.y [arch]/[cmd]/%0%.gen.o [match_mask [cmd]/%0%.y [source_files]] ] [common_obj] ; } /* * how to compile C sources */ cc = cc; cc_flags = -O2 [debug]; cc_include_flags = ; /* * this next section is for gcc * comment it out if you don't have gcc * * The gcc include files MUST be first. */ cc = gcc; cc_flags += -ansi -Wall -Wextra -Wwrite-strings -Wold-style-definition -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith; /* * For development builds, on the primary architecture, all warnings are * to be treated as errors; this ensures the cleanest possible code. */ if [defined baseline] then if [in [arch] linux-i386] then cc_flags += -Werror; /* * include files from common */ cc_include_flags = [cc_include_flags] [prepost -I /[arch]/common [search_list]] [prepost -I /common [search_list]] ; /* * build .o from .c */ [arch]/%1/%0%2.o: %1/%0%2.c { if [defined %2_flags] then extra = [%2_flags]; else extra = ; [cc] [stringset [prepost -I /[arch]/%1 [search_list]] [prepost -I /%1 [search_list]] [cc_include_flags] ] [stringset [cc_flags] [extra]] -c [resolve %1/%0%2.c] ['if' [in gcc [cc]] 'then' -o [target]] ; if [not [in gcc [cc]]] then mv %2.o %1/%0%2.o; } /* * build the program */ [arch]/bin/%: [%_obj] { [cc] [debug] -o [target] [resolve [%_obj]] [libs]; chmod og\=u-w [target]; } /* * There is a special list of files you must use, in preference to the * standard C files. This ensures appropriate operating system insulation * is always in place. */ c_incl_excludes = [fromto common/ac/%0%.h -ex\=%0%.h [match_mask common/ac/%0%.h [source_files]] ]; %1/%0%2.c.d: %1/%0%2.c set no-cascade { c_incl -nc /* no cache */ -ns /* no system headers */ -eia /* empty if absent */ -nrec /* no recursion */ [stringset [prepost -I /[arch]/%1 [search_list]] [prepost -I /%1 [search_list]] [cc_include_flags] ] -prefix "'cascade %1/%0%2.c ='" -suffix "';'" [resolve %1/%0%2.c] -nsri /* no source relative includes */ [prepost "-rlp=" "" [search_list]] /* remove leading path */ /* -rlp [arch] / * remove leading architecture */ ['if' [not [filter common/ac/%%0%% %1/%0%2.c]] 'then' [c_incl_excludes]] -o [target]; } %1/%0%2.h.d: %1/%0%2.h: [arch]/common/config.h set no-cascade { c_incl -nc /* no cache */ -ns /* no system headers */ -eia /* empty if absent */ -nrec /* no recursion */ [stringset [prepost -I /[arch]/%1 [search_list]] [prepost -I /%1 [search_list]] [cc_include_flags] ] -prefix "'cascade %1/%0%2.c ='" -suffix "';'" [resolve %1/%0%2.h] -nsri /* no source relative includes */ [prepost "-rlp=" "" [search_list]] /* remove leading path */ /* -rlp [arch] / * remove leading architecture */ ['if' [not [filter common/ac/%%0%% %1/%0%2.h]] 'then' [c_incl_excludes]] -o [target]; } c-dep-files = [fromto %0%.c %0%.c.d [match_mask %0%.c [source_files]]] [fromto %0%.y %0%.gen.c.d [match_mask %0%.y [source_files]]] ; h-dep-files = [fromto %0% %0%.d [match_mask %0%.h [source_files]]] [fromto %0%.y %0%.gen.h.d [match_mask %0%.y [source_files]]] ; ac-h-files = [match_mask common/ac/%0%.h [source_files]] ; #if [count [ac-h-files]] cascade [ac-h-files] = [arch]/common/config.h; #endif #include-cooked-nowarn [c-dep-files] [h-dep-files] /* * The version stamp is to be updated for every * integration and development build. * (The integrate_begin_command in the config file * deletes them for integration builds.) */ function copyright_years = { return [collect aegis -list version -p [project] -c [change] | gawk "-F'[[\\\\]]'" "'/^copyright_years/{print $2}'" ]; } [vs_file]: set shallow { echo "'#define PATCHLEVEL \""[version]"\"'" > [target]; echo "'#define COPYRIGHT_YEARS \""[copyright_years]"\"'" >> [target]; } etc/version.so: set ['if' [not [defined baseline]] 'then' shallow] { echo "'.ds V) "[version]"'" > etc/version.so; echo "'.ds v) "[version_short]"'" >> etc/version.so; /* aegis -list version -p [project] -c [change] | gawk -F'\'"\'' "'/previous/{print $2}'" | gawk -F. "'{print \".ds w) \"$1\".\"$2}'" >> etc/version.so; */ echo "'.ds Y) "[copyright_years]"'" >> etc/version.so; } /* * building a library of the common directory */ ranlib = [find_command ranlib]; [arch]/%/lib%.a: [%_lib_obj] { ar cq [target] [resolve [%_lib_obj]]; if [ranlib] then [ranlib] [target]; } /* * Catch 22: need to know you need to include them, so you can check to * see if you need to include them. Sigh. */ cascade man1/copyright.so = etc/version.so; cascade man1/BUILDING.so = etc/version.so; cascade common/version-stmp.c = [vs_file]; cascade dns-boot-check/lex.c = dns-boot-check/gram.gen.h; /* * documentation and stuff */ #include-cooked etc/documents.cook /* * archive stuff */ #include-cooked etc/archive.cook /* * autoconf stuff */ #include-cooked etc/autoconf.cook /* * yacc stuff */ #include-cooked etc/yacc.cook #include-cooked etc/tags.cook gram.gen_flags = - -Werror;