Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以根据目标的名称在 makefile 中创建对象文件?
就像是
all : gsm gsm_db if make gsm %.o : %.cpp $(CC) $(CFLAGS) $< -o $@ if make gsm_db %.o : %.cpp $(CC) $(CFLAGS_DB) $< -o $@
像这样的东西应该工作:
ifneq "$(filter gsm_db, $(MAKECMDGOALS))" "" %.o : %.cpp $(CC) $(CFLAGS_DB) $< -o $@ else %.o : %.cpp $(CC) $(CFLAGS) $< -o $@ endif