【发布时间】:2014-04-11 05:26:20
【问题描述】:
我的代码在 src 文件夹中。 src/Client 包含一个用于创建客户端应用程序的生成文件。 src/Server 包含一个用于创建客户端应用程序的生成文件。 我在与 src 相同的文件夹中有一个 bin 文件。 名为 ad 的文件夹包含 src 和 bin。 在 bin 我有一个 makefile
all:
cd ../src/Server; make
cd ../src/Client; make
clean:
cd ../src/Server; make clean
cd ../src/Client; make clean
我的问题是我希望所有可执行文件都在 bin 中,但现在它们是在服务器和客户端文件夹中创建的。
我在客户端文件夹中的生成文件:
# Define the compiler and the linker. The linker must be defined since
# the implicit rule for linking uses CC as the linker. g++ can be
# changed to clang++.
CXX = g++
CC = g++
# Define preprocessor, compiler, and linker flags. Uncomment the # lines
# if you use clang++ and wish to use libc++ instead of libstd++.
CPPFLAGS =-I.. -I ../database
CXXFLAGS = -g -O2 -Wall -W -pedantic-errors
CXXFLAGS += -Wmissing-braces -Wparentheses -Wold-style-cast
CXXFLAGS += -std=c++11
LDFLAGS = -g -L.. -L../database
#CPPFLAGS += -stdlib=libc++
#CXXFLAGS += -stdlib=libc++
#LDFLAGS += -stdlib=libc++
# Libraries
LDLIBS = -lclientserver -ldatabase
# Targets
PROGS = interface
all: $(PROGS)
# Targets rely on implicit rules for compiling and linking
# The dependency on libclientserver.a is not defined.
interface: interface.o com.o ans.o
# Phony targets
.PHONY: all clean
# Standard clean
clean:
rm -f *.o $(PROGS)
# Generate dependencies in *.d files
%.d: %.cc
@set -e; rm -f $@; \
$(CPP) -MM $(CPPFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
# Include the *.d files
SRC = $(wildcard *.cc)
include $(SRC:.cc=.d)
我应该在这个文件中更改什么?
【问题讨论】: