Merge branch 'odin' of git.hitchhiker-linux.org:jeang3nie/seahag into odin

This commit is contained in:
Nathan Fisher 2023-08-28 20:35:26 -04:00
commit 1e6b8b9952
4 changed files with 27 additions and 13 deletions

1
.gitignore vendored
View file

@ -1,5 +1,4 @@
haggis
config.mk
test/output/
test/*
!test/*.c

View file

@ -39,13 +39,9 @@ CFLAGS += -Wall -Werror
CFLAGS += -Iinclude
CFLAGS += -fPIC
includedir = $(DESTDIR)$(PREFIX)/include
libdir = $(DESTDIR)$(PREFIX)/lib
hdrs += include/bytes.h
hdrs += include/haggis.h
hdrs += include/jobq.h
hdrs += include/linklist.h
srcs += bytes.c
srcs += haggis.c
@ -60,19 +56,28 @@ shared: libhaggis.so
static: libhaggis.a
$(srcs): $(hdrs)
libhaggis.a: $(objs)
$(AR) rcs $@ $?
libhaggis.so: $(objs)
$(CC) -shared -o $@ $? $(LIBS)
install: libhaggis.a libhaggis.so include/haggis.h
[ -d $(includedir) ] || install -d $(includedir)
[ -d $(libdir) ] || install -d $(libdir)
install -m755 libhaggis.so $(libdir)/
install -m644 libhaggis.a $(libdir)/
install: install_include install_shared install_static
install_include: include/haggis.h
@[ -d $(includedir) ] || install -d $(includedir)
install -m644 include/haggis.h $(includedir)/
install_static: libhaggis.a
@[ -d $(libdir) ] || install -d $(libdir)
install -m644 libhaggis.a $(libdir)/
install_shared: libhaggis.so
@[ -d $(libdir) ] || install -d $(libdir)
install -m755 libhaggis.so $(libdir)/
test: libhaggis.a
$(MAKE) -C test
@ -83,4 +88,5 @@ clean:
rm -rf *.a *.so *.o
$(MAKE) -C test clean
.PHONY: all shared static clean install testclean test
.PHONY: all shared static clean install install_include install_static \
install_shared testclean test

11
config.mk Normal file
View file

@ -0,0 +1,11 @@
prefix ?= /usr/local
bindir = $(DESTDIR)$(PREFIX)/bin
includedir = $(DESTDIR)$(PREFIX)/include
libdir = $(DESTDIR)$(PREFIX)/lib
sharedir = $(DESTDIR)$(PREFIX)/share
mandir = $(sharedir)/man
docdir = $(sharedir)/doc/haggis
# Comment this line if your OS ships libmd as part of libc
# (NetBSD, OpenBSD)
LIBS += -lmd
LIBS += -lpthread

View file

@ -32,9 +32,7 @@
#include <errno.h>
#include <limits.h> // PATH_MAX
#include <stddef.h>
#include <stdint.h> // uint<x>_t
#include <sys/syslimits.h>
#if defined(__FreeBSD__) || defined(__DragonFly__)
#include <sha.h>