aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEliteTK <tomasz.kramkowski@gmail.com>2014-10-07 22:53:49 +0100
committerEliteTK <tomasz.kramkowski@gmail.com>2014-10-07 22:54:49 +0100
commitdba42cfd6394d69d608330da145b24a940b64a59 (patch)
tree0bf45cdc56f1570bed5b047874924fbef86c9798
parent7498ea52ef7e05b4cd2dfff9b62b0465891c9d9a (diff)
downloadc-stuff-dba42cfd6394d69d608330da145b24a940b64a59.tar.gz
c-stuff-dba42cfd6394d69d608330da145b24a940b64a59.tar.xz
c-stuff-dba42cfd6394d69d608330da145b24a940b64a59.zip
Added [un]install targets. (And std is now gnu11) Fixes #2
-rw-r--r--makefile21
1 files 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 <filename>.c `make <filename>`'
+ @echo ' To install <filename> `make target=<filename> install`'
+ @echo ' To uninstall <filename> `make target=<filename> uninstall`'
% : %.c
$(CC) $(CFLAGS) -o $@ $^
+
+$(DESTDIR)$(PREFIX)$(BINDIR)/% : %
+ install -Dm755 "$^" "$@"
+
+install : $(DESTDIR)$(PREFIX)$(BINDIR)/$(target)
+
+uninstall :
+ rm "$(DESTDIR)$(PREFIX)$(BINDIR)/$(target)"