From 8526510a23573ad956e58ad81b96c0759050a0a2 Mon Sep 17 00:00:00 2001 From: kxmjbrqlpy Date: Tue, 29 Jul 2025 09:41:57 +0800 Subject: [PATCH] Add the capability to compile the md5-c static library and install it to a specified directory in the Makefile --- Makefile | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index bf12d4b..28d1c7a 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,23 @@ CC = gcc CFLAGS = -Wall -Wextra -O3 +all: md5 md5-lib + md5: md5.c main.c @$(CC) $(CFLAGS) -o md5 md5.c main.c clean: - @$(RM) md5 + @$(RM) md5 md5.o libmd5.a + +md5-lib: libmd5.a + +libmd5.a: md5.o + $(AR) crv $@ md5.o + +install: + mkdir -p $(DESTDIR)/lib/ + mkdir -p $(DESTDIR)/include/ + mkdir -p $(DESTDIR)/bin/ + cp libmd5.a $(DESTDIR)/lib/ + cp md5.h $(DESTDIR)/include + cp md5 $(DESTDIR)/bin