diff options
author | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-10-05 17:44:50 +1000 |
---|---|---|
committer | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-10-05 17:44:50 +1000 |
commit | 8ce117f0b3fd4ceeb1d7058dde8793e4421ec076 (patch) | |
tree | afb228582dbceb6d9271b0dbd365223119f59d35 /Makefile | |
parent | 2c1a7d7f293c26d631e15cf4cbec542ac50994aa (diff) |
trying to get rust bindgen working
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -3,12 +3,16 @@ INCLUDES := -I./include -Ideps/glfw-3.3.8/include/GLFW CFLAGS := -Wall -Wextra -O2 $(INCLUDES) LDFLAGS := -lglfw +# Detect OS +UNAME_S := $(shell uname -s) + # Directories SRC_DIR := src BUILD_DIR := build OBJ_DIR := $(BUILD_DIR)/objs SHADER_DIR := assets/shaders SHADER_OUT_DIR := $(BUILD_DIR)/shaders +EXAMPLES_DIR := examples # Source files SRCS := $(wildcard $(SRC_DIR)/*.c $(SRC_DIR)/**/*.c) @@ -16,7 +20,14 @@ OBJS := $(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(SRCS)) # Library outputs STATIC_LIB := $(BUILD_DIR)/libceleritas.a -SHARED_LIB := $(BUILD_DIR)/libceleritas.so +ifeq ($(UNAME_S),Darwin) + SHARED_LIB := $(BUILD_DIR)/libceleritas.dylib + SHARED_FLAGS := -dynamiclib + LDFLAGS += -framework Foundation -framework CoreFoundation -framework CoreGraphics -framework AppKit +else + SHARED_LIB := $(BUILD_DIR)/libceleritas.so + SHARED_FLAGS := -shared +endif ## Makefile notes # $@ - target of current rule @@ -29,7 +40,7 @@ $(OBJ_DIR)/%.o: $(SRC_DIR)/%.c $(SHARED_LIB): $(OBJS) @mkdir -p $(BUILD_DIR) - $(CC) -shared -o $@ $^ $(LDFLAGS) + $(CC) $(SHARED_FLAGS) -o $@ $^ $(LDFLAGS) $(STATIC_LIB): $(OBJS) @mkdir -p $(BUILD_DIR) @@ -42,6 +53,12 @@ static: $(STATIC_LIB) .PHONY: all all: shared static +.PHONY: triangle +triangle: build/triangle.bin + +build/triangle.bin: $(EXAMPLES_DIR)/triangle.c $(STATIC_LIB) + @mkdir -p $(BUILD_DIR) + $(CC) $(CFLAGS) $< -o $@ -L$(BUILD_DIR) -lceleritas $(LDFLAGS) .PHONY: clean clean: |