Added 'install' target for Makefile

Aadhavan Srinivasan 2 years ago
parent b91a2e5996
commit aa954570aa

@ -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

Loading…
Cancel
Save