如果我做了make clean
它抱怨丟失的文件。特別是它抱怨包含在nstest.cc
和nstime.cc
中的mapnameserver.h
。 我認爲做make clean
會忽略所有其他的目標,甚至隱含的目標。使用makefile中的隱式規則進行清理
我想要的是能夠做到make clean
和make vectornameserver
而不抱怨nstest.cc和nstime.cc包含我還沒有寫入的頭文件。這可能嗎?
下面是在src目錄
nameserverinterface.h
nstest.cc
nstime.cc
vectornameserver.cc
vectornameserver.h
的文件和參考是Makefile
#
# Makefile for CPP
#
# Compiler and compiler options:
CC = /usr/local/bin/clang++
CXX = /usr/local/bin/clang++
CXXFLAGS = -c -pipe -O2 -Wall -W -ansi -pedantic-errors
CXXFLAGS += -Wmissing-braces -Wparentheses -Wold-style-cast
CXXFLAGS += -std=c++11 -stdlib=libc++ -nostdinc++
CXXFLAGS += -I/Users/einar/devel/libcxx/include/
LDFLAGS = -stdlib=libc++
LDLIBS = -L/Users/einar/devel/libcxx/lib/
SRCDIR = ../src
LIBDIR = ../lib
BINDIR = ../bin
DEPDIR = ../dep
VPATH = $(SRCDIR):$(LIBDIR):$(BINDIR):$(DEPDIR)
LIB_INSTALL =
BIN_INSTALL =
SRC = $(wildcard $(SRCDIR)/*.cc)
OBJ = $(notdir $(SRC:.cc=.o))
DEP = $(addprefix $(DEPDIR)/, $(notdir $(SRC:.cc=.d)))
PROGS = vectornameserver
MAKEDEPEND = $(CXX) -MM $(CPPFLAGS) -o $*.d $<
CP = /bin/cp
###
#
# Phony targets
#
###
.PHONY: all
all: $(PROGS)
.PHONY: folder_setup
folder_setup:
mkdir -p $(SRCDIR)
mkdir -p $(LIBDIR)
mkdir -p $(BINDIR)
mkdir -p $(DEPDIR)
.PHONY: clean
clean:
@$(RM) $(OBJ)
.PHONY: cleaner
cleaner:
@$(RM) $(OBJ)
@$(RM) $(PROGS)
@$(RM) $(DEP)
@$(RM) $(wildcard $(DEPDIR)/*.d*)
###
#
# Set up targets for program files in this section
# a rule should look like:
# program: obj1.o obj2.o ...
#
###
vectornameserver : vectornameserver.o
###
#
# In this section automatic dependencies are handled.
#
###
$(addprefix $(DEPDIR)/, %.d): %.cc
@set -e; rm -f [email protected]; \
$(CXX) -MM $(CPPFLAGS) $< > [email protected]$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o [email protected]: ,g' < [email protected]$$$$ \
> [email protected]; rm -f [email protected]$$$$
###
#
# Include the automatically generated dependency files
#
###
include $(DEP)
在此先感謝。
您確定* Make *抱怨'mapnameserver.h'丟失?不是鏗鏘聲++? – Beta 2013-02-24 01:31:00
它可能是鏗鏘語+現在抱怨你提到它。 – evading 2013-02-24 10:54:29