一个很典型的Linux C/C++的makefile写法,其它的应用可根据此template修改。(注意每一行的前面若有空格,是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
- : $(PROGRAM)
- $(PROGRAM): $(OBJ)
- $(CC) -o $(PROGRAM) $(LINKPARAM) $(OBJ)
- SUFFIXES : .cpp
- cpp.o:
- $(CC) $(INCLUDE) $(CFLAGS) -c $<
- clean:
- -rm *.o