/* * vii - buffer and display outout * Copyright (C) 1991-1995, 1999, 2001, 2003, 2005 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 2 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. * * MANIFEST: instructions to cook(1), how to build project */ /* * Turn on updating to ensure mod-time * consistency on fast machines. */ set time-adjust; /* * Create directories before running recipe bodies. */ set mkdir; /* * Remove targets before running recipe bodies. */ set unlink; /* * 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 */ ; /* * Make sure the [project], [change], [version] and [arch] 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 which 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 which 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 which 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 which is not a development build" set silent; echo "or an integration build, use the make command, not cook." set silent; fail; #endif #ifndef search_path echo "The [search_path] variable was not set from the command line." set silent; echo "If you want to do a build which 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 reporitory. * 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-symlink [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; /* * Supplement file modification times with fingerprints. * Only do this for development builds. */ set fingerprint; } /* * determine the short version: * no change or delta number */ version_short = [fromto %1.%2.%3 %1.%2 [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]; 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; } /* * 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-nowarn [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]/bin/vii doc.targets ; /* * Integration builds also make the shar files for distribution. */ if [defined change] then if [not [defined baseline]] then all += integration-build-targets; integration-build-targets: [integration-build-targets]; integration-build-targets = special ; all: [all] set default ; /* * 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]] ; project_files = [collect aegis -l profil -ter -p [project] -c [change]] ; source_files = [sort [stringset [project_files] [change_files]]] ; version_obj = [arch]/common/version_stmp.o; common_obj = [arch]/common/lib.a [version_obj]; common_lib = [stringset [fromto common/%.c [arch]/common/%.o [match_mask common/%.c [source_files]] ] - [version_obj] ]; vii_obj = [sort [fromto vii/%0%.y [arch]/vii/%0%.gen.o [match_mask vii/%0%.y [source_files]] ] [fromto vii/%0%.c [arch]/vii/%0%.o [match_mask vii/%0%.c [source_files]] ] ] [common_obj] ; txt2c_obj = [fromto txt2c/%.c [arch]/txt2c/%.o [match_mask txt2c/%.c [source_files]] ] [arch]/common/ac/string.o [arch]/common/arglex.o [arch]/common/error.o [arch]/common/mem.o [arch]/common/mprintf.o [arch]/common/option.o [arch]/common/str.o [arch]/common/trace.o ; ssp_obj = [fromto ssp/%.c [arch]/ssp/%.o [match_mask ssp/%.c [source_files]] ] [arch]/common/lib.a ; source_files_build = [collect ( aegis -l pf -p [project] -c [change] -unf ';' aegis -l cf -p [project] -c [change] -unf ) | gawk "'/^build/{print $NF}'" ] ; source_files_non_build = [stringset [source_files] - [source_files_build]]; /* * how to compile C sources */ cc_flags = -O [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. */ if [in [cc] gcc] then cc_flags = [cc_flags] -ansi -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wmissing-declarations -Wpointer-arith -Werror; /* * include files from common */ cc_include_flags = [cc_include_flags] [prepost "-I" "/"[arch]"/common" [search_list]] [prepost "-I" "/common" [search_list]] ; /* * 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]] ]; /* * Build %1/%2.o from %1/%2.c */ [arch]/%1/%0%2.o: [arch]/%1/%0%2.c { if [defined %2_flags] then extra = [%2_flags]; else extra = ; [cc] [cc_flags] [extra] [stringset [cc_include_flags] [prepost "-I" /[arch]/%1 [search_list]] [prepost "-I" "/%1" [search_list]] ] -c [resolve [arch]/%1/%0%2.c] ['if' [in gcc [cc]] 'then' -o [target]]; if [not [in gcc [cc]]] then mv %2.o [target]; } [arch]/%1/%0%2.o: %1/%0%2.c { if [defined %2_flags] then extra = [%2_flags]; else extra = ; [cc] [cc_flags] [extra] [stringset [cc_include_flags] [prepost "-I" /[arch]/%1 [search_list]] [prepost "-I" "/%1" [search_list]] ] -c [resolve %1/%0%2.c] ['if' [in gcc [cc]] 'then' -o [target]]; if [not [in gcc [cc]]] then mv %2.o [target]; } %1/%0%2.c.d: %1/%0%2.c set no-cascade { c_incl -nc -ns -eia -nrec [stringset [prepost "-I" "/%1" [search_list]] [cc_include_flags] ] -prefix "'cascade %1/%0%2.c ='" -suffix "';'" [resolve %1/%0%2.c] [addprefix -rlp\= [search_list]] -slp [arch] "'[arch]'" -nsri ['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 set no-cascade { c_incl -nc -ns -eia -nrec [stringset [prepost "-I" "/%1" [search_list]] [cc_include_flags] ] -prefix "'cascade %1/%0%2.h ='" -suffix "';'" [resolve %1/%0%2.h] [addprefix -rlp\= [search_list]] -slp [arch] "'[arch]'" -nsri ['if' [not [filter common/ac/%%0%% %1/%0%2.h]] 'then' [c_incl_excludes]] -o [target]; } %1/%0%2.c.d: [arch]/%1/%0%2.c set no-cascade { c_incl -nc -ns -eia -nrec [stringset [prepost "-I" "/%1" [search_list]] [cc_include_flags] ] -prefix "'cascade [arch]/%1/%0%2.c ='" -suffix "';'" [resolve [arch]/%1/%0%2.c] [addprefix -rlp\= [search_list]] -slp [arch] "'[arch]'" -nsri ['if' [not [filter common/ac/%%0%% %1/%0%2.h]] 'then' [c_incl_excludes]] -o [target]; } %0%.c,M:: %0%.c,Md; %1/%0%2.c,Md: %1/%0%2.c { c_incl -nc /* no cache */ -ns /* no system */ -eia /* empty if absent */ [stringset [prepost "-I" "/%1" [search_list]] [cc_include_flags] ] [resolve %1/%0%2.c] -nsri /* no source relative includes */ [prepost "-rlp=" "" [search_list]] /* remove leading path */ -rlp [arch] /* remove leading architecture */ -o [target]; } c-dep-files = [addsuffix .d [match_mask %0%.c [source_files]]] [addsuffix .d [match_mask %0%.h [source_files]]] [fromto %1/%0%2.y %1/%0%2.gen.c.d [match_mask %1/%0%2.y [source_files]]] ; [c-dep-files]: [arch]/common/config.h; #if [count [c-dep-files]] #include-cooked-nowarn [c-dep-files] #endif /* * A few explicit things, to make sure the .d files * are constructed correctly. Sigh. */ cascade common/help.c = [arch]/man1/o__rules.h [arch]/man1/z_exit.h; cascade vii/main.c = [arch]/man1/vii.h; cascade common/ac/ctype.h = [arch]/common/config.h; cascade common/ac/errno.h = [arch]/common/config.h; cascade common/ac/limits.h = [arch]/common/config.h; cascade common/ac/signal.h = [arch]/common/config.h; cascade common/ac/stdarg.h = [arch]/common/config.h; cascade common/ac/stddef.h = [arch]/common/config.h; cascade common/ac/stdio.h = [arch]/common/config.h; cascade common/ac/stdlib.h = [arch]/common/config.h; cascade common/ac/string.h = [arch]/common/config.h; cascade common/ac/termios.h = [arch]/common/config.h; cascade common/ac/time.h = [arch]/common/config.h; cascade common/ac/unistd.h = [arch]/common/config.h; /* * How to use yacc sources. */ yacc_flags = ; %1/%0%2.gen.c %1/%0%2.gen.h: %1/%0%2.y { rm -f %1/%0%2.list y.output set silent; [yacc] -d [yacc_flags] [resolve %1/%0%2.y]; sed "'s/[yY][yY]/%2_/g'" < y.tab.c > %1/%0%2.gen.c; rm y.tab.c; sed "'s/[yY][yY]/%2_/g'" < y.tab.h > %1/%0%2.gen.h; rm y.tab.h; if [exists y.output] then mv y.output %1/%0%2.list set clearstat; } ranlib = [find_command ranlib]; [arch]/common/lib.a: [common_lib] { ar qc [target] [resolve [common_lib]]; if [ranlib] then [ranlib] [target]; } /* * build the programs from their objects */ [arch]/bin/%: [%_obj] { [cc] -o [target] [resolve [%_obj]] [libs]; chmod 755 [target]; /* * aegis itself must be set-uid-root */ if [defined baseline] then if [in [target] [arch]/bin/aegis] then { su1 sh -c "'chown root "[target]" && chmod u+s "[target]"'" set errok; } } /* * building things which require txt2c to build * * Build %.h from %.1 */ [arch]/man1/%.h: man1/%.1: [arch]/bin/txt2c { [resolve [arch]/bin/txt2c] [resolve man1/%.1] [target]; } [arch]/man1/%.h: man1/%.so: [arch]/bin/txt2c { [resolve [arch]/bin/txt2c] [resolve man1/%.so] [target]; } /* * The version stamp is to be updated for every * integration and development build. */ copyright_years = [collect aegis -list version -p [project] -c [change] | gawk "-F'[[\\\\]]'" "'/^copyright_years/{print $2}'" ]; [vs_file]: set shallow { echo "'#define PATCHLEVEL \""[version]"\"'" > [target] set clearstat; echo "'#define COPYRIGHT_YEARS \""[copyright_years]"\"'" >> [target]; } etc/version.so: set ['if' [or [not [defined baseline] ] [not [exists bl/etc/version.so ] ] ] 'then' shallow] { echo \".ds V) [version]\" > [target]; echo \".ds v) [version_short]\" >> [target]; aegis -list version -p [project] -c [change] | gawk -F'\'"\'' "'/previous/{print $2}'" | gawk -F. "'{print \".ds w) \"$1\".\"$2}'" >> [target]; echo \".ds Y) [copyright_years]\" >> [target]; } etc/new.so: set ['if' [or [not [defined baseline] ] [not [exists bl/etc/version.so ] ] ] 'then' shallow] { echo \"[version]\" | gawk -F. "'{print \".so new.\"$1\".\"$2\".so\"}'" > [target]; } /* * These recipes build a Makefile for a user. They do not build a * Makefile useful for a development build, because no arch * information is included in the Makefile. */ makefile-per-file = [prepost "" ",M" [source_files]]; Makefile.in: etc/Makefile.head etc/Makefile.sh etc/Makefile.awk [vs_file] [makefile-per-file] { if [exists [target]] then rm [target] set clearstat; cat [resolve etc/Makefile.head [makefile-per-file]] > [target]; sh [resolve etc/Makefile.sh] [source_files] | gawk -f [resolve etc/Makefile.awk] >> [target]; } %0%,M: etc/Makefi.file.sh etc/Makefile.awk { depfile = [match_mask %%0%%,Md [need]]; sh [resolve etc/Makefi.file.sh] %0% [resolve %0%] [resolve [depfile]] | gawk -f [resolve etc/Makefile.awk] > [target]; } /* * formatting documents and manual entries */ doc.targets: cat txt; /* * manual entries */ cat = [fromto man%1/%2.%1 cat%1/%2.%1 [match_mask man%1/%2.%1 [source_files]]] /* [fromto man1/%.1 man1/%.h [match_mask man1/%.1 [source_files]]] [fromto man1/%.so man1/%.h [match_mask man1/%.so [source_files]]] */ ; cat: [cat]; cat%1/%2.%1: man%1/%2.%1 { roffpp [prepost "-I" "/man%1" [search_list]] [resolve man%1/%2.%1] | groff -Tascii -P-h -t -man > cat%1/%2.%1; } man%1/%2.d: man%1/%2.%1 { c_incl -nc -ns -eia -r [stringset [cc_include_flags] [prepost "-I" "/man%1" [search_list]] ] -prefix "'cat%1/%2.%1 man%1/%2.%1,M man%1/%2.d: man%1/%2.%1'" -suffix "'set nodefault;'" [resolve man%1/%2.%1] [addprefix -rlp\= [search_list]] -slp [arch] "'[arch]'" -o [target]; } man-dep-files = [fromto man%1/%2.%1 man%1/%2.d [match_mask man%1/%2.%1 [source_files]]] ; #include-cooked-nowarn [man-dep-files] /* * user manuals */ txt = [fromto doc/%.ms doc/%.ps.gz [match_mask doc/%.ms [source_files]]] [fromto doc/%.mm doc/%.ps.gz [match_mask doc/%.mm [source_files]]] ; txt: [txt]; doc/%.ps.gz: doc/%.ms { roffpp [prepost "-I" "/doc" [search_list]] [resolve doc/%.ms] | groff -p -t -ms | gzip > [target]; } doc/%.ps.gz: doc/%.mm { roffpp [prepost "-I" "/doc" [search_list]] [resolve doc/%.mm] | groff -p -t -mm | gzip > [target]; } doc/%.d: doc/%.ms { c_incl -nc -ns -eia -r [stringset [cc_include_flags] [prepost "-I" "/doc" [search_list]] ] -prefix "'doc/%.ps.gz doc/%.ms,M doc/%.d: doc/%.ms'" -suffix "'set nodefault;'" [resolve doc/%.ms] [addprefix -rlp\= [search_list]] -slp [arch] "'[arch]'" -o [target]; } doc/%.d: doc/%.mm { c_incl -nc -ns -eia -r [stringset [cc_include_flags] [prepost "-I" "/doc" [search_list]] ] -prefix "'doc/%.ps.gz doc/%.mm,M doc/%.d: doc/%.mm'" -suffix "'set nodefault;'" [resolve doc/%.mm] [addprefix -rlp\= [search_list]] -slp [arch] "'[arch]'" -o [target]; } doc-dep-files = [fromto doc/%.ms doc/%.d [match_mask doc/%.ms [source_files]]] [fromto doc/%.mm doc/%.d [match_mask doc/%.mm [source_files]]] ; #include-cooked-nowarn [doc-dep-files] /* * specials */ special: [fromto etc/%.man % [match_mask etc/%.man [source_files]]] ; %: etc/%.man { if [exists [target]] then rm -f [target] set clearstat; roffpp [prepost "-I" "/etc" [search_list]] [resolve etc/%.man] | groff -Tascii -P-hub -t -man > [target]; } etc/%.d: etc/%.man { c_incl -nc -ns -eia -r [stringset [cc_include_flags] [prepost "-I" "/etc" [search_list]] ] -prefix "'% etc/%.man,M etc/%.d: etc/%.man'" -suffix "'set nodefault;'" [resolve etc/%.man] [addprefix -rlp\= [search_list]] -slp [arch] "'[arch]'" -o [target]; } etc-dep-files = [fromto etc/%.man etc/%.d [match_mask etc/%.man [source_files]]] ; #include-cooked-nowarn [etc-dep-files] etc/CHANGES.[version_short]: etc/CHANGES.sh [vs_file] { if [exists [target]] then rm [target] set clearstat; sh [resolve etc/CHANGES.sh] [project] > [target]; } /* * Make sure this directory is here, * otherwise the "../man1/?????.h" include files will * be found in the baseline. */ #ifdef baseline if [not [exists [arch]/common]] then mkdir -p [arch]/common set clearstat; #endif #include [resolve etc/autoconf.cook] #include [resolve etc/archive.cook]