From aa954570aafdf103a947c717ad18d5bdd7f32b8a Mon Sep 17 00:00:00 2001 From: Rockingcool Date: Sat, 25 Mar 2023 08:59:15 -0500 Subject: [PATCH] Added 'install' target for Makefile --- Makefile | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 08092fe..aefed0c 100644 --- a/Makefile +++ b/Makefile @@ -2,20 +2,39 @@ CC=gcc CFLAGS= LIB_FILE = libeasysock.so -all: easysock.o +.PHONY: all +all: $(LIB_FILE) + + +$(LIB_FILE): easysock.o $(CC) $(CFLAGS) -shared easysock.o -o $(LIB_FILE) easysock.o: easysock.c easysock.h $(CC) $(CFLAGS) -fpic -c easysock.c -o easysock.o +.PHONY: allwarn allwarn: CFLAGS+=-Wall -Wextra -pedantic allwarn: $(LIB_FILE) + +.PHONY: debug debug: CFLAGS+=-g debug: $(LIB_FILE) - + +.PHONY: static static: -install: + +ifndef PREFIX + PREFIX := /usr/local +endif + +.PHONY: install +install: $(LIB_FILE) + install -d $(DESTDIR)$(PREFIX)/lib + install -m 755 $(LIB_FILE) $(DESTDIR)$(PREFIX)/lib + + install -d $(DESTDIR)$(PREFIX)/include + install -m 644 easysock.h $(DESTDIR)$(PREFIX)/include