diff options
author | EliteTK <tomasz.kramkowski@gmail.com> | 2014-10-07 22:53:49 +0100 |
---|---|---|
committer | EliteTK <tomasz.kramkowski@gmail.com> | 2014-10-07 22:53:49 +0100 |
commit | deface84e8df6aeb537eee1242fbd474c1b8293a (patch) | |
tree | 0bf45cdc56f1570bed5b047874924fbef86c9798 | |
parent | 7498ea52ef7e05b4cd2dfff9b62b0465891c9d9a (diff) | |
download | c-stuff-deface84e8df6aeb537eee1242fbd474c1b8293a.tar.gz c-stuff-deface84e8df6aeb537eee1242fbd474c1b8293a.tar.xz c-stuff-deface84e8df6aeb537eee1242fbd474c1b8293a.zip |
Added [un]install targets. Fixes #2
-rw-r--r-- | makefile | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -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)" |