From 02fa5f3702a3a1be1c0dc6176f2009124940a7a7 Mon Sep 17 00:00:00 2001 From: Nicholas Tay Date: Wed, 1 Dec 2021 01:39:09 +1100 Subject: Improve Makefile with changeable name + install function --- Makefile | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 7dc6a5a..050a149 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,18 @@ +NAME = passgen +PREFIX = $(HOME)/.local + CC = gcc -CFLAGS = -Wall -Wextra -Wshadow -Werror -pedantic +CFLAGS += -Wall -Wextra -Wshadow -Werror -pedantic + +default: $(NAME) -default: passgen +$(NAME): $(NAME).c config.h + $(CC) $(CFLAGS) -o $(NAME) $(NAME).c -passgen: passgen.c - $(CC) $(CFLAGS) -o passgen passgen.c +install: $(NAME) + install -d $(DESTDIR)$(PREFIX)/bin/ + install -m 755 $(NAME) $(DESTDIR)$(PREFIX)/bin/ clean: rm -f *.o - rm -f passgen + rm -f $(NAME) -- cgit