Explorar o código

Better OS detection in Makefile

Marco Bambini %!s(int64=8) %!d(string=hai) anos
pai
achega
ba8bac6d82
Modificáronse 1 ficheiros con 9 adicións e 1 borrados
  1. 9 1
      Makefile

+ 9 - 1
Makefile

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