我有我的代碼在src文件夾中。 src/Client包含用於創建客戶端應用程序的makefile。 src/Server包含一個用於創建客戶端應用程序的makefile。 我在與src相同的文件夾中有一個bin文件。 名爲ad的文件夾包含src和bin。 在箱櫃中,我有一個makefileMakeFile目標目錄
all:
cd ../src/Server; make
cd ../src/Client; make
clean:
cd ../src/Server; make clean
cd ../src/Client; make clean
我的問題是,我想在所有箱子我的可執行文件,但是現在他們在服務器和客戶端文件夾中創建。
我的makefile在客戶端文件夾:
# 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 [email protected]; \
$(CPP) -MM $(CPPFLAGS) $< > [email protected]$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o [email protected] : ,g' < [email protected]$$$$ > [email protected]; \
rm -f [email protected]$$$$
# Include the *.d files
SRC = $(wildcard *.cc)
include $(SRC:.cc=.d)
我應該在這個文件改變什麼?
我不喜歡這樣 接口:INTE rface.o com.o ans.o \t $(CXX)-o ../../bin/[email protected] $^$(LDLIBS)$(LDFLAGS) 與另一個相同。 – user2975699