Creating makefile

不想你离开。 提交于 2019-12-20 05:38:16

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!