(注意每一行的前面若有空格,是tab,不是space)
#Source file
SRC = ThreadQueue.cpp
#Object file
OBJ = $(SRC:.cpp=.o)
#Output execution file
PROGRAM = ThreadQueue
#Compiler
CC = g++
#Include
INCLUDE = -I/usr/include/ncurses -I/usr/include/
#Linker Parameter
LINKPARAM = -lpthread -lncurses
#Options for development
#CFLAGS = -ansi -g -Wall
#Options for release
CFLAGS = -ansi -O -Wall
all: $(PROGRAM)
$(PROGRAM): $(OBJ)
$(CC) -o $(PROGRAM) $(LINKPARAM) $(OBJ)
.SUFFIXES : .cpp
.cpp.o:
$(CC) $(INCLUDE) $(CFLAGS) -c $<
clean:
rm *.o
如果编译时出现了Makefile:8: *** 遗漏分隔符 停止的错误
原因是在编写makefile文件时:
gcc前的是tab分隔符,不能用空格,
make中规定每一Shell命令之前的开头必须使用
没有评论:
发表评论