From 32fdf4a8263fd70d86f4e09fee167db5b0bdb27a Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sun, 14 Feb 2016 18:20:47 -0500 Subject: Makefile: Add install and uninstall targets. --- Makefile | 16 +++++++++++++--- README.md | 25 +++++++++++++++++++++++++ 2 files changed, 38 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) diff --git a/README.md b/README.md index b33464b..45a58c1 100644 --- a/README.md +++ b/README.md @@ -91,3 +91,28 @@ When `bfs` detects that its output is a terminal, it automatically colors its ou This makes it easier to identify relevant files at a glance. ![Screenshot](http://i.imgur.com/5V6Sxw5.png) + + +Try it! +------- + +To get `bfs`, download one of the [releases](https://github.com/tavianator/bfs/releases) or clone the [git repo](https://github.com/tavianator/bfs). +Then run + + $ make + +This will build the `bfs` binary in the current directory. +You can test it out: + + $ ./bfs -nohidden + +If you're interested in speed, you may want to build the release version instead: + + $ make clean + $ make release + +Finally, if you want to install it globally, run + + $ sudo make install + +If you're on Arch Linux, `bfs` is available in the [AUR](https://aur.archlinux.org/packages/bfs/). -- cgit v1.2.3