2016-05-01 12:30:50 -07:00
|
|
|
# Installation directories following GNU conventions
|
|
|
|
prefix = /usr/local
|
|
|
|
exec_prefix = $(prefix)
|
|
|
|
bindir = $(exec_prefix)/bin
|
|
|
|
sbindir = $(exec_prefix)/sbin
|
|
|
|
datarootdir = $(prefix)/share
|
|
|
|
datadir = $(datarootdir)
|
|
|
|
includedir = $(prefix)/include
|
|
|
|
mandir = $(datarootdir)/man
|
|
|
|
|
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-05-12 12:06:35 -07:00
|
|
|
LDLIBS = -lncursesw
|
2016-04-27 22:25:18 -07:00
|
|
|
NCURSES_H = /usr/include/ncurses.h
|
2016-04-15 11:02:09 -07:00
|
|
|
|
2016-05-01 12:30:50 -07:00
|
|
|
.PHONY: all install uninstall clean
|
|
|
|
|
|
|
|
EXES = nms sneakers
|
|
|
|
all: $(EXES)
|
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-05-06 08:24:32 -07:00
|
|
|
if [ -a /etc/fedora-release ] ; \
|
|
|
|
then \
|
|
|
|
sudo dnf update --refresh ; \
|
|
|
|
sudo dnf install ncurses-devel ; \
|
|
|
|
elif [ -a /etc/redhat-release ] ; \
|
|
|
|
then \
|
|
|
|
sudo yum update ; \
|
|
|
|
sudo yum install ncurses-devel ; \
|
2016-05-06 09:17:47 -07:00
|
|
|
elif [ -a /etc/arch-release ] ; \
|
|
|
|
then \
|
|
|
|
sudo pacman -Sy ; \
|
|
|
|
sudo pacman -S ncurses ; \
|
2016-05-06 08:24:32 -07:00
|
|
|
else \
|
|
|
|
sudo apt-get update ; \
|
2016-05-12 12:06:35 -07:00
|
|
|
sudo apt-get install lib32ncurses5-dev lib32ncursesw5-dev ; \
|
2016-05-06 08:24:32 -07:00
|
|
|
fi
|
2016-04-15 11:02:09 -07:00
|
|
|
|
|
|
|
clean:
|
2016-04-27 21:51:47 -07:00
|
|
|
rm -rf $(BIN)
|
|
|
|
rm -rf $(OBJ)
|
2016-05-01 12:30:50 -07:00
|
|
|
|
|
|
|
install:
|
2016-05-20 13:13:33 -07:00
|
|
|
install -d $(DESTDIR)$(bindir)
|
|
|
|
cd $(BIN) && install $(EXES) $(DESTDIR)$(bindir)
|
2016-05-01 12:30:50 -07:00
|
|
|
|
|
|
|
uninstall:
|
2016-05-20 13:13:33 -07:00
|
|
|
for exe in $(EXES); do rm $(DESTDIR)$(bindir)/$$exe; done
|
2016-05-01 12:30:50 -07:00
|
|
|
|