From c8639e4c1eb7edf488aa7a46d7c1a38f31b6b78a Mon Sep 17 00:00:00 2001 From: night0721 Date: Tue, 22 Oct 2024 01:25:57 +0100 Subject: [PATCH] Update Makefile --- Makefile | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 3af273d..0c45ed0 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,36 @@ -vernam: vernam.c - gcc -o vernam vernam.c -all: - vernam +.POSIX: +.SUFFIXES: + +VERSION = 1.0 +TARGET = vernam +PREFIX ?= /usr/local +BINDIR = $(PREFIX)/bin + +CFLAGS = -O3 -march=native -mtune=native -pipe -s -std=c99 -pedantic -Wall + +SRC = vernam.c + +$(TARGET): $(SRC) + $(CC) $(SRC) -o $@ $(CFLAGS) $(LDFLAGS) + +dist: + mkdir -p $(TARGET)-$(VERSION) + cp -R README.md $(TARGET) $(TARGET)-$(VERSION) + tar -cf $(TARGET)-$(VERSION).tar $(TARGET)-$(VERSION) + gzip $(TARGET)-$(VERSION).tar + rm -rf $(TARGET)-$(VERSION) + +install: $(TARGET) + mkdir -p $(DESTDIR)$(BINDIR) + cp -p $(TARGET) $(DESTDIR)$(BINDIR)/$(TARGET) + chmod 755 $(DESTDIR)$(BINDIR)/$(TARGET) + +uninstall: + rm $(DESTDIR)$(BINDIR)/$(TARGET) + +clean: + rm $(TARGET) + +all: $(TARGET) + +.PHONY: all dist install uninstall clean