-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
50 lines (37 loc) · 1.35 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
# SPDX-FileCopyrightText: Copyright 2024-2025 Sony Group Corporation
# SPDX-License-Identifier: MIT
CXX := g++
PLUGIN_INCLUDE_DIR := $(shell $(CXX) -print-file-name=plugin)
CXXFLAGS += -Wall -Wextra
CXXFLAGS += -I$(PLUGIN_INCLUDE_DIR)/include -fPIC -fno-rtti -O2 -std=c++14
ESSTRACORE_SOURCES := esstracore.cpp
ESSTRACORE := $(ESSTRACORE_SOURCES:.cpp=.so)
# hash functions
THIRD_PARTY_DIR = ../third-party
WJCRYPTLIB_DIR := $(THIRD_PARTY_DIR)/WjCryptLib/lib
WJCRYPTLIB_FILES := \
$(WJCRYPTLIB_DIR)/WjCryptLib_Md5.c \
$(WJCRYPTLIB_DIR)/WjCryptLib_Sha1.c \
$(WJCRYPTLIB_DIR)/WjCryptLib_Sha256.c
ESSTRACORE_SOURCES += $(WJCRYPTLIB_FILES)
CXXFLAGS += -I $(WJCRYPTLIB_DIR)
PREFIX ?= /usr/local
INSTALLDIR := $(PREFIX)/share/esstra
SPECFILE := $(shell dirname `gcc -print-libgcc-file-name`)/specs
.PHONY: all clean install install-specs uninstall-specs
all: $(ESSTRACORE)
$(WJCRYPTLIB_FILES):
(cd $(THIRD_PARTY_DIR) && git submodule init && git submodule update)
$(ESSTRACORE): $(ESSTRACORE_SOURCES)
$(CXX) -shared $(CXXFLAGS) $^ -o $@
install: $(ESSTRACORE)
install -m 755 -d $(INSTALLDIR)
install -m 755 $(ESSTRACORE) $(INSTALLDIR)
clean:
rm -f *.so
install-specs: $(INSTALLDIR)/$(ESSTRACORE)
gcc -dumpspecs | \
sed -E "N;s|\*cc1:\n(.+)$$|*cc1:\n\1 %{!fplugin:-fplugin=$(INSTALLDIR)/$(ESSTRACORE)}|" \
> $(SPECFILE)
uninstall-specs: $(SPECFILE)
rm -f $(SPECFILE)