-
Notifications
You must be signed in to change notification settings - Fork 28
/
Makefile
112 lines (76 loc) · 2.13 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# -----------------------------------------------------------
CC = gcc
CXX = g++
CFLAGS = -Wall -Iinclude/ -Isrc/ -Itest/ -ggdb -fPIC -O0 -D__EVENT_VERSION__=\"$(REALNAME)\"
LFLAGS = -ggdb -lpthread
SOFLAGS = -shared -Wl
LIBNAME = libevlite.so
SONAME = $(LIBNAME).4
REALNAME= $(LIBNAME).4.6.0
OS = $(shell uname)
#
# 利用git tag发布软件版本
#
#APPNAME=`git describe | awk -F- '{print $$1}'`
#VERSION=`git describe | awk -F- '{print $$2}'`
#MAJORVER=`git describe | awk -F- '{print $$2}' | awk -F. '{print $$1}'`
#
#LIBNAME=$(APPNAME).so
#SONAME=$(APPNAME).so.$(MAJORVER)
#REALNAME=$(APPNAME).so.$(VERSION)
#
OBJS = utils.o timer.o event.o \
threads.o \
message.o channel.o session.o \
iolayer.o
ifeq ($(OS),Linux)
# LFLAGS += -lrt -L/usr/local/lib -ltcmalloc_minimal
LFLAGS += -lrt
OBJS += epoll.o
else
OBJS += kqueue.o
endif
# Release, open it
# CFLAGS += DNDEBUG
# -----------------------------------------------------------
install : all
all : $(REALNAME)
$(REALNAME) : $(OBJS)
$(CC) $(SOFLAGS) $(LFLAGS) $^ -o $@
rm -rf $(SONAME); ln -s $@ $(SONAME)
rm -rf $(LIBNAME); ln -s $@ $(LIBNAME)
test : test_events test_addtimer echoserver-lock echoserver iothreads_dispatcher
test_events : test_events.o $(OBJS)
$(CC) $(LFLAGS) $^ -o $@
test_addtimer : test_addtimer.o $(OBJS)
$(CC) $(LFLAGS) $^ -o $@
echoserver-lock : accept-lock-echoserver.o $(OBJS)
$(CC) $(LFLAGS) $^ -o $@
echoclient : io.o echoclient.o $(OBJS)
$(CXX) $(LFLAGS) $^ -o $@
echoserver : io.o echoserver.o $(OBJS)
$(CXX) $(LFLAGS) $^ -o $@
echostress :
$(CC) -I/usr/local/include -L/usr/local/lib -levent test/echostress.c -o $@
iothreads_dispatcher : test_iothreads.o $(OBJS)
$(CC) $(LFLAGS) $^ -o $@
clean :
rm -rf *.o
rm -rf *.log
rm -rf *.core
rm -rf core.*
rm -rf vgcore.*
rm -rf $(SONAME)
rm -rf $(LIBNAME)
rm -rf $(REALNAME)
rm -rf test_events event.fifo
rm -rf test_addtimer echoclient echostress echoserver echoserver-lock iothreads_dispatcher
# --------------------------------------------------------
#
# gmake的规则
#
%.o : %.c
$(CC) $(CFLAGS) -c $^ -o $@
%.o : %.cpp
$(CXX) $(CFLAGS) -c $^ -o $@
VPATH = src:include:test