-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
52 lines (41 loc) · 1.2 KB
/
Makefile
File metadata and controls
52 lines (41 loc) · 1.2 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
# Compiler settings - Can be customized.
CXX = g++
CXXFLAGS = -Wall -Iinclude -std=c++11 -O2
LDFLAGS = -lcurl -lssl -lcrypto
# Build directories
SRC_DIR = src
INCLUDE_DIR = include
OBJ_DIR = obj
LIB_DIR = lib
# Installation directories
PREFIX = /usr/local
INSTALL_LIB_DIR = $(PREFIX)/lib
INSTALL_INCLUDE_DIR = $(PREFIX)/include/kyte
# Library target
LIB_TARGET = $(LIB_DIR)/libkyte.a
# Source files for the library
LIB_SOURCES = $(wildcard $(SRC_DIR)/*.cpp)
LIB_OBJECTS = $(LIB_SOURCES:$(SRC_DIR)/%.cpp=$(OBJ_DIR)/%.o)
# Default target
all: build $(LIB_TARGET)
build:
@mkdir -p $(OBJ_DIR) $(LIB_DIR) # Ensure the object and library directories exist
$(LIB_TARGET): $(LIB_OBJECTS)
@mkdir -p $(LIB_DIR)
ar rcs $@ $(LIB_OBJECTS)
# Generic rule for compiling C++ files to objects
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
# Clean up
clean:
rm -f $(OBJ_DIR)/*.o $(LIB_TARGET)
@echo "Cleanup complete."
# Install the library and headers
install:
@echo "Installing library..."
@mkdir -p $(INSTALL_LIB_DIR)
@mkdir -p $(INSTALL_INCLUDE_DIR)
@cp $(LIB_TARGET) $(INSTALL_LIB_DIR)
@cp $(INCLUDE_DIR)/*.hpp $(INSTALL_INCLUDE_DIR)
@echo "Installation complete."
.PHONY: all clean build install