summary refs log tree commit diff
path: root/Makefile
diff options
context:
space:
mode:
authoriurii plugatarov <[email protected]>2024-08-10 12:51:13 +0200
committeriurii plugatarov <[email protected]>2024-08-10 12:51:13 +0200
commit54e77f56abb2cbb1651bc1b12a94893d1edcd626 (patch)
tree051cad23348a79a0655adbf7907d916bfae972ba /Makefile
parent215d403fc8d4c87e982d57e3b9da628bfcc65d6d (diff)
downloadogl-54e77f56abb2cbb1651bc1b12a94893d1edcd626.tar.gz
conditional compile
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile13
1 files changed, 12 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 5e8d103..eb6a8e6 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,5 @@
+UNAME_S = $(shell uname -s)
+
 CC = clang
 CFLAGS = -Wall -Wextra -std=c11
 CFLAGS_DEBUG = $(CFLAGS) -g -O0
@@ -5,7 +7,7 @@ CFLAGS_RELEASE = $(CFLAGS) -O2
 TARGET = ogl
 SRC_DIR = src
 OUT_DIR = out
-LIBS = -lglfw -lGLEW -lGL
+LIBS = -lglfw -lGLEW 
 DEBUG_DIR = $(OUT_DIR)/debug
 RELEASE_DIR = $(OUT_DIR)/release
 INSTALL_DIR = /usr/local/bin
@@ -16,6 +18,15 @@ SRCS = $(wildcard $(SRC_DIR)/*.c)
 OBJS_DEBUG = $(patsubst $(SRC_DIR)/%.c,$(DEBUG_DIR)/%.o,$(SRCS))
 OBJS_RELEASE = $(patsubst $(SRC_DIR)/%.c,$(RELEASE_DIR)/%.o,$(SRCS))
 
+ifeq ($(UNAME_S), Darwin)
+	LIBS += -framework OpenGL 
+endif
+
+
+ifeq ($(UNAME_S), Linux)
+	LDFLAGS += -lGL
+endif
+
 all: debug release
 
 debug: $(DEBUG_DIR)/$(TARGET)