Makefile 多个目标匹配的问题

在windows下直接使用mingw32-make

# ZTHREAD_A the static link library file of ZThread
ZTHREAD_A = F:/ZJ/tools/cpp_libs/ZThread-2.3.2/bin/zthread_win32.a
# ZTHREAD_H is the directory that has all the header
# files of the ZThread library
ZTHREAD_H = F:/ZJ/tools/cpp_libs/ZThread-2.3.2/include

test.exe: main.o Test.o LiftOff.o $(ZTHREAD_A)
    g++ -o test.exe main.o Test.o LiftOff.o -s $(ZTHREAD_A)
main.o: main.cpp
    g++ -c main.cpp -o main.o
# '-I' specifies the header search directory
Test.o: Test.cpp Test.h
    g++ -I $(ZTHREAD_H) -c Test.cpp -o Test.o
LiftOff.o: LiftOff.cpp LiftOff.h
    g++ -I $(ZTHREAD_H) -c LiftOff.cpp -o LiftOff.o

# PHONY means 'clean' is a fake target
# use 'make clean' to remove all .o files
# before rebuilding
# '-' means continue execute next command even if something goes wrong with this command
.PHONY: clean
clean:
    -del test.exe
    -del *.o

把红色部分删去就是了,因为路径中有冒号!

而且本来.a文件就不应该出现在依赖关系中,低级错误。。

 

posted @ 2014-12-03 09:39  rldts  阅读(2453)  评论(0编辑  收藏  举报