Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1802290
  • 博文数量: 286
  • 博客积分: 3713
  • 博客等级: 少校
  • 技术积分: 2275
  • 用 户 组: 普通用户
  • 注册时间: 2012-01-11 09:47
个人简介

http://blog.chinaunix.net/uid/16979052.html

文章分类

全部博文(286)

文章存档

2018年(1)

2017年(16)

2016年(9)

2015年(17)

2014年(15)

2013年(112)

2012年(116)

分类: C/C++

2013-05-24 20:40:20

原文地址:编译所有子目录的makefile 作者:wwm

经常有人需要顺序编译一个一个的模块,最后才连接生成可执行程序,但是如果一个模块一个模块地执行make,比较马法,下面是一个经过验证的makefile;
可以根据自己的需要修改SUBDIRS宏的值,设定自己需要编译的目录的顺序.就可以了.

##############################
# file   Makefile
# author  chenli
# date  2008-02-01
###############################
 


#编译所有子目录
#SUBDIRS=`ls -d */ | grep -v 'bin' | grep -v 'lib' | grep -v 'include'`

#编译指定子目录
SUBDIRS=dir1 dir2 dir3

define make_subdir
 @for subdir in $(SUBDIRS) ; do \
 ( cd $$subdir && make $1) \
 done;
endef

all:
 $(call make_subdir , all)
 
install :
 $(call make_subdir , install)
 
debug:
 $(call make_subdir , debug)
clean:
 $(call make_subdir , clean) 


阅读(862) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~