Adding a condition for Darwin kernels to use ncurses instead of ncursesw.

modified:   Makefile
This commit is contained in:
Brian Barto 2016-07-09 14:06:23 -04:00
parent 0496a3f7c8
commit 5aa1eb0485

View File

@ -1,3 +1,5 @@
UNAME := $(shell sh -c 'uname -s 2>/dev/null || echo not')
# Installation directories following GNU conventions # Installation directories following GNU conventions
prefix = /usr/local prefix = /usr/local
exec_prefix = $(prefix) exec_prefix = $(prefix)
@ -15,6 +17,7 @@ SRC=src
CC = gcc CC = gcc
CFLAGS = -Wextra -Wall CFLAGS = -Wextra -Wall
LDLIBS = -lncursesw LDLIBS = -lncursesw
DARWIN_LDLIBS = -lncurses
NCURSES_H = /usr/include/ncurses.h NCURSES_H = /usr/include/ncurses.h
.PHONY: all install uninstall clean .PHONY: all install uninstall clean
@ -23,10 +26,18 @@ EXES = nms sneakers
all: $(EXES) all: $(EXES)
nms: $(OBJ)/nms.o $(OBJ)/main.o | $(BIN) nms: $(OBJ)/nms.o $(OBJ)/main.o | $(BIN)
ifeq ($(UNAME),Darwin)
$(CC) $(CFLAGS) -o $(BIN)/$@ $^ $(DARWIN_LDLIBS)
else
$(CC) $(CFLAGS) -o $(BIN)/$@ $^ $(LDLIBS) $(CC) $(CFLAGS) -o $(BIN)/$@ $^ $(LDLIBS)
endif
sneakers: $(OBJ)/nms.o $(OBJ)/sneakers.o | $(BIN) sneakers: $(OBJ)/nms.o $(OBJ)/sneakers.o | $(BIN)
ifeq ($(UNAME),Darwin)
$(CC) $(CFLAGS) -o $(BIN)/$@ $^ $(DARWIN_LDLIBS)
else
$(CC) $(CFLAGS) -o $(BIN)/$@ $^ $(LDLIBS) $(CC) $(CFLAGS) -o $(BIN)/$@ $^ $(LDLIBS)
endif
$(OBJ)/%.o: $(SRC)/%.c | $(OBJ) $(NCURSES_H) $(OBJ)/%.o: $(SRC)/%.c | $(OBJ) $(NCURSES_H)
$(CC) $(CFLAGS) -o $@ -c $< $(CC) $(CFLAGS) -o $@ -c $<