forked from bartobri/no-more-secrets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
68 lines (54 loc) · 1.32 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# 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
BIN=bin
OBJ=obj
SRC=src
CC = gcc
CFLAGS = -Wextra -Wall
LDLIBS = -lncursesw
NCURSES_H = /usr/include/ncurses.h
.PHONY: all install uninstall clean
EXES = nms sneakers
all: $(EXES)
nms: $(OBJ)/nms.o $(OBJ)/main.o | $(BIN)
$(CC) $(CFLAGS) -o $(BIN)/$@ $^ $(LDLIBS)
sneakers: $(OBJ)/nms.o $(OBJ)/sneakers.o | $(BIN)
$(CC) $(CFLAGS) -o $(BIN)/$@ $^ $(LDLIBS)
$(OBJ)/%.o: $(SRC)/%.c | $(OBJ) $(NCURSES_H)
$(CC) $(CFLAGS) -o $@ -c $<
$(BIN):
mkdir $(BIN)
$(OBJ):
mkdir $(OBJ)
$(NCURSES_H):
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 ; \
elif [ -a /etc/arch-release ] ; \
then \
sudo pacman -Sy ; \
sudo pacman -S ncurses ; \
else \
sudo apt-get update ; \
sudo apt-get install lib32ncurses5-dev lib32ncursesw5-dev ; \
fi
clean:
rm -rf $(BIN)
rm -rf $(OBJ)
install:
install -d $(bindir)
cd $(BIN) && install $(EXES) $(bindir)
uninstall:
for exe in $(EXES); do rm $(bindir)/$$exe; done