summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2016-02-14 18:20:47 -0500
committerTavian Barnes <tavianator@tavianator.com>2016-02-14 18:20:47 -0500
commit32fdf4a8263fd70d86f4e09fee167db5b0bdb27a (patch)
treea2308addfeaea65ffa3df19ee5241bcc093ba7f8 /Makefile
parent6bb99d8fa7fce2504bf5d5a57629db6b9f5babba (diff)
downloadbfs-32fdf4a8263fd70d86f4e09fee167db5b0bdb27a.tar.xz
Makefile: Add install and uninstall targets.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile16
1 files changed, 13 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index c98a51e..b80fa03 100644
--- a/Makefile
+++ b/Makefile
@@ -20,6 +20,10 @@ CFLAGS ?= -g -Wall
LDFLAGS ?=
DEPFLAGS ?= -MD -MP -MF $(@:.o=.d)
RM ?= rm -f
+INSTALL ?= install
+
+DESTDIR ?=
+PREFIX ?= /usr
LOCAL_CPPFLAGS := -D_DEFAULT_SOURCE -D_GNU_SOURCE -DBFS_VERSION=\"$(VERSION)\"
LOCAL_CFLAGS := -std=c99
@@ -33,6 +37,9 @@ all: bfs
bfs: bftw.o color.o eval.o main.o parse.o
$(CC) $(ALL_LDFLAGS) $^ -o $@
+release: CFLAGS := -O3 -flto -Wall -DNDEBUG
+release: bfs
+
%.o: %.c
$(CC) $(ALL_CFLAGS) -c $< -o $@
@@ -42,9 +49,12 @@ check: all
clean:
$(RM) bfs *.o *.d
-release: CFLAGS := -O3 -flto -Wall -DNDEBUG
-release: bfs
+install:
+ $(INSTALL) -D -m755 bfs $(DESTDIR)$(PREFIX)/bin/bfs
+
+uninstall:
+ $(RM) $(DESTDIR)$(PREFIX)/bin/bfs
-.PHONY: all check clean release
+.PHONY: all release check clean install uninstall
-include $(wildcard *.d)