diff options
author | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-10-18 00:45:11 +1100 |
---|---|---|
committer | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-10-18 00:45:11 +1100 |
commit | 85e5e0a460cd7a01d6e3e32b19e8aadd91f82b6a (patch) | |
tree | 052efbcef94ed807a787ca7684335057ec7cbd5c | |
parent | 8ef0b871725cf6fe31ceab34ae0b40aa905e05bf (diff) |
add fPIC to all builds (for now)
-rw-r--r-- | Makefile | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -1,6 +1,7 @@ CC := clang INCLUDES := -I./include -Ideps/glfw-3.3.8/include/GLFW -Ideps/stb_image -CFLAGS := -Wall -Wextra -O2 $(INCLUDES) +CFLAGS := -Wall -Wextra -O2 -fPIC $(INCLUDES) +# TODO(low prio): split static object files and shared object files so we can remove -fPIC from static lib builds LDFLAGS := -lglfw # Detect OS @@ -28,6 +29,7 @@ METAL_LIB := $(SHADER_OUT_DIR)/default.metallib # Library outputs STATIC_LIB := $(BUILD_DIR)/libceleritas.a +SHARED_FLAGS := -fPIC ifeq ($(UNAME_S),Darwin) SHARED_LIB := $(BUILD_DIR)/libceleritas.dylib SHARED_FLAGS := -dynamiclib @@ -36,7 +38,7 @@ ifeq ($(UNAME_S),Darwin) OBJS += $(OBJ_DIR)/backend_mtl.o else SHARED_LIB := $(BUILD_DIR)/libceleritas.so - SHARED_FLAGS := -shared -fPIC + SHARED_FLAGS := -shared endif ## Makefile notes @@ -61,7 +63,7 @@ $(STATIC_LIB): $(OBJS) @mkdir -p $(BUILD_DIR) ar rcs $@ $^ -shared: $(SHARED_LIB) +shared: $(SHARED_LIB) CFLAGS += static: $(STATIC_LIB) |