当makefile像
一样调用自身时test :
@ mv $(BIN_SRC) $(BIN_SCR_TMP)
@ mv $(BIN_TEST_SRC) $(BIN_TEST_SRC_TMP)
@ make runtest
@ mv $(BIN_SCR_TMP) $(BIN_SRC)
@ mv $(BIN_TEST_SRC_TMP) $(BIN_TEST_SRC)
runtest : $(OBJS) $(LIB)
g++ -o $(TEST_BIN_FILE) $(OBJS) $(LIB)
@ chmod ugo+x $(TEST_BIN_FILE)
$(TEST_BIN_FILE)
然后你运行make test
它将它打印到终端:
make test
make[1]: Entering directory `/users/home2/admin/stringha/cs240/webcrawler'
g++ -o bin/webcrawler-tests obj/URL.o obj/webcrawler-tests.o lib/libcs240utils.a bin/webcrawler-tests
Hello webcrawler test!
make[1]: Leaving directory `/users/home2/admin/stringha/cs240/webcrawler'
我想知道如何让它不打印出来
make[1]: Entering directory `/users/home2/admin/stringha/cs240/webcrawler'
和
make[1]: Leaving directory `/users/home2/admin/stringha/cs240/webcrawler'
谢谢!
答案 0 :(得分:3)
MAKEFLAGS += --no-print-directory
或直接将其添加到sub-make invocation命令:
test :
...
@$(MAKE) runtest --no-print-directory
...
另请阅读有关使用MAKE
variable。
答案 1 :(得分:1)
将-no-print-directory添加到MAKEFLAGS:
$ export MAKEFLAGS=--no-print-directory
或将该选项添加到您调用make:
$ make test --no-print-directory