2023-07-19 22:38:59 -04:00
|
|
|
# _,.---._ .-._ .--.-. ,--.--------.
|
|
|
|
# _,..---._ ,-.' , - `. /==/ \ .-._/==/ //==/, - , -\
|
|
|
|
# /==/, - \ /==/_, , - \|==|, \/ /, |==\ -\\==\.-. - ,-./
|
|
|
|
# |==| _ _\==| .=. |==|- \| | \==\- \`--`\==\- \
|
|
|
|
# |==| .=. |==|_ : ;=: - |==| , | -| `--`-' \==\_ \
|
|
|
|
# |==|,| | -|==| , '=' |==| - _ | |==|- |
|
|
|
|
# |==| '=' /\==\ - ,_ /|==| /\ , | |==|, |
|
|
|
|
# |==|-, _`/ '.='. - .' /==/, | |- | /==/ -/
|
|
|
|
# `-.`.____.' `--`--'' `--`./ `--` `--`--`
|
|
|
|
# _ __ ,---. .-._ .=-.-. _,.----.
|
|
|
|
# .-`.' ,`..--.' \ /==/ \ .-._ /==/_ /.' .' - \
|
|
|
|
# /==/, - \==\-/\ \ |==|, \/ /, /==|, |/==/ , ,-'
|
|
|
|
# |==| _ .=. /==/-|_\ | |==|- \| ||==| ||==|- | .
|
|
|
|
# |==| , '=',\==\, - \ |==| , | -||==|- ||==|_ `-' \
|
|
|
|
# |==|- '..'/==/ - ,| |==| - _ ||==| ,||==| _ , |
|
|
|
|
# |==|, | /==/- /\ - \|==| /\ , ||==|- |\==\. /
|
|
|
|
# /==/ - | \==\ _.\=\.-'/==/, | |- |/==/. / `-.`.___.-'
|
|
|
|
# `--`---' `--` `--`./ `--``--`-`
|
|
|
|
#
|
|
|
|
# @(#)Copyright (c) 2023, Nathan D. Fisher.
|
|
|
|
#
|
|
|
|
# This is free software. It comes with NO WARRANTY.
|
|
|
|
# Permission to use, modify and distribute this source code
|
|
|
|
# is granted subject to the following conditions.
|
|
|
|
# 1/ that the above copyright notice and this notice
|
|
|
|
# are preserved in all copies and that due credit be given
|
|
|
|
# to the author.
|
|
|
|
# 2/ that any changes to this code are clearly commented
|
|
|
|
# as such so that the author does not get blamed for bugs
|
|
|
|
# other than his own.
|
|
|
|
#
|
|
|
|
|
2023-07-19 23:42:04 -04:00
|
|
|
-include config.mk
|
|
|
|
|
2023-07-20 09:33:40 -04:00
|
|
|
PREFIX ?= /usr/local
|
|
|
|
includedir = $(DESTDIR)$(PREFIX)/include
|
|
|
|
libdir = $(DESTDIR)$(PREFIX)/lib
|
2023-07-19 22:38:59 -04:00
|
|
|
|
2023-07-22 19:01:49 -04:00
|
|
|
hdrs += include/bytes.h
|
2023-07-21 09:07:24 -04:00
|
|
|
hdrs += include/haggis.h
|
|
|
|
|
2023-07-20 22:50:22 -04:00
|
|
|
srcs += src/bytes.c
|
2023-07-20 09:33:40 -04:00
|
|
|
srcs += src/haggis.c
|
2023-07-19 22:38:59 -04:00
|
|
|
|
2023-07-21 09:07:24 -04:00
|
|
|
objs = $(srcs:.c=.o)
|
|
|
|
|
|
|
|
CFLAGS += -Wall -Werror
|
|
|
|
CFLAGS += -Iinclude
|
|
|
|
CFLAGS += -fPIC
|
2023-07-19 22:38:59 -04:00
|
|
|
|
2023-07-22 19:01:49 -04:00
|
|
|
LIBS += -lmd
|
|
|
|
|
2023-07-20 09:33:40 -04:00
|
|
|
all: libhaggis.a libhaggis.so
|
|
|
|
|
2023-07-21 09:07:24 -04:00
|
|
|
%.o: %.c
|
|
|
|
$(CC) $(CFLAGS) -o $@ -c $<
|
2023-07-20 09:33:40 -04:00
|
|
|
|
2023-07-21 09:07:24 -04:00
|
|
|
libhaggis.a: $(objs)
|
|
|
|
$(AR) rcs $@ $?
|
2023-07-20 09:33:40 -04:00
|
|
|
|
2023-07-21 09:07:24 -04:00
|
|
|
libhaggis.so: $(objs)
|
2023-07-22 19:01:49 -04:00
|
|
|
$(CC) -shared -o $@ $? $(LIBS)
|
2023-07-20 09:33:40 -04:00
|
|
|
|
2023-07-21 09:07:24 -04:00
|
|
|
install: libhaggis.a libhaggis.so haggis.h
|
2023-07-20 09:33:40 -04:00
|
|
|
[ -d $(includedir) ] || install -d $(includedir)
|
|
|
|
[ -d $(libdir) ] || install -d $(libdir)
|
|
|
|
install -m755 libhaggis.so $(libdir)/
|
|
|
|
install -m644 libhaggis.a $(libdir)/
|
2023-07-22 19:01:49 -04:00
|
|
|
install -m644 include/haggis.h $(includedir)/
|
2023-07-20 09:33:40 -04:00
|
|
|
|
2023-07-19 22:38:59 -04:00
|
|
|
clean:
|
2023-07-21 09:07:24 -04:00
|
|
|
rm -rf *.a *.so src/*.o
|
2023-07-19 22:38:59 -04:00
|
|
|
|
2023-07-21 09:07:24 -04:00
|
|
|
.PHONY: all clean install
|