forked from jpeach/spdy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
96 lines (77 loc) · 2.1 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Copyright (c) 2011 James Peach
#
# Licensed 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.
TSROOT := /opt/ats
PLATFORM := $(shell uname)
TSXS := $(TSROOT)/bin/tsxs
SUDO := sudo
CPPFLAGS := -D__STDC_FORMAT_MACROS=1 -I$(TSROOT)/include -Isrc/lib
CXXFLAGS := -std=c++11 -g -Wall -Wextra
ifeq ($(PLATFORM),Linux)
CXX := g++-4.7
CXXFLAGS += \
-fpic \
-Wno-unused-but-set-variable
LDFLAGS = -fpic
else ifeq ($(PLATFORM),Darwin)
CXX := xcrun clang++
CXXFLAGS += \
-stdlib=libc++
LDFLAGS := -stdlib=libc++ -g
endif
LinkProgram = $(CXX) $(LDFLAGS) -o $@ $^
LinkBundle = $(CXX) $(LDFLAGS) \
-bundle -Wl,-bundle_loader,$(TSROOT)/bin/traffic_server -o $@ $^
LinkShared = $(CXX) $(LDFLAGS) \
-shared -o $@ $^
Spdy_Objects := \
src/ts/http.o \
src/ts/io.o \
src/ts/protocol.o \
src/ts/spdy.o \
src/ts/stream.o \
src/ts/strings.o
LibSpdy_Objects := \
src/lib/spdy/message.o \
src/lib/spdy/strings.o \
src/lib/spdy/zstream.o
LibPlatform_Objects := \
src/lib/base/logging.o
Zlib_Test_Objects := \
src/test/stubs.o \
src/test/zstream.o
OBJECTS := \
$(Spdy_Objects) \
$(LibSpdy_Objects) \
$(LibPlatform_Objects) \
$(Zlib_Test_Objects)
TARGETS := spdy.so test.zlib
all: $(TARGETS)
install: spdy.so
$(SUDO) $(TSXS) -i -o $<
#$(SUDO) $(TSROOT)/bin/trafficserver restart
spdy.so: $(Spdy_Objects) $(LibSpdy_Objects) $(LibPlatform_Objects)
ifeq ($(PLATFORM),Darwin)
$(LinkBundle) -lz
else
$(LinkShared) -lz
endif
test.zlib: $(Zlib_Test_Objects) $(LibSpdy_Objects)
$(LinkProgram) -lz
test: test.zlib
for t in $^ ; do ./$$t ; done
clean:
@rm -f $(TARGETS) $(OBJECTS)
@rm -rf *.dSYM
.PHONY: all install clean test
# vim: set ts=8 noet :