asking question while installing with makefile
I am trying to create an installation file for my library which has 3 parts, which part2 is depended to part 1 and part 3 is depended to part 2 and part 1.
It is possible that someone wants to install only one part, now the makefile should check is already installed the other required parts in the prefix location or not, and if not ask question if the user is sure to install that part?
for example to install part 2, the makefile should check whether part 1 is insta开发者_C百科lled or not, and if it is not install ask "are you sure to install part 2 before part1?"
I should add that already in the make file there are 4 targets, make part1
, make part2
, make part3
and make all
. And there is no problem if someone install part3 without installing part2 or 1, but I wanna to verify that cuz it is possible that someone install a wrong part
how can I do that? any Idea will be apreciated
This is bad form. Have the person running make pass variables to it instead, containing the appropriate values.
As I see it, to install part2
make has to install both part1
and part2
. This must be declared as dependency. Then part3
depends on part2
, which means make part3
has to install all three parts: part1
because part2
depends on it, and part2
because part3
depends on part3
.
This way, all
target must depend on part3
, and everything will be installed.
make
should not ask questions but resolve the dependencies automatically. If user wants to install part3
, then its dependencies must also be installed; otherwise it won't work, will it?
精彩评论