2016-04-15 11:02:09 -07:00
|
|
|
BIN=bin
|
|
|
|
OBJ=obj
|
|
|
|
SRC=src
|
|
|
|
|
|
|
|
CC = gcc
|
2016-04-27 21:51:47 -07:00
|
|
|
CFLAGS = -Wextra -Wall
|
2016-04-18 08:12:56 -07:00
|
|
|
LDLIBS = -lncurses
|
2016-04-27 22:25:18 -07:00
|
|
|
NCURSES_H = /usr/include/ncurses.h
|
2016-04-28 17:36:35 -07:00
|
|
|
UNAME = $(shell uname)
|
2016-04-15 11:02:09 -07:00
|
|
|
|
2016-04-27 21:51:47 -07:00
|
|
|
all: nms sneakers
|
2016-04-18 09:00:57 -07:00
|
|
|
|
2016-04-27 21:51:47 -07:00
|
|
|
nms: $(OBJ)/nms.o $(OBJ)/main.o | $(BIN)
|
|
|
|
$(CC) $(CFLAGS) -o $(BIN)/$@ $^ $(LDLIBS)
|
2016-04-19 15:18:02 -07:00
|
|
|
|
2016-04-27 21:51:47 -07:00
|
|
|
sneakers: $(OBJ)/nms.o $(OBJ)/sneakers.o | $(BIN)
|
|
|
|
$(CC) $(CFLAGS) -o $(BIN)/$@ $^ $(LDLIBS)
|
2016-04-15 11:02:09 -07:00
|
|
|
|
2016-04-27 22:25:18 -07:00
|
|
|
$(OBJ)/%.o: $(SRC)/%.c | $(OBJ) $(NCURSES_H)
|
2016-04-27 21:51:47 -07:00
|
|
|
$(CC) $(CFLAGS) -o $@ -c $<
|
2016-04-19 15:18:02 -07:00
|
|
|
|
2016-04-27 21:51:47 -07:00
|
|
|
$(BIN):
|
|
|
|
mkdir $(BIN)
|
|
|
|
|
|
|
|
$(OBJ):
|
|
|
|
mkdir $(OBJ)
|
|
|
|
|
|
|
|
$(NCURSES_H):
|
2016-04-28 17:36:35 -07:00
|
|
|
ifeq ($(UNAME), Linux)
|
2016-04-27 21:51:47 -07:00
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install ncurses-dev
|
2016-04-28 17:36:35 -07:00
|
|
|
endif
|
|
|
|
ifeq ($(UNAME), CentOS)
|
|
|
|
sudo yum update
|
|
|
|
sudo yum install ncurses-dev
|
|
|
|
endif
|
|
|
|
ifeq ($(UNAME), Fedora)
|
|
|
|
sudo dnf update --refresh
|
|
|
|
sudo dnf install ncurses-dev
|
|
|
|
endif
|
2016-04-15 11:02:09 -07:00
|
|
|
|
|
|
|
clean:
|
2016-04-27 21:51:47 -07:00
|
|
|
rm -rf $(BIN)
|
|
|
|
rm -rf $(OBJ)
|