From dba42cfd6394d69d608330da145b24a940b64a59 Mon Sep 17 00:00:00 2001 From: EliteTK Date: Tue, 7 Oct 2014 22:53:49 +0100 Subject: Added [un]install targets. (And std is now gnu11) Fixes #2 --- makefile | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/makefile b/makefile index 2985670..86bbfd3 100644 --- a/makefile +++ b/makefile @@ -1,7 +1,24 @@ -CFLAGS = -O2 -std=c11 +CFLAGS = -O2 -std=gnu11 + +PREFIX = /usr +BINDIR = /bin +INSPATH = $(DESTDIR)$(PREFIX)$(BINDIR) + +.PHONY : all install/% uninstall/% all: - echo "You did it wrong, you're supposed to give me a file to compile." + @echo 'Error, target not specified.' + @echo ' To compile .c `make `' + @echo ' To install `make target= install`' + @echo ' To uninstall `make target= uninstall`' % : %.c $(CC) $(CFLAGS) -o $@ $^ + +$(DESTDIR)$(PREFIX)$(BINDIR)/% : % + install -Dm755 "$^" "$@" + +install : $(DESTDIR)$(PREFIX)$(BINDIR)/$(target) + +uninstall : + rm "$(DESTDIR)$(PREFIX)$(BINDIR)/$(target)" -- cgit v1.2.3-54-g00ecf