build: add make install/uninstall targets
This commit is contained in:
parent
9a7a77c2b7
commit
28a7137d6f
23
Makefile
23
Makefile
@ -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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user