Skip to content

Commit e36a8b0

Browse files
committed
Revert changes on Makefile
1 parent 32719a4 commit e36a8b0

File tree

1 file changed

+63
-254
lines changed

1 file changed

+63
-254
lines changed

example/echo_c++/Makefile

+63-254
Original file line numberDiff line numberDiff line change
@@ -1,255 +1,64 @@
1-
# CMAKE generated file: DO NOT EDIT!
2-
# Generated by "Unix Makefiles" Generator, CMake Version 3.5
3-
4-
# Default target executed when no arguments are given to make.
5-
default_target: all
6-
7-
.PHONY : default_target
8-
9-
# Allow only one "make -f Makefile2" at a time, but pass parallelism.
10-
.NOTPARALLEL:
11-
12-
13-
#=============================================================================
14-
# Special targets provided by cmake.
15-
16-
# Disable implicit rules so canonical targets will work.
17-
.SUFFIXES:
18-
19-
20-
# Remove some rules from gmake that .SUFFIXES does not remove.
21-
SUFFIXES =
22-
23-
.SUFFIXES: .hpux_make_needs_suffix_list
24-
25-
26-
# Suppress display of executed commands.
27-
$(VERBOSE).SILENT:
28-
29-
30-
# A target that is always out of date.
31-
cmake_force:
32-
33-
.PHONY : cmake_force
34-
35-
#=============================================================================
36-
# Set environment variables for the build.
37-
38-
# The shell in which to execute make rules.
39-
SHELL = /bin/sh
40-
41-
# The CMake executable.
42-
CMAKE_COMMAND = /usr/bin/cmake
43-
44-
# The command to remove a file.
45-
RM = /usr/bin/cmake -E remove -f
46-
47-
# Escaping for special characters.
48-
EQUALS = =
49-
50-
# The top-level source directory on which CMake was run.
51-
CMAKE_SOURCE_DIR = /home/chen/Code/brpc/example/echo_c++
52-
53-
# The top-level build directory on which CMake was run.
54-
CMAKE_BINARY_DIR = /home/chen/Code/brpc/example/echo_c++
55-
56-
#=============================================================================
57-
# Targets provided globally by CMake.
58-
59-
# Special rule for the target edit_cache
60-
edit_cache:
61-
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "No interactive CMake dialog available..."
62-
/usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available.
63-
.PHONY : edit_cache
64-
65-
# Special rule for the target edit_cache
66-
edit_cache/fast: edit_cache
67-
68-
.PHONY : edit_cache/fast
69-
70-
# Special rule for the target rebuild_cache
71-
rebuild_cache:
72-
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
73-
/usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
74-
.PHONY : rebuild_cache
75-
76-
# Special rule for the target rebuild_cache
77-
rebuild_cache/fast: rebuild_cache
78-
79-
.PHONY : rebuild_cache/fast
80-
81-
# The main all target
82-
all: cmake_check_build_system
83-
$(CMAKE_COMMAND) -E cmake_progress_start /home/chen/Code/brpc/example/echo_c++/CMakeFiles /home/chen/Code/brpc/example/echo_c++/CMakeFiles/progress.marks
84-
$(MAKE) -f CMakeFiles/Makefile2 all
85-
$(CMAKE_COMMAND) -E cmake_progress_start /home/chen/Code/brpc/example/echo_c++/CMakeFiles 0
86-
.PHONY : all
87-
88-
# The main clean target
1+
NEED_GPERFTOOLS=1
2+
BRPC_PATH=../..
3+
include $(BRPC_PATH)/config.mk
4+
# Notes on the flags:
5+
# 1. Added -fno-omit-frame-pointer: perf/tcmalloc-profiler use frame pointers by default
6+
# 2. Added -D__const__= : Avoid over-optimizations of TLS variables by GCC>=4.8
7+
CXXFLAGS+=$(CPPFLAGS) -std=c++0x -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer
8+
ifeq ($(NEED_GPERFTOOLS), 1)
9+
CXXFLAGS+=-DBRPC_ENABLE_CPU_PROFILER
10+
endif
11+
HDRS+=$(BRPC_PATH)/output/include
12+
LIBS+=$(BRPC_PATH)/output/lib
13+
14+
HDRPATHS=$(addprefix -I, $(HDRS))
15+
LIBPATHS=$(addprefix -L, $(LIBS))
16+
COMMA=,
17+
SOPATHS=$(addprefix -Wl$(COMMA)-rpath=, $(LIBS))
18+
19+
STATIC_LINKINGS+=-lbrpc
20+
21+
CLIENT_SOURCES = client.cpp
22+
SERVER_SOURCES = server.cpp
23+
PROTOS = $(wildcard *.proto)
24+
25+
PROTO_OBJS = $(PROTOS:.proto=.pb.o)
26+
PROTO_GENS = $(PROTOS:.proto=.pb.h) $(PROTOS:.proto=.pb.cc)
27+
CLIENT_OBJS = $(addsuffix .o, $(basename $(CLIENT_SOURCES)))
28+
SERVER_OBJS = $(addsuffix .o, $(basename $(SERVER_SOURCES)))
29+
30+
.PHONY:all
31+
all: echo_client echo_server
32+
33+
.PHONY:clean
8934
clean:
90-
$(MAKE) -f CMakeFiles/Makefile2 clean
91-
.PHONY : clean
92-
93-
# The main clean target
94-
clean/fast: clean
95-
96-
.PHONY : clean/fast
97-
98-
# Prepare targets for installation.
99-
preinstall: all
100-
$(MAKE) -f CMakeFiles/Makefile2 preinstall
101-
.PHONY : preinstall
102-
103-
# Prepare targets for installation.
104-
preinstall/fast:
105-
$(MAKE) -f CMakeFiles/Makefile2 preinstall
106-
.PHONY : preinstall/fast
107-
108-
# clear depends
109-
depend:
110-
$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
111-
.PHONY : depend
112-
113-
#=============================================================================
114-
# Target rules for targets named echo_server
115-
116-
# Build rule for target.
117-
echo_server: cmake_check_build_system
118-
$(MAKE) -f CMakeFiles/Makefile2 echo_server
119-
.PHONY : echo_server
120-
121-
# fast build rule for target.
122-
echo_server/fast:
123-
$(MAKE) -f CMakeFiles/echo_server.dir/build.make CMakeFiles/echo_server.dir/build
124-
.PHONY : echo_server/fast
125-
126-
#=============================================================================
127-
# Target rules for targets named echo_client
128-
129-
# Build rule for target.
130-
echo_client: cmake_check_build_system
131-
$(MAKE) -f CMakeFiles/Makefile2 echo_client
132-
.PHONY : echo_client
133-
134-
# fast build rule for target.
135-
echo_client/fast:
136-
$(MAKE) -f CMakeFiles/echo_client.dir/build.make CMakeFiles/echo_client.dir/build
137-
.PHONY : echo_client/fast
138-
139-
client.o: client.cpp.o
140-
141-
.PHONY : client.o
142-
143-
# target to build an object file
144-
client.cpp.o:
145-
$(MAKE) -f CMakeFiles/echo_client.dir/build.make CMakeFiles/echo_client.dir/client.cpp.o
146-
.PHONY : client.cpp.o
147-
148-
client.i: client.cpp.i
149-
150-
.PHONY : client.i
151-
152-
# target to preprocess a source file
153-
client.cpp.i:
154-
$(MAKE) -f CMakeFiles/echo_client.dir/build.make CMakeFiles/echo_client.dir/client.cpp.i
155-
.PHONY : client.cpp.i
156-
157-
client.s: client.cpp.s
158-
159-
.PHONY : client.s
160-
161-
# target to generate assembly for a file
162-
client.cpp.s:
163-
$(MAKE) -f CMakeFiles/echo_client.dir/build.make CMakeFiles/echo_client.dir/client.cpp.s
164-
.PHONY : client.cpp.s
165-
166-
echo.pb.o: echo.pb.cc.o
167-
168-
.PHONY : echo.pb.o
169-
170-
# target to build an object file
171-
echo.pb.cc.o:
172-
$(MAKE) -f CMakeFiles/echo_server.dir/build.make CMakeFiles/echo_server.dir/echo.pb.cc.o
173-
$(MAKE) -f CMakeFiles/echo_client.dir/build.make CMakeFiles/echo_client.dir/echo.pb.cc.o
174-
.PHONY : echo.pb.cc.o
175-
176-
echo.pb.i: echo.pb.cc.i
177-
178-
.PHONY : echo.pb.i
179-
180-
# target to preprocess a source file
181-
echo.pb.cc.i:
182-
$(MAKE) -f CMakeFiles/echo_server.dir/build.make CMakeFiles/echo_server.dir/echo.pb.cc.i
183-
$(MAKE) -f CMakeFiles/echo_client.dir/build.make CMakeFiles/echo_client.dir/echo.pb.cc.i
184-
.PHONY : echo.pb.cc.i
185-
186-
echo.pb.s: echo.pb.cc.s
187-
188-
.PHONY : echo.pb.s
189-
190-
# target to generate assembly for a file
191-
echo.pb.cc.s:
192-
$(MAKE) -f CMakeFiles/echo_server.dir/build.make CMakeFiles/echo_server.dir/echo.pb.cc.s
193-
$(MAKE) -f CMakeFiles/echo_client.dir/build.make CMakeFiles/echo_client.dir/echo.pb.cc.s
194-
.PHONY : echo.pb.cc.s
195-
196-
server.o: server.cpp.o
197-
198-
.PHONY : server.o
199-
200-
# target to build an object file
201-
server.cpp.o:
202-
$(MAKE) -f CMakeFiles/echo_server.dir/build.make CMakeFiles/echo_server.dir/server.cpp.o
203-
.PHONY : server.cpp.o
204-
205-
server.i: server.cpp.i
206-
207-
.PHONY : server.i
208-
209-
# target to preprocess a source file
210-
server.cpp.i:
211-
$(MAKE) -f CMakeFiles/echo_server.dir/build.make CMakeFiles/echo_server.dir/server.cpp.i
212-
.PHONY : server.cpp.i
213-
214-
server.s: server.cpp.s
215-
216-
.PHONY : server.s
217-
218-
# target to generate assembly for a file
219-
server.cpp.s:
220-
$(MAKE) -f CMakeFiles/echo_server.dir/build.make CMakeFiles/echo_server.dir/server.cpp.s
221-
.PHONY : server.cpp.s
222-
223-
# Help Target
224-
help:
225-
@echo "The following are some of the valid targets for this Makefile:"
226-
@echo "... all (the default if no target is provided)"
227-
@echo "... clean"
228-
@echo "... depend"
229-
@echo "... edit_cache"
230-
@echo "... rebuild_cache"
231-
@echo "... echo_server"
232-
@echo "... echo_client"
233-
@echo "... client.o"
234-
@echo "... client.i"
235-
@echo "... client.s"
236-
@echo "... echo.pb.o"
237-
@echo "... echo.pb.i"
238-
@echo "... echo.pb.s"
239-
@echo "... server.o"
240-
@echo "... server.i"
241-
@echo "... server.s"
242-
.PHONY : help
243-
244-
245-
246-
#=============================================================================
247-
# Special targets to cleanup operation of make.
248-
249-
# Special rule to run CMake to check the build system integrity.
250-
# No rule that depends on this can have commands that come from listfiles
251-
# because they might be regenerated.
252-
cmake_check_build_system:
253-
$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
254-
.PHONY : cmake_check_build_system
255-
35+
@echo "Cleaning"
36+
@rm -rf echo_client echo_server $(PROTO_GENS) $(PROTO_OBJS) $(CLIENT_OBJS) $(SERVER_OBJS)
37+
38+
echo_client:$(PROTO_OBJS) $(CLIENT_OBJS)
39+
@echo "Linking $@"
40+
ifneq ("$(LINK_SO)", "")
41+
@$(CXX) $(LIBPATHS) $(SOPATHS) -Xlinker "-(" $^ -Xlinker "-)" $(STATIC_LINKINGS) $(DYNAMIC_LINKINGS) -o $@
42+
else
43+
@$(CXX) $(LIBPATHS) -Xlinker "-(" $^ -Wl,-Bstatic $(STATIC_LINKINGS) -Wl,-Bdynamic -Xlinker "-)" $(DYNAMIC_LINKINGS) -o $@
44+
endif
45+
46+
echo_server:$(PROTO_OBJS) $(SERVER_OBJS)
47+
@echo "Linking $@"
48+
ifneq ("$(LINK_SO)", "")
49+
@$(CXX) $(LIBPATHS) $(SOPATHS) -Xlinker "-(" $^ -Xlinker "-)" $(STATIC_LINKINGS) $(DYNAMIC_LINKINGS) -o $@
50+
else
51+
@$(CXX) $(LIBPATHS) -Xlinker "-(" $^ -Wl,-Bstatic $(STATIC_LINKINGS) -Wl,-Bdynamic -Xlinker "-)" $(DYNAMIC_LINKINGS) -o $@
52+
endif
53+
54+
%.pb.cc %.pb.h:%.proto
55+
@echo "Generating $@"
56+
@$(PROTOC) --cpp_out=. --proto_path=. $(PROTOC_EXTRA_ARGS) $<
57+
58+
%.o:%.cpp
59+
@echo "Compiling $@"
60+
@$(CXX) -c $(HDRPATHS) $(CXXFLAGS) $< -o $@
61+
62+
%.o:%.cc
63+
@echo "Compiling $@"
64+
@$(CXX) -c $(HDRPATHS) $(CXXFLAGS) $< -o $@

0 commit comments

Comments
 (0)