forked from Longhao-Chen/IPC-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
54 lines (43 loc) · 1.4 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
#
# @Author: Longhao.Chen <[email protected]>
# @Date: 2023-09-19 20:18:47
# @LastEditors: Longhao.Chen <[email protected]>
# @FilePath: /IPC-framework/Makefile
# Copyright (c) 2023 by Longhao.Chen, All Rights Reserved.
#
ROOT_DIR = $(shell pwd)
CXX = g++
MAKE = make
CXXFLAGS = -flto=auto -g -I $(ROOT_DIR)/include/ -fPIC -std=c++20 -lunwind -lunwind-x86_64 -O3 -march=native -Wall -Wextra
DESTDIR = /
TARGET = ipc_framework
# 目录名不要加 /
SUB_DIR = Message Transceiver BackEnd utils
SUB_DIR_TAGET = $(addsuffix .out, $(join $(addsuffix /, $(SUB_DIR)), $(SUB_DIR)))
export CXX
export MAKE
export CXXFLAGS
export TARGET
.PHONY: $(TARGET) $(SUB_DIR) test clean clean-all install uninstall
$(TARGET): lib$(TARGET).so
lib$(TARGET).so: $(SUB_DIR_TAGET)
$(CXX) -shared $(CXXFLAGS) $^ -o $@
$(SUB_DIR_TAGET): $(SUB_DIR)
$(SUB_DIR):
$(MAKE) -C $@
test: $(TARGET)
$(MAKE) -C test
install: $(TARGET) uninstall
mkdir -p $(DESTDIR)/usr/lib/x86_64-linux-gnu/
mkdir -p $(DESTDIR)/usr/include/IPC-framework/
cp libipc_framework.so $(DESTDIR)/usr/lib/x86_64-linux-gnu/
cp include/*.hpp $(DESTDIR)/usr/include/IPC-framework/
uninstall:
- rm -r $(DESTDIR)/usr/include/IPC-framework
- rm $(DESTDIR)/usr/lib/x86_64-linux-gnu/libipc_framework.so
clean:
- find -name *.o | xargs -I {} rm {}
- find -name *.out | xargs -I {} rm {}
- find -name *.d | xargs -I {} rm {}
clean-all: clean
- rm lib$(TARGET).so