From ab81287e279249f98372517c168281bb88122f3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B5=D1=82=D0=B0=D1=80=20=D0=9A=D0=B0=D0=BF=D1=80?= =?UTF-8?q?=D0=B8=D1=88?= Date: Wed, 12 May 2021 18:28:42 +0200 Subject: [PATCH] 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 --- Makefile | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 6dcf7c7..d479157 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,22 @@ -all: - gcc -lm fetchy.c -o /bin/fetchy +PREFIX = /usr/local + +CC = gcc +CFLAGS = -lm + +all: fetchy + +fetchy: + $(CC) $(CFLAGS) fetchy.c -o $@ clean: - rm fetchy + -rm -f fetchy -install: - gcc -lm fetchy.c -o /bin/fetchy +install: all + mkdir -p $(PREFIX)/bin + cp -f fetchy $(PREFIX)/bin + chmod 755 $(PREFIX)/bin/fetchy uninstall: - rm /bin/fetchy + -rm -f $(PREFIX)/bin/fetchy + +.PHONY: all install uninstall clean -- 2.43.0