made it so that zemaphore is used on mac, semaphore on linux, and other clean up

This commit is contained in:
Remzi Arpaci-Dusseau
2019-05-16 16:07:33 -05:00
parent bb639b166c
commit 3faa28e520
12 changed files with 146 additions and 35 deletions

View File

@@ -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 := dining_philosophers_deadlock.c \
dining_philosophers_deadlock_print.c \
@@ -9,7 +15,8 @@ SRCS := dining_philosophers_deadlock.c \
binary.c \
producer_consumer_works.c \
rwlock.c \
zemaphore.c
zemaphore.c \
throttle.c
OBJS := ${SRCS:c=o}
PROGS := ${SRCS:.c=}
@@ -18,7 +25,7 @@ PROGS := ${SRCS:.c=}
all: ${PROGS}
${PROGS} : % : %.o Makefile
${CC} $< -o $@ -pthread
${CC} $< -o $@ ${LIBS}
clean:
rm -f ${PROGS} ${OBJS}