Chinaunix首页 | 论坛 | 博客
  • 博客访问: 284752
  • 博文数量: 82
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 874
  • 用 户 组: 普通用户
  • 注册时间: 2015-03-21 09:58
个人简介

traveling in cumputer science!!

文章分类

全部博文(82)

文章存档

2016年(13)

2015年(69)

我的朋友

分类: C/C++

2015-05-08 21:50:42

this is my second makefile for my Cpp project!
It's designed for multi folders!

It's direction:
warrior@warrior-ThinkPad:~/CreazyCode/CPPproject/Mdemo$ tree
.
├── inc
│   ├── demo.h
│   └── main.h
├── log
│   └── info.log
├── makefile
├── obj
├── src
│   ├── demo.cc
│   ├── main.cc
│   └── out.cc
└── tags



The makefile content:

点击(此处)折叠或打开

  1. #makefile demo V2.0
  2. #author: warrior
  3. #mail:675979646@qq.com
  4. #date:2015/5/8

  5. CXX := g++
  6. CFLAGS := -c -g -W -Wall
  7. SRCDIR := ./src
  8. INCDIR := -I./inc -I.
  9. OBJDIR := ./obj

  10. SOURCES := $(shell ls $(SRCDIR)/*.cc)
  11. OBJS := $(patsubst %.cc,%.o,$(SOURCES))
  12. TARGET := target


  13. ${TARGET} : ${OBJS}
  14.     ${CXX} -o $@ $^

  15. %.o : %.cc
  16.     $(CXX) ${CFLAGS} -o $@ $< $(INCDIR)




  17. .PHONY : clean
  18. clean :
  19.     -rm -f $(SRCDIR)/*.o target

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