Makefile 1.71 KB
Newer Older
zhujiashun's avatar
zhujiashun committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

18 19
BRPC_PATH = ../../
include $(BRPC_PATH)/config.mk
20
CXXFLAGS = $(CPPFLAGS) -std=c++0x -DNDEBUG -O2 -D__const__= -pipe -W -Wall -fPIC -fno-omit-frame-pointer
21 22
HDRPATHS = -I$(BRPC_PATH)/output/include $(addprefix -I, $(HDRS))
LIBPATHS = -L$(BRPC_PATH)/output/lib $(addprefix -L, $(LIBS))
23
STATIC_LINKINGS += $(BRPC_PATH)/output/lib/libbrpc.a
gejun's avatar
gejun committed
24 25 26 27 28 29 30 31 32

SOURCES = $(wildcard *.cpp)
OBJS = $(addsuffix .o, $(basename $(SOURCES))) 

.PHONY:all
all: trackme_server

.PHONY:clean
clean:
33 34
	@echo "> Cleaning"
	rm -rf trackme_server $(OBJS)
gejun's avatar
gejun committed
35 36

trackme_server:$(OBJS)
37
	@echo "> Linking $@"
38
ifeq ($(SYSTEM),Linux)
39
	$(CXX) $(LIBPATHS) -Xlinker "-(" $^ -Wl,-Bstatic $(STATIC_LINKINGS) -Wl,-Bdynamic -Xlinker "-)" $(DYNAMIC_LINKINGS) -o $@
40
else ifeq ($(SYSTEM),Darwin)
41
	$(CXX) $(LIBPATHS) $^ $(STATIC_LINKINGS) $(DYNAMIC_LINKINGS) -o $@
42
endif
gejun's avatar
gejun committed
43 44

%.o:%.cpp
45 46
	@echo "> Compiling $@"
	$(CXX) -c $(HDRPATHS) $(CXXFLAGS) $< -o $@
gejun's avatar
gejun committed
47 48

%.o:%.cc
49 50
	@echo "> Compiling $@"
	$(CXX) -c $(HDRPATHS) $(CXXFLAGS) $< -o $@