Rewrite Makefile

The Makefile was rewritten in a more usual fashion, using make variables
and prerequisites in the expected manner. The install destination was
changed from /bin to the more typical /usr/local/bin.

When this program is packaged, this destination should be changed to
/usr/bin, since packaged programs are usually meant to be in this
directory, they could be overwritten with a call such as:
make PREFIX=/usr install
This commit is contained in:
Петар Каприш 2021-05-12 18:28:42 +02:00
parent 2f11d9dd16
commit ab81287e27

View file

@ -1,11 +1,22 @@
all: PREFIX = /usr/local
gcc -lm fetchy.c -o /bin/fetchy
CC = gcc
CFLAGS = -lm
all: fetchy
fetchy:
$(CC) $(CFLAGS) fetchy.c -o $@
clean: clean:
rm fetchy -rm -f fetchy
install: install: all
gcc -lm fetchy.c -o /bin/fetchy mkdir -p $(PREFIX)/bin
cp -f fetchy $(PREFIX)/bin
chmod 755 $(PREFIX)/bin/fetchy
uninstall: uninstall:
rm /bin/fetchy -rm -f $(PREFIX)/bin/fetchy
.PHONY: all install uninstall clean