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:
-
#makefile demo V2.0
-
#author: warrior
-
#mail:675979646@qq.com
-
#date:2015/5/8
-
-
CXX := g++
-
CFLAGS := -c -g -W -Wall
-
SRCDIR := ./src
-
INCDIR := -I./inc -I.
-
OBJDIR := ./obj
-
-
SOURCES := $(shell ls $(SRCDIR)/*.cc)
-
OBJS := $(patsubst %.cc,%.o,$(SOURCES))
-
TARGET := target
-
-
-
${TARGET} : ${OBJS}
-
${CXX} -o $@ $^
-
-
%.o : %.cc
-
$(CXX) ${CFLAGS} -o $@ $< $(INCDIR)
-
-
-
-
-
.PHONY : clean
-
clean :
-
-rm -f $(SRCDIR)/*.o target
阅读(1324) | 评论(0) | 转发(0) |