[Cook] stupid questions

Fredrick Paul Eisele phreed at netarx.com
Tue Dec 17 01:24:56 EST 2002


There are a couple ways.
Here is one.
It makes use of proxy targets.

Aryeh M. Friedman wrote:

>There is something that it seems like cook whould be able to do but
>I can not figure out how:
>
>Files:
>
>src/libA
>	foo.cpp
>	unit_test.cpp
>
>src/libB
>	ack.cpp (includes include/libA.h)
>	unit_test.cpp
>
>prog/progA
>	progA.cpp (includes include/libA.h and include/libB.h)
>	testA.cpp
>
>include
>	foo.h
>	ack.h
>
>What cook needs to do (in this EXACT order):
>
>1) compile libA/foo.cpp
>2) compile libA/unit_test.cpp into libA/unit_test and run libA/unit_test if 
>   it has an exit status except 0 terminate cook
>3) build/install the libA.a file from foo.o and put it in lib/libA.a
>4) concatinate all header files for libA (include/foo.h) into include/libA.h
>
libA/foo.o: libA/foo.cpp
{
    1) compile libA/foo.cpp
}

libA/unit_test_run: libA/foo.o libA/unit_test.cpp
{
    2a) compile libA/unit_test.cpp into libA/unit_test
    2b) run libA/unit_test if set noerrok;
touch [target];
}

lib/libA.a: libA/foo.o libA/unit_test_run
{
    3) build/install the libA.a file from foo.o and put it in lib/libA.a
}

include/libA.h.1: include/foo.h
{
    4a) concatinate all header files for libA (include/foo.h) into 
include/libA.h
ln -sf include/libA.h [target] (or touch [target])
}

>include/libA.h
>
>then and ONLY then do:
>
>5) compile libB/ack.cpp
>6) compile libB/unit_test.cpp into libB/unit_test and run libB/unit_test if 
>   it has an exit status except 0 terminate cook
>7) build/install the libB.a file from ack.o and put it in lib/libB.a
>8) concatinate all header files for libB (include/ack.h) into include/libA.h
>
then_and_only_then: include/libA.h.1 lib/libA.a libA/unit_test_run libA/foo.o;

libB/ack.o: libB/ack.cpp then_and_only_then
{
	5) compile libB/ack.cpp
}

libB/unit_test: libB/ack.o
{
	6a) compile libB/unit_test.cpp into libB/unit_test 
	6b) and run libB/unit_test set noerrok;
touch [target];
}

include/libB.a: ack.o
{
	7) build/install the libB.a file from ack.o and put it in lib/libB.a
}

include/libA.h.2: include/ack.h include/ack.h
{
	8) concatinate all header files for libB (include/ack.h) into include/libA.h
ln -sf include/libA.h [target] (or touch [target])
}


>
>finally:
>
>9) compile progA/progA.cpp
>10) link progA/progA.o against lib/libA.a and lib/libB.a produce progA/porgA
>   and copy it to bin/progA
>11) repeat step 9 and 10 for progA/testA
>12) run bin/testA and if it has exit status other then 0 terminate cook
>
progA/progA.o: progA/progA.cpp
{
	9) compile progA/progA.cpp
}

bin/progA: progA/progA.o  lib/libA.a lib/libB.a
{
	10) link progA/progA.o against lib/libA.a and lib/libB.a produce progA/porgA and copy it to bin/progA
}

progA/testA: progA/testA.cpp  lib/libA.a lib/libB.a
{
	11) repeat step 9 and 10 for progA/testA
	12) run bin/testA set noerrok;
}

>
>steps 10 onwards other tasks
>
>Now here are the issues:
>
>1) I can hardcode the above just fine but ANY attempt to softcode any of
>the linkage between steps 1-4 and 5-8 causes the steps to go 1->5->3->7->4->8
>.... as I said they MUST BE DONE in the EXACT order as listed above because
>some of the files (namely include/libA.h and include/libB.h components
>are made based on data already known from previous recipes which CAN NOT
>be known if the recipes are done out of order)
>
>2) The only algrothemically provable linkage between lib/libA.a and lib/libB.a
>is lib/libA.h
>
>3) All components of libB will tail if libA is not complete constructed
>
>How do I solve these 3 issyes?
>_______________________________________________
>Cook-users mailing list
>Cook-users at auug.org.au
>http://www.auug.org.au/mailman/listinfo/cook-users
>  
>





More information about the Cook-users mailing list