Browse code

Add OS support to Makefile

Robert Cranston authored on 27/02/2024 02:27:41
Showing 1 changed files

  • Makefile index aa98cf7..c542c95 100644
... ...
@@ -1,17 +1,35 @@
1
+ifeq ($(OS),Windows_NT)
2
+        OS = Windows
3
+        MICROGLUT = MicroGlut.c
4
+else ifeq ($(shell uname),Linux)
5
+        OS = Linux
6
+        MICROGLUT = MicroGlut.c
7
+else ifeq ($(shell uname),Darwin)
8
+        OS = Mac
9
+        MICROGLUT = MicroGlut.m
10
+endif
11
+
1 12
 COMMON = \
2 13
 	common/GL_utilities.c \
3 14
 	common/LoadTGA.c \
4
-	common/Linux/MicroGlut.c
15
+	common/$(OS)/$(MICROGLUT)
5 16
 CPPFLAGS += \
6 17
 	-Icommon \
7
-	-Icommon/Linux \
18
+	-Icommon/$(OS) \
8 19
 	-DGL_GLEXT_PROTOTYPES
9 20
 CXXFLAGS += \
10 21
 	-Wall
11
-LDLIBS += \
22
+LDLIBS_Windows += \
23
+	-lopengl32
24
+LDLIBS_Linux += \
12 25
 	-lXt \
13 26
 	-lX11 \
14
-	-lGL \
27
+	-lGL
28
+LDLIBS_Mac += \
29
+	-framework Cocoa \
30
+	-framework OpenGL
31
+LDLIBS += \
32
+	$(LDLIBS_$(OS)) \
15 33
 	-lm \
16 34
 	-lstdc++
17 35