main.cpp在与makefile同级的目录下,但是make clean;make后,提示
g++: main.o: 没有那个文件或目录是什么原因,makefile附在下面
#############################################################################
# Makefile for building: libxengine.so
#############################################################################
####### Compiler, tools and options
CC = @echo compiling $< && gcc
CXX = @echo compiling $< && g++
CFLAGS = -pipe -g -Wall -W -fPIC $(DEFINES)
CXXFLAGS = -pipe -g -Wall -W -D_REENTRANT -fPIC $(DEFINES)
INCPATH = -I. -I../engines/include
#LINK = @echo linking $@ && g++
LINK = @echo linking $< && g++
LFLAGS = -lpthread -ldl
AR = ar cqs
RANLIB =
TAR = tar -cf
COMPRESS = gzip -9f
COPY = cp -f
SED = sed
COPY_FILE = $(COPY)
COPY_DIR = $(COPY) -R
INSTALL_FILE = $(COPY_FILE)
INSTALL_DIR = $(COPY_DIR)
INSTALL_PROGRAM = $(COPY_FILE)
DEL_FILE = rm -f
SYMLINK = ln -sf
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
SOURCES = src/
ARCH :=$(shell uname -m)
ARCH_X86 =i686
ARCH_X64 =x86_64
SRC_ROOT =../../../../../trunk
SRC_COMMON =../../../../common
SRC_SERVER_COMMON =$(SRC_ROOT)/src/servercommon
SRC_TOOLS =../tools
SRC_ENGINES =../engines
SRC_PLUGIN_NPC =../plugins/sprites/npcsprite
BINARIES_PATH =../../binaries
BINARIES_BIN_PATH =$(BINARIES_PATH)/bin
BINARIES_PLUGINS =$(BINARIES_PATH)/plugins
BINARIES_PLUGINS_SPRITES=$(BINARIES_PLUGINS)/sprites
INCPATH +=-I./include
INCPATH +=-I$(SRC_ENGINES)/include
INCPATH +=-I$(SRC_COMMON)/comm
INCPATH +=-I$(SRC_COMMON)/tiny
INCPATH +=-I$(SRC_COMMON)/comm/linux
INCPATH +=-I$(SRC_COMMON)/interface
INCPATH +=-I$(SRC_COMMON)/inc
INCPATH +=-I$(SRC_COMMON)/protobuf/include
INCPATH +=-I$(SRC_COMMON)/log4cpp/include
INCPATH +=-I$(SRC_COMMON)/message/c++
INCPATH +=-I$(SRC_COMMON)
INCPATH +=-I$(SRC_SERVER_COMMON)/inc
INCPATH +=-I$(SRC_SERVER_COMMON)/message
INCPATH +=-I$(SRC_TOOLS)
INCPATH +=-I$(SRC_PLUGIN_NPC)
INCPATH +=-I$(CORE_ENGINE_SRC)/include
INCPATH +=-I$(CORE_ENGINE_TOOLS)
DEFINES +=-DLINUX
DEFINES +=-DOTHERSERVER
DEFINES +=-DUSE_LOG4CPP
DEFINES +=-DNDEBUG
DEFINES +=-D_USE_MESSAGE_BUFF_
DEFINES +=-DUSE_YQ_ASSERT
DEFINES +=-DRLOG_COMPONENT=XCOREENGINE
GAME_SERVER_INSTALL_ROOT = $(SRC_ROOT)/src/gameserver/binaries/bin
LIBS +=-L$(GAME_SERVER_INSTALL_ROOT) -lxengine
LIBS +=-L$(GAME_SERVER_INSTALL_ROOT) -ltltools
ifeq ($(ARCH), $(ARCH_X64))
LIBS += -L$(SRC_COMMON)/log4cpp/lib -llog4cpp
LIBS += -L$(SRC_COMMON)/tiny/x64 -ltinyxml
LIBS += -L$(SRC_COMMON)/protobuf/lib/x64 -lprotobuf
else
LIBS += -L$(SRC_COMMON)/tiny/x86 -ltinyxml
endif
####### Output directory
LIBS_PATH =./.libs
OBJECTS = main.o
TARGET = gamesvrd
first: all
####### Implicit rules
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
####### Build rules
all: $(TARGET)
$(TARGET): $(OBJECTS) $(SUBLIBS)
-$(DEL_FILE) $(TARGET)
@$(CHK_DIR_EXISTS) $(LIBS_PATH)/ || $(MKDIR) $(LIBS_PATH)/
$(LINK) $(LFLAGS) -o $(LIBS_PATH)/$(TARGET) $(OBJECTS) $(LIBS)
clean:
-$(DEL_FILE) $(OBJECTS)
####### Sub-libraries
distclean: clean
-$(DEL_FILE) $(TARGET)
testcase: export DEFINES+=-DRUN_TESTCASE
testcase: all
install_target: all
-$(INSTALL_PROGRAM) $(LIBS_PATH)/$(TARGET) $(GAME_SERVER_INSTALL_ROOT)/$(TARGET)
install: install_target