You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
881 B
Makefile

2 years ago
CC=gcc
CFLAGS=
LIB_FILE = libeasysock.so
.PHONY: all
all: $(LIB_FILE)
$(LIB_FILE): easysock.o
$(CC) $(CFLAGS) -shared easysock.o -o $(LIB_FILE)
2 years ago
easysock.o: easysock.c easysock.h
$(CC) $(CFLAGS) -fpic -c easysock.c -o easysock.o
2 years ago
.PHONY: allwarn
2 years ago
allwarn: CFLAGS+=-Wall -Wextra -pedantic
allwarn: $(LIB_FILE)
.PHONY: debug
2 years ago
debug: CFLAGS+=-g
debug: $(LIB_FILE)
.PHONY: static
static:
2 years ago
.PHONY: install
ifndef PREFIX
PREFIX := /usr/local
endif
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
install -m 644 docs/man3/*.gz /usr/share/man/man3/
.PHONY: clean
clean:
2 years ago
rm easysock.o
rm $(LIB_FILE)
.PHONY: uninstall
uninstall:
rm $(DESTDIR)$(PREFIX)/lib/$(LIB_FILE)
rm $(DESTDIR)$(PREFIX)/include/easysock.h