#use g++ for everything
CC= g++
# include debugging symbols in object files,
# and enable all warnings
FLAGS= -g -Wall -std=c++11
BSTHPP= BST.hpp BSTNode.hpp BSTIterator.hpp
all: main
bst: testBST.o $(BSTHPP)
$(CC) $(FLAGS) -o bst testBST.o $(BSTHPP)
main: main.o $(BSTHPP)
$(CC) $(FLAGS) -o main main.o $(BSTHPP)
main.o: $(BSTHPP)
$(CC) $(FLAGS) -c main.cpp
testBST.o: testBST.cpp
$(CC) $(FLAGS) -c testBST.cpp
clean:
$(RM) main bst *.o
我更改了BST.hpp文件,然後運行make bst
。但我調試了幾次,並找出首先,我需要make clean
,然後重新編譯。但爲什麼?任何人都可以向我解釋嗎?Makefile不重新編譯,如果不乾淨
窺視'-MD'選項和'包括* .d' – o11c