From 5aa1eb0485b2bbc54265e252fff5878bd79f224e Mon Sep 17 00:00:00 2001 From: Brian Barto Date: Sat, 9 Jul 2016 14:06:23 -0400 Subject: [PATCH] Adding a condition for Darwin kernels to use ncurses instead of ncursesw. modified: Makefile --- Makefile | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Makefile b/Makefile index 30457da..8b3caa4 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +UNAME := $(shell sh -c 'uname -s 2>/dev/null || echo not') + # Installation directories following GNU conventions prefix = /usr/local exec_prefix = $(prefix) @@ -15,6 +17,7 @@ SRC=src CC = gcc CFLAGS = -Wextra -Wall LDLIBS = -lncursesw +DARWIN_LDLIBS = -lncurses NCURSES_H = /usr/include/ncurses.h .PHONY: all install uninstall clean @@ -23,10 +26,18 @@ EXES = nms sneakers all: $(EXES) nms: $(OBJ)/nms.o $(OBJ)/main.o | $(BIN) +ifeq ($(UNAME),Darwin) + $(CC) $(CFLAGS) -o $(BIN)/$@ $^ $(DARWIN_LDLIBS) +else $(CC) $(CFLAGS) -o $(BIN)/$@ $^ $(LDLIBS) +endif sneakers: $(OBJ)/nms.o $(OBJ)/sneakers.o | $(BIN) +ifeq ($(UNAME),Darwin) + $(CC) $(CFLAGS) -o $(BIN)/$@ $^ $(DARWIN_LDLIBS) +else $(CC) $(CFLAGS) -o $(BIN)/$@ $^ $(LDLIBS) +endif $(OBJ)/%.o: $(SRC)/%.c | $(OBJ) $(NCURSES_H) $(CC) $(CFLAGS) -o $@ -c $<