提交 d96c3a0b90772f9895fc30745254ab1050ae48da

作者 LJH 李佳桓
1 个父辈 6ab888c9

add

正在显示 1 个修改的文件 包含 87 行增加0 行删除
  1 +
  2 +#--------------------------------------------------------------------
  3 +
  4 +CC = gcc
  5 +AR = ar cru
  6 +CFLAGS = -Wall -D_REENTRANT -D_GNU_SOURCE -g -fPIC
  7 +SOFLAGS = -shared
  8 +LDFLAGS = -lstdc++ -lpthread
  9 +
  10 +LINKER = $(CC)
  11 +LINT = lint -c
  12 +RM = /bin/rm -f
  13 +
  14 +LIBEVENT_INCL = -I$(HOME)/libevent/
  15 +LIBEVENT_LIB = -L$(HOME)/libevent -levent -lrt
  16 +
  17 +CFLAGS += $(LIBEVENT_INCL)
  18 +LDFLAGS += $(LIBEVENT_LIB)
  19 +
  20 +#--------------------------------------------------------------------
  21 +
  22 +LIBOBJS = sputils.o spioutils.o spiochannel.o \
  23 + spthreadpool.o event_msgqueue.o spbuffer.o sphandler.o \
  24 + spmsgblock.o spmsgdecoder.o spresponse.o sprequest.o \
  25 + spexecutor.o spsession.o speventcb.o spserver.o \
  26 + spdispatcher.o splfserver.o \
  27 + sphttpmsg.o sphttp.o spsmtp.o
  28 +
  29 +TARGET = libspserver.so libspserver.a \
  30 + testecho testthreadpool testsmtp testchat teststress testhttp \
  31 + testhttp_d testhttpmsg testdispatcher testchat_d testunp
  32 +
  33 +#--------------------------------------------------------------------
  34 +
  35 +all: $(TARGET)
  36 +
  37 +libspserver.so: $(LIBOBJS)
  38 + $(LINKER) $(SOFLAGS) $^ -o $@
  39 +
  40 +libspserver.a: $(LIBOBJS)
  41 + $(AR) $@ $^
  42 +
  43 +testthreadpool: testthreadpool.o
  44 + $(LINKER) $^ -L. -lspserver $(LDFLAGS) -o $@
  45 +
  46 +testsmtp: testsmtp.o
  47 + $(LINKER) $^ -L. -lspserver $(LDFLAGS) -o $@
  48 +
  49 +testchat: testchat.o
  50 + $(LINKER) $^ -L. -lspserver $(LDFLAGS) -o $@
  51 +
  52 +teststress: teststress.o
  53 + $(LINKER) $^ -L. -levent $(LDFLAGS) -o $@
  54 +
  55 +testecho: testecho.o
  56 + $(LINKER) $^ -L. -lspserver $(LDFLAGS) -o $@
  57 +
  58 +testhttp: testhttp.o
  59 + $(LINKER) $^ -L. -lspserver $(LDFLAGS) -o $@
  60 +
  61 +testhttp_d: testhttp_d.o
  62 + $(LINKER) $^ -L. -lspserver $(LDFLAGS) -o $@
  63 +
  64 +testhttpmsg: sputils.o sphttpmsg.o testhttpmsg.o
  65 + $(LINKER) $^ $(LDFLAGS) -o $@
  66 +
  67 +testdispatcher: testdispatcher.o
  68 + $(LINKER) $^ -L. -lspserver $(LDFLAGS) -o $@
  69 +
  70 +testchat_d: testchat_d.o
  71 + $(LINKER) $^ -L. -lspserver $(LDFLAGS) -o $@
  72 +
  73 +testunp: testunp.o
  74 + $(LINKER) $^ -L. -lspserver $(LDFLAGS) -o $@
  75 +
  76 +clean:
  77 + @( $(RM) *.o vgcore.* core core.* $(TARGET) )
  78 +
  79 +#--------------------------------------------------------------------
  80 +
  81 +# make rule
  82 +%.o : %.c
  83 + $(CC) $(CFLAGS) -c $^ -o $@
  84 +
  85 +%.o : %.cpp
  86 + $(CC) $(CFLAGS) -c $^ -o $@
  87 +
... ...
注册登录 后发表评论