Merge pull request #14 from apjanke/make-install

build: add make install/uninstall targets
This commit is contained in:
Brian Barto 2016-05-01 15:56:50 -04:00
commit 8aeecc1446

View File

@ -1,3 +1,13 @@
# 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 BIN=bin
OBJ=obj OBJ=obj
SRC=src SRC=src
@ -8,7 +18,10 @@ LDLIBS = -lncurses
NCURSES_H = /usr/include/ncurses.h NCURSES_H = /usr/include/ncurses.h
UNAME = $(shell uname) UNAME = $(shell uname)
all: nms sneakers .PHONY: all install uninstall clean
EXES = nms sneakers
all: $(EXES)
nms: $(OBJ)/nms.o $(OBJ)/main.o | $(BIN) nms: $(OBJ)/nms.o $(OBJ)/main.o | $(BIN)
$(CC) $(CFLAGS) -o $(BIN)/$@ $^ $(LDLIBS) $(CC) $(CFLAGS) -o $(BIN)/$@ $^ $(LDLIBS)
@ -42,3 +55,11 @@ endif
clean: clean:
rm -rf $(BIN) rm -rf $(BIN)
rm -rf $(OBJ) rm -rf $(OBJ)
install:
install -d $(bindir)
cd $(BIN) && install $(EXES) $(DESTDIR)$(bindir)
uninstall:
for exe in $(EXES); do rm $(DESTDIR)$(bindir)/$$exe; done