diff options
Diffstat (limited to 'makefile')
-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)" |