-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
66 lines (52 loc) · 1.39 KB
/
Makefile
File metadata and controls
66 lines (52 loc) · 1.39 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
# Makefile for Supabase C++ Library (Android/iOS)
CXX = g++
CXXFLAGS = -std=c++17 -fPIC -Wall -Wextra -Iinclude
LDFLAGS = -shared
LIBS =
# Directories
SRC_DIR = src
INC_DIR = include
BUILD_DIR = build
LIB_DIR = lib
# Source files
SOURCES = $(wildcard $(SRC_DIR)/*.cpp)
OBJECTS = $(SOURCES:$(SRC_DIR)/%.cpp=$(BUILD_DIR)/%.o)
# Library name
LIB_NAME = libsupabase
# Platform-specific library extensions
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
SHARED_LIB = $(LIB_DIR)/$(LIB_NAME).dylib
LDFLAGS += -dynamiclib
else
SHARED_LIB = $(LIB_DIR)/$(LIB_NAME).so
endif
STATIC_LIB = $(LIB_DIR)/$(LIB_NAME).a
# Default target
all: directories $(SHARED_LIB) $(STATIC_LIB)
# Create directories
directories:
@mkdir -p $(BUILD_DIR) $(LIB_DIR)
# Shared library
$(SHARED_LIB): $(OBJECTS)
$(CXX) $(LDFLAGS) -o $@ $^ $(LIBS)
# Static library
$(STATIC_LIB): $(OBJECTS)
ar rcs $@ $^
# Object files
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
# Clean build artifacts
clean:
rm -rf $(BUILD_DIR) $(LIB_DIR)
# Help
help:
@echo "Available targets:"
@echo " all - Build both shared and static libraries for Android/iOS"
@echo " clean - Remove build artifacts"
@echo " help - Show this help message"
@echo ""
@echo "Mobile Platform Support:"
@echo " - Android: Use with Android NDK"
@echo " - iOS: Use with Xcode toolchain"
.PHONY: all directories clean help