Browse Source

Better OS detection in Makefile

Marco Bambini 8 years ago
parent
commit
ba8bac6d82
1 changed files with 9 additions and 1 deletions
  1. 9 1
      Makefile

+ 9 - 1
Makefile

@@ -15,9 +15,17 @@ CFLAGS = $(INCLUDE) -O2 -std=gnu99 -fgnu89-inline
 OBJ = $(SRC:.c=.o)
 
 ifeq ($(OS),Windows_NT)
+	# Windows
 	LDFLAGS = -lm -lShlwapi
 else
-	LDFLAGS = -lm -lrt
+	UNAME_S := $(shell uname -s)
+	ifeq ($(UNAME_S),Darwin)
+		# MacOS
+		LDFLAGS = -lm 
+	else
+		# Linux
+		LDFLAGS = -lm -lrt
+	endif
 endif
 
 all: unittest gravity