/* * srecord - manipulate eprom load files * Copyright (C) 1998, 1999, 2001-2003, 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 * . */ set mkdir; set unlink; set time-adjust; awk = gawk; /* * 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 [search_name]]] then ln -s [search_dir] [search_name] set clearstat; search_list = [search_list] [search_name]; search_name = [search_name]bl; } /* * 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]; change_source_files = ; #include-cooked-nowarn etc/cook/change_files.[version] etc/cook/change_files.[version]: set shallow nodefault { echo "'change_source_files ='" > [target]; aegis -l cf -p [project] -c [change] -terse >> [target]; echo "';'" >> [target]; } project_source_files = ; #include-cooked-nowarn etc/cook/project_files.[version] etc/cook/project_files.[version]: set shallow nodefault { echo "'project_source_files ='" > [target]; aegis -l pf -p [project] -c [change] -terse >> [target]; echo "';'" >> [target]; } source_files = [sort [project_source_files] [change_source_files]]; /* * Speed up graph building by stating the leaves explictly. * This also gives more useful error messages. */ if [count [project_source_files]] then if [count [change_source_files]] then { leaf_file_accept = [project_source_files] [change_source_files]; leaf_pattern_accept = /%0%; } debug = /* -g */ ; /* g++ takes forever if you say -g for complex template usage */ all = ; /* the right hand side is deferred until triggered */ all: [all]; /* * Howto use GNU Autoconf. */ #include-cooked etc/autoconf.cook /* * The files which are linked to form the common library for the programs. */ lib/[project_short]_obj = [fromto %0%.cc [arch]/%0%.o [match_mask lib/%0%.cc [source_files]]] ; /* * Generate lists of object files for programs */ program_list = [fromto %1/%2 %1 [match_mask %/main.cc [source_files]]]; loop program = [program_list] { [program]_obj = [fromto %0%.cc [arch]/%0%.o [match_mask [program]/%0%.cc [source_files]] ]; [program]_libs = [arch]/lib/lib[project_short].a ; all += [arch]/bin/[program] ; } if [match %1C%2 [version]] then { baseline = bl; } else { /* * this is essential so that aeipass does the right thing * * It also means that generated files (e.g. from objen) have consistent * mod-times after integration, sop everythign does not immediately * re-build. */ set time-adjust-back; all = [all] integration-build-targets; } /* * Note: this must come *after* the etc/autoconf.cook include. */ if [not [defined c++]] then c++ = g++; cc_include_flags = [prepost "-I" "" [search_list]] [prepost "-I" /[arch] [search_list]] ; if [not [defined c++_flags]] then c++_flags = -O [debug]; c++_flags = [c++_flags] -Wall -Wextra -Werror; if [not [defined ld_flags]] then ld_flags = [debug]; [arch]/%0%.o: %0%.c { [cc] [cc_include_flags] [cc_flags] -c [resolve %0%.c] -o [target]; } [arch]/%0%.o: %0%.cc { [c++] [cc_include_flags] [c++_flags] -c [resolve %0%.cc] -o [target] set meter; } c_incl = c_incl; %0%.c.d: %0%.c set no-cascade { [c_incl] -nc -ns -nrec [cc_include_flags] [resolve %0%.c] -prefix "'cascade %0%.c ='" -suffix "';'" -nsri [prepost "-rlp=" "" [search_list]] -slp [arch] "'[arch]'" -o [target]; } %0%.c,M:: %0%.c,Md; %0%.c,Md: %0%.c : etc/Makefile.file.sh { [c_incl] -nc -ns [cc_include_flags] [resolve %0%.c] -nsri [prepost "-rlp=" "" [search_list]] -slp [arch] "'[arch]'" -o [target]; } %0%.h.d: %0%.h set no-cascade { [c_incl] -nc -ns -nrec [cc_include_flags] [resolve %0%.h] -prefix "'cascade %0%.h ='" -suffix "';'" -nsri [prepost "-rlp=" "" [search_list]] -slp [arch] "'[arch]'" -o [target]; } %0%.cc.d: %0%.cc set no-cascade { [c_incl] -nc -ns -nrec [cc_include_flags] [resolve %0%.cc] -prefix "'cascade %0%.cc ='" -suffix "';'" -nsri [prepost "-rlp=" "" [search_list]] -slp [arch] "'[arch]'" -o [target]; } %0%.cc,M:: %0%.cc,Md; %0%.cc,Md: %0%.cc : etc/Makefile.file.sh { [c_incl] -nc -ns [cc_include_flags] [resolve %0%.cc] -nsri [prepost "-rlp=" "" [search_list]] -slp [arch] "'[arch]'" -o [target]; } cc_dep_files = [fromto %0%.c %0%.c.d [match_mask %1/%0%.c [source_files]]] [fromto %0%.h %0%.h.d [match_mask %1/%0%.h [source_files]]] [fromto %0%.cc %0%.cc.d [match_mask %1/%0%.cc [source_files]]] [fromto %0%.y %0%.gen.c.d [match_mask %1/%0%.y [source_files]]] ; #include-cooked-nowarn [cc_dep_files] [arch]/bin/%: : [%_obj] [%_libs] { [c++] [ld_flags] -o [target] [resolve [%_obj] [%_libs]] -lm; } [arch]/%0lib%.a: : [%0%_obj] { ar cq [target] [resolve [%0%_obj]]; if [find_command ranlib] then ranlib [target]; } /* * How to build the release sets. */ #include-cooked etc/archive.cook /* * How to build the documentation. */ #include-cooked etc/documentation.cook /* * Explicit include dependencies. */ #if [count [cc_dep_files]] [cc_dep_files]: [arch]/lib/config.h; #endif /* * 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.) */ lib/patchlevel.h: set shallow { copyright_years = [collect aegis -list version -p [project] -c [change] | [awk] "-F'[[\\\\]]'" "'/^copyright_years/{print $2}'" ]; echo "'#define PATCHLEVEL \""[version]"\"'" > [target]; echo "'#define COPYRIGHT_YEARS \""[copyright_years]"\"'" >> [target]; } /* * Build the version include, but not too often. */ etc/version.so: set ['if' [or [not [defined baseline] ] [not [exists bl/etc/version.so ] ] ] 'then' shallow] { copyright_years = [collect aegis -list version -p [project] -c [change] | [awk] "-F'[[\\\\]]'" "'/^copyright_years/{print $2}'" ]; echo "'.ds V) "[version]"'" > [target]; echo "'.ds v) "[version_short]"'" >> [target]; aegis -list version -p [project] -c [change] | [awk] -F'\'"\'' "'/previous/{print $2}'" | [awk] -F. "'{print \".ds w) \"$1\".\"$2}'" >> [target]; echo "'.ds Y) "[copyright_years]"'" >> [target]; } /* * Catch 22: If the relationship between a target and a derived ingredient * appears only in a derived cookbook, it is likely that a clean build * (solely from primary source files) will fail. It is recommended that * relationships such as this be placed in a primary source cookbook. */ cascade etc/BUILDING.man = etc/version.so ; cascade etc/README.man = etc/version.so etc/new.so; cascade etc/change_log.man = etc/version.so etc/new.so; cascade etc/reference.man = etc/version.so ; cascade etc/srecord.lsm = etc/version.so ; cascade lib/versn_stamp.cc = lib/patchlevel.h ; cascade man/man1/z_copyright.so = etc/version.so ; #include [resolve etc/doxygen.cook etc/metrics.cook etc/tags.cook ]