csuo
csuo

Reputation: 820

Creating makefile

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?

Upvotes: 0

Views: 245

Answers (1)

Piotr Praszmo
Piotr Praszmo

Reputation: 18320

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

Upvotes: 2

Related Questions