1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
# Copyright (c) 2017-2022 Brett Sheffield <[email protected]>
SHELL = /bin/sh
VERSION := @PACKAGE_VERSION@
ABIVERS := @PACKAGE_ABIVERS@
.SUFFIXES:
.SUFFIXES: .c .o
CFLAGS = -fPIC -I. -I../include
LIBNAME := librecast
HEADERS = ../include/$(LIBNAME).h $(sort $(wildcard ../include/$(LIBNAME)/*.h))
INSTALL ?= install
INSTALL_DATA := $(INSTALL) -m 644
LDCONFIG ?= ldconfig
PREFIX ?= /usr/local
LIBDIR := $(DESTDIR)$(PREFIX)/lib
INCLUDEDIR := $(DESTDIR)$(PREFIX)/include
OBJECTS := errors.o hash.o
ifeq ($(OSNAME),Linux)
OBJECTS = if_linux.o
else ifeq ($(OSNAME),NetBSD)
OBJECTS = if_netbsd.o
else
OBJECTS = if.o
endif
LDLIBS = -pthread -lpthread @LIBBLAKE3@ @LIBSODIUM@ @LIBLCRQ@
CFLAGS = -I../libs/blake3/c
#CFLAGS = -I/usr/local/lib
LDFLAGS = -L../libs/blake3/c
LIBS = -llcrq
SOFILES := liblibrecast.so
SONAME := liblibrecast.so.$(ABIVERS)
SOVFILES := $(foreach f,$(SOFILES),$f.$(VERSION))
ABIFILES := $(foreach f,$(SOFILES),$f.$(ABIVERS))
all: $(SOFILES)
liblibrecast.so: librecast.o $(OBJECTS)
$(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,-soname,$(SONAME) -o $@ $^ $(LDLIBS)
%.o: %.c %.h librecast_pvt.h $(HEADERS)
install: $(SOFILES)
$(INSTALL) -d $(LIBDIR)
$(INSTALL) -d $(INCLUDEDIR)
$(INSTALL) -d $(INCLUDEDIR)/librecast
$(INSTALL_DATA) liblibrecast.so $(LIBDIR)/liblibrecast.so.$(VERSION)
$(INSTALL_DATA) ../include/*.h $(INCLUDEDIR)
$(INSTALL_DATA) ../include/librecast/*.h $(INCLUDEDIR)/librecast
ln -sf liblibrecast.so.$(ABIVERS) $(LIBDIR)/liblibrecast.so
ln -sf liblibrecast.so.$(VERSION) $(LIBDIR)/liblibrecast.so.$(ABIVERS)
.PHONY: clean realclean uninstall
uninstall:
$(RM) $(foreach f,$(SOFILES),$(DESTDIR)$(LIBDIR)/$f.$(VERSION))
cd $(LIBDIR)/ && $(RM) $(SOFILES)
clean:
$(RM) *.o $(SOFILES) $(ABIFILES)
realclean: clean
|