-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
59 lines (48 loc) · 1.58 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
#
# SRT - Secure, Reliable, Transport
# Copyright (c) 2022 Sony Group Corporation.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
CXX = g++
CFLAGS = -I./
LDFLAGS = -shared
LDFLAGS += -fPIC
LDFLAGS += -Wl,-rpath-link
LIBS = -lsrt
LIBS += -lyaml-cpp
LIBS += -lprometheus-cpp-core
LIBS += -lprometheus-cpp-pull
SRT_EXPORTER_LIB = libsrtexp.so
INSTALL_DIR = /usr/local
LIB_INSTALL_DIR = $(INSTALL_DIR)/lib
INC_INSTALL_DIR = $(INSTALL_DIR)/include
CFG_INSTALL_DIR = /etc
INC_DIR = include
EXP_DIR = export
SRC_DIR = source
OBJ_DIR = source
SRT_EXPORTER_HEAD = $(wildcard $(INC_DIR)/*.hpp) $(wildcard $(EXP_DIR)/*.hpp) $(wildcard $(EXP_DIR)/*.h)
SRT_EXPORTER_SRC = $(wildcard $(SRC_DIR)/*.cpp)
SRT_EXPORTER_OBJ = $(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(SRT_EXPORTER_SRC))
all: target install
target: $(SRT_EXPORTER_LIB)
$(SRT_EXPORTER_LIB): $(SRT_EXPORTER_OBJ) $(SRT_EXPORTER_HEAD)
$(CXX) -o $@ $(SRT_EXPORTER_OBJ) $(LDFLAGS) $(LIBS)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp $(SRT_EXPORTER_HEAD)
$(CXX) $(CFLAGS) $(LDFLAGS) -c -o $@ $<
install: $(SRT_EXPORTER_LIB)
mkdir -p $(INC_INSTALL_DIR)/srtexp
mkdir -p $(CFG_INSTALL_DIR)/srtexp
cp $(SRT_EXPORTER_LIB) $(LIB_INSTALL_DIR)
cp ./export/*.* $(INC_INSTALL_DIR)/srtexp
cp ./config/*.* $(CFG_INSTALL_DIR)/srtexp
clean:
-rm $(SRC_DIR)/*.o
-rm libsrtexp.so
-rm $(LIB_INSTALL_DIR)/$(SRT_EXPORTER_LIB)
-rm -rf $(INC_INSTALL_DIR)/srtexp
-rm -rf $(CFG_INSTALL_DIR)/srtexp
.PHONY: all target install clean