问题
I am trying to create the makefiles and configure for my library which its directory structure is like following:
$projectroot
├── lib
├── src
└── test
this library has 3 different parts (part1, part2 and part3) and it is a hierarchal library, that means part2 needs part1, part 3 needs part2 and part1:
part1 ◁───┐
△ │
│ │
part2 │
△ │
│ │
│ │
part3 ┘
Now, I want to have 4 different targets, as you can see below:
all:
<MAKE ALL THE 3 PARTS>
part1:
<MAKE PART1>
part2:
<MAKE PART2>
part3:
<MAKE PART3>
I have no problem with make (make all), but for example maybe someone wants only to install part2, I need to verify whether part2 is already installed or not
How can I do that?
回答1:
Just list part1 and part2 as dependencies of part3:
all: part1 part2 part3
part1:
MAKE PART1
part2: part1
MAKE PART2
part3: part1 part2
MAKE PART3
来源:https://stackoverflow.com/questions/6174029/creating-makefile