From 70c5ff84fb77e7e0e889ba36fe4100bc6e85abc5 Mon Sep 17 00:00:00 2001 From: Remzi Arpaci-Dusseau Date: Wed, 8 May 2019 13:24:29 -0500 Subject: [PATCH] Makefile fix for -pthread flag; don't use on link line on macOS --- threads-cv/Makefile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/threads-cv/Makefile b/threads-cv/Makefile index e3dd51a..a5d956a 100644 --- a/threads-cv/Makefile +++ b/threads-cv/Makefile @@ -1,5 +1,11 @@ CC := gcc -CFLAGS := -Wall -Werror -I../include +CFLAGS := -Wall -Werror -I../include -pthread + +OS := $(shell uname -s) +LIBS := +ifeq ($(OS),Linux) + LIBS += -pthread +endif SRCS := join.c \ join_spin.c \ @@ -16,7 +22,7 @@ PROGS := ${SRCS:.c=} all: ${PROGS} ${PROGS} : % : %.o Makefile - ${CC} $< -o $@ -pthread + ${CC} $< -o $@ ${LIBS} clean: rm -f ${PROGS} ${OBJS}