我对编程很陌生。
我需要帮我在makefile里隐藏一条信息。让我告诉你:
编译这组文件时(grid.cc attribute.cc targa.cc) http://prntscr.com/67ack4
我看到这样的信息: gcc5 -Wall -O2 -pipe -mtune=i686 -c attribute.cc
我想为自己辩护,比如:编译targa.cc,我想为我辩护,比如:编译,attribute.cc,等等。
我希望你能理解我的意思。
这是我的makefile:
BIN = ../libgame.a
CXX = gcc5
CFLAGS = -Wall -O2 -pipe -mtune=i686
OBJFILES = grid.o attribute.o targa.o
########################################################################################################
default:
$(CXX) $(CFLAGS) -c grid.cc
$(CXX) $(CFLAGS) -c attribute.cc
$(CXX) $(CFLAGS) -c targa.cc
ar cru $(BIN) $(OBJFILES)
ranlib $(BIN)
rm -f *.o
发布于 2015-02-19 23:43:18
您可以使用自动样式的静默规则技巧来控制命令的输出。
要直接这样做,您可以这样做:
BIN = ../libgame.a
CXX = gcc5
CFLAGS = -Wall -O2 -pipe -mtune=i686
OBJFILES = grid.o attribute.o targa.o
########################################################################################################
default:
@echo 'Compiling grid.cc';$(CXX) $(CFLAGS) -c grid.cc
@echo 'Compiling attribute.cc';$(CXX) $(CFLAGS) -c attribute.cc
@echo 'Compiling targa.cc';$(CXX) $(CFLAGS) -c targa.cc
ar cru $(BIN) $(OBJFILES)
ranlib $(BIN)
rm -f *.o或者,您可以使用我的silent_rules.mk并使用:
$(eval $(call vrule,Compile,Compiling $$(value 1))
$(call Compile,grid.cc);$(CXX) $(CFLAGS) -c grid.cc
$(call Compile,attribute.cc);$(CXX) $(CFLAGS) -c attribute.cc
$(call Compile,targa.cc);$(CXX) $(CFLAGS) -c targa.cc来获取Compiling grid.cc、Compiling attribute.cc和Compiling targa.cc消息。(如果对对象文件使用了适当的目标,则可以使用默认的$(GEN)静默规则自动获得GEN xxx.o输出。
https://stackoverflow.com/questions/28617277
复制相似问题