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 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'Makefile') 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) -- cgit v1.2.3