-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
68 lines (53 loc) · 2.16 KB
/
Copy pathMakefile
File metadata and controls
68 lines (53 loc) · 2.16 KB
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
60
61
62
63
64
65
66
67
68
# Compiler and Flags
CXX = g++
INCPATH = ../include
LD_LIBRARY_PATH= /home/tkmaher/searchengine/dynamicRanker/onnxruntime-linux-x64-gpu-1.21.1/lib
LD_INC_PATH="$(shell pwd)/../dynamicRanker/onnxruntime-linux-x64-gpu-1.21.1/include"
CXXFLAGS = -Wall -O2 -std=c++17 -g -I$(INCPATH) -pthread
# Source Files
SRC_FILES1 := $(shell find .. ! -name "runner.cpp" ! -name "indexserver.cpp" ! -name "model.cpp" ! -name "constructDataset.cpp" ! -name "driver.cpp" ! -name "test.cpp" ! -name "rank.cpp" ! -name "testQueryCompiler.cpp" -name "*.cpp")
SRC_FILES2 := $(shell find .. ! -name "runner.cpp" ! -name "server.cpp" ! -name "constructDataset.cpp" ! -name "test.cpp" ! -name "rank.cpp" ! -name "testQueryCompiler.cpp" -name "*.cpp")
# Library Flags
LDFLAGS = -L$(UTF8PROC_DIR) -Wl,-rpath,$(UTF8PROC_DIR) -lutf8proc -lssl -lcrypto
ifeq ($(OS),Windows_NT)
OPENSSL_DIR = /usr/include/openssl
INCLUDES = -I$(OPENSSL_DIR)
LDFLAGS += -L/usr/lib -L"$(shell pwd)/../index/stemmer/utf8proc"
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
# macOS specific settings
OPENSSL_DIR = /opt/homebrew/opt/openssl@3
INCLUDES = -I$(OPENSSL_DIR)/include
LDFLAGS += -L$(OPENSSL_DIR)/lib -L"$(shell pwd)/../index/stemmer/utf8proc"
RPATH_FLAG = -Wl,-rpath,"@executable_path/../index/stemmer/utf8proc"
else
# Linux specific settings
OPENSSL_DIR = /usr/include/openssl
INCLUDES = -I$(OPENSSL_DIR)
LDFLAGS += -L/usr/lib -L"$(shell pwd)/../index/stemmer/utf8proc"
RPATH_FLAG = -Wl,-rpath,"$(shell pwd)/../index/stemmer/utf8proc"
endif
endif
# Target Executable
TARGET1 = server
TARGET2 = indexserver
# Default Target
all: $(TARGET1)
# Build the target executable
$(TARGET1): $(SRC_FILES1:.cpp=.o)
$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) -lcurl $(RPATH_FLAG)
# Build the target executable (index)
$(TARGET2): $(SRC_FILES2:.cpp=.o)
$(CXXFLAGS) += -I$(LD_INC_PATH)
$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) -L$(LD_LIBRARY_PATH) -lonnxruntime $(RPATH_FLAG)
# Compile source files to object files
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
.PHONY: clean
# Clean up build artifacts
clean:
rm -f $(TARGET1) $(TARGET2)
rm $(SRC_FILES1:.cpp=.o) $(SRC_FILES2:.cpp=.o)
# Phony targets
.PHONY: all clean