1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
|
/*
* NAME
* library - construct a library
*
* DESCRIPTION
* This cookbook defines how to construct a library.
*
* If an include file (or files) are defined for this file,
* you will have to append them to [install] in your Howto.cook file.
*
* VARIABLES
* all targets of the all recipe
* install targets of the install recipe
* me the name of the library to be constructed.
* Defaults to the last component of the pathname
* of the current directory.
* ar The archive command.
* install targets of the install command.
*
* RECIPES
* all: construct the targets defined in [all].
* clean: remove the files named in [dot_clean].
* clobber: remove the files name in [dot_clean] and [all].
*
* If the [lib] variable is defined
* install: construct the files named in [install].
* uninstall: remove the files named in [install].
*
* MANIFEST: cookbook for constructing libraries
*/
#pragma once
if [not [defined dot_obj]] then
{
echo "'The [dot_obj] variable is not set.'" set silent;
echo "'You probably want to use the \"c\" or \"f77\" cookbook'"
set silent;
echo "'before you use the \"library\" cookbook.'" set silent;
fail;
}
if [not [defined ar]] then
ar = [find_command ar];
if [not [defined ranlib]] then
ranlib = [find_command ranlib];
if [not [defined me]] then
me = [entryname [dir [pathname x]]];
all = lib[me].a;
if [defined dot_lint_obj] then
if [find_command [lint]] then
all = [all] llib-l[me].ln;
all: [all];
clean:
{
rm -f [dot_clean]
set clearstat;
}
clobber: clean
{
rm -f [all]
set clearstat;
}
if [defined lib] then
{
if [not [defined install]] then
install = ;
install = [install] [lib]/lib[me].a;
if [defined dot_lint_obj] then
install = [install] [lib]/llib-l[me].ln;
[lib]/%: %
{
cp -p % [lib]/%;
chmod og-w [lib]/%;
}
}
if [defined include] then
{
if [not [defined install]] then
install = ;
install = [install] [include]/[me].h;
[include]/%: %
{
cp -p % [include]/%;
chmod og-w [include]/%;
}
}
if [defined install] then
{
install: [install];
uninstall:
{
rm -f [install]
set clearstat;
}
}
lib[me].a: [dot_obj]
set unlink
{
[ar] r [target] [dot_obj];
if [ranlib] then
[ranlib] [target];
}
if [defined dot_lint_obj] then
{
llib-l[me].ln: [dot_lint_obj]
{
[lint] [dot_lint_obj] -o [me];
}
}
|