-
Notifications
You must be signed in to change notification settings - Fork 16
/
Makefile
44 lines (35 loc) · 1.24 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
CXX ?= g++
CXXFLAGS ?= -g
PKGS = libzmq openssl
MY_CXXFLAGS = $$($(PKG_CONFIG) --cflags $(PKGS))
PKG_CONFIG ?= pkg-config
LIBS = $$($(PKG_CONFIG) --libs $(PKGS))
LIBEXT ?= .so
LIBCOMPILECXXFLAGS ?= -fPIC
LIBNAME ?= libtlszmq$(LIBEXT).0
LIBCXXFLAGS ?= -shared -Wl,-soname,$(LIBNAME)
LN_S ?= ln -s
all: tlsserver tlsclient device
.SUFFIXES: .cpp .o .lo
LIBTLSZMQ = libtlszmq$(LIBEXT)
tlszmq.o tlszmq.lo: tlszmq.h
tlsexception.o tlsexception.lo: tlsexception.h
$(LIBNAME): tlszmq.lo tlsexception.lo
$(CXX) $(LIBCXXFLAGS) $(CXXFLAGS) -o $(LIBNAME) tlszmq.lo tlsexception.lo $(LIBS)
$(LIBTLSZMQ): $(LIBNAME)
rm -f $(LIBTLSZMQ)
$(LN_S) $(LIBNAME) $(LIBTLSZMQ)
tlsserver.o: tlszmq.h
tlsserver: tlsserver.o $(LIBTLSZMQ)
$(CXX) $(CPPFLAGS) $(MY_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) -o '$(@)' $(^) $(LIBS)
tlsclient.o: tlszmq.h
tlsclient: tlsclient.o $(LIBTLSZMQ)
$(CXX) $(CPPFLAGS) $(MY_CXXFLAGS) $(CXXFLAGS) -o '$(@)' $(^) $(LIBS)
device: device.o
$(CXX) $(CPPFLAGS) $(MY_CXXFLAGS) $(CXXFLAGS) -o '$(@)' $(^) $(LIBS)
.cpp.o:
$(CXX) -c $(CPPFLAGS) $(MY_CXXFLAGS) $(CXXFLAGS) -o '$(@)' '$(<)'
.cpp.lo:
$(CXX) -c $(CPPFLAGS) $(LIBCOMPILECXXFLAGS) $(CXXFLAGS) -o '$(@)' '$(<)'
clean:
rm -f tlsclient tlsserver device *.o *.lo $(LIBNAME) $(LIBTLSZMQ)