108 lines
3.5 KiB
Makefile
108 lines
3.5 KiB
Makefile
include config.mk
|
|
|
|
.PHONY: all prepare log log_test pkg transaction istoreutils install clean static libglacier.a install_static libglacier-ng sha256 gsha256sum libglacier_verify gsign grepo
|
|
|
|
all: prepare log log_test pkg transaction istoreutils sha256 libglacier_verify gsha256sum gsign grepo
|
|
@echo "libglacier-ng has finished building"
|
|
|
|
static: prepare log_static pkg_static istoreutils_static libglacier.a
|
|
|
|
log_static:
|
|
$(CC) $(CFLAGS) -c src/log.c -o build/lib/tmp/log.o
|
|
|
|
pkg_static:
|
|
$(CC) $(CFLAGS) -c src/pkg.c -o build/lib/tmp/pkg.o
|
|
|
|
istoreutils_static: pkg_static
|
|
$(CC) $(CFLAGS) -c src/istoreutils.c -o build/lib/tmp/istoreutils.o
|
|
$(CC) $(CFLAGS) -c src/deps.c -o build/lib/tmp/deps.o
|
|
|
|
libglacier.a:
|
|
ar rcs build/lib/libglacier.a \
|
|
build/lib/tmp/log.o \
|
|
build/lib/tmp/pkg.o \
|
|
build/lib/tmp/istoreutils.o \
|
|
build/lib/tmp/deps.o
|
|
|
|
prepare:
|
|
mkdir -p build
|
|
mkdir -p build/lib
|
|
mkdir -p build/include
|
|
mkdir -p build/lib/tmp
|
|
mkdir -p build/lib/shared
|
|
mkdir -p build/include/glacier
|
|
mkdir -p build/bin
|
|
|
|
log:
|
|
$(CC) $(CFLAGS) src/log.c -c -o build/lib/tmp/log.o
|
|
cp src/log.h build/include/glacier/log.h
|
|
|
|
log_test:
|
|
$(CC) $(CFLAGS) -shared -fPIC src/log.c -o build/lib/shared/libglacier_log.so
|
|
|
|
sha256:
|
|
$(CC) $(CFLAGS) src/sha256.c -c -o build/lib/tmp/sha256.o
|
|
|
|
# Monocypher, vendored unmodified (src/monocypher/README): Ed25519 for
|
|
# sign.c.
|
|
MONOCYPHER = src/monocypher/monocypher.c src/monocypher/monocypher-ed25519.c
|
|
|
|
libglacier_verify:
|
|
$(CC) $(CFLAGS) -shared -fPIC src/sha256.c src/sign.c $(MONOCYPHER) \
|
|
-o build/lib/shared/libglacier_verify.so
|
|
|
|
gsha256sum: prepare
|
|
$(CC) $(CFLAGS) src/gsha256sum.c src/sha256.c -o build/bin/gsha256sum
|
|
|
|
gsign: prepare
|
|
$(CC) $(CFLAGS) src/gsign.c src/sign.c src/log.c $(MONOCYPHER) -o build/bin/gsign
|
|
|
|
# grepo reads packages (manifest, hash) and signs the index: built
|
|
# from source like gsign, so it needs no rpath to the shared objects.
|
|
grepo: prepare
|
|
$(CC) $(CFLAGS) src/grepo.c src/sign.c src/sha256.c src/log.c src/pkg.c \
|
|
src/istoreutils.c src/deps.c src/transaction.c $(MONOCYPHER) \
|
|
-larchive -lconfig -o build/bin/grepo
|
|
|
|
transaction: log istoreutils
|
|
$(CC) $(CFLAGS) -shared -fPIC src/transaction.c \
|
|
-Lbuild/lib/shared -lglacier_istoreutils -lglacier_log \
|
|
-Wl,-rpath,'$$ORIGIN' \
|
|
-o build/lib/shared/libglacier_transaction.so
|
|
|
|
istoreutils: pkg
|
|
$(CC) $(CFLAGS) -shared -fPIC src/istoreutils.c src/deps.c \
|
|
-Lbuild/lib/shared -lglacier_log -lglacier_pkg -larchive \
|
|
-Wl,-rpath,'$$ORIGIN' \
|
|
-o build/lib/shared/libglacier_istoreutils.so
|
|
|
|
pkg:
|
|
$(CC) $(CFLAGS) -shared -fPIC src/pkg.c \
|
|
-Lbuild/lib/shared -lglacier_log -lconfig \
|
|
-Wl,-rpath,'$$ORIGIN' \
|
|
-o build/lib/shared/libglacier_pkg.so
|
|
|
|
libglacier-ng: prepare
|
|
$(CC) $(CFLAGS) -shared -fPIC \
|
|
src/log.c src/pkg.c src/transaction.c src/istoreutils.c src/deps.c \
|
|
-larchive -lconfig \
|
|
-o build/lib/shared/libglacier-ng.so
|
|
|
|
install:
|
|
mkdir -p $(PREFIX)/lib/glacier/
|
|
install build/lib/shared/libglacier_log.so $(PREFIX)/lib/glacier/ -m 755
|
|
install build/lib/shared/libglacier_istoreutils.so $(PREFIX)/lib/glacier/ -m 755
|
|
install build/lib/shared/libglacier_transaction.so $(PREFIX)/lib/glacier/ -m 755
|
|
install build/lib/shared/libglacier_pkg.so $(PREFIX)/lib/glacier -m 755
|
|
install build/lib/shared/libglacier_verify.so $(PREFIX)/lib/glacier -m 755
|
|
install build/bin/gsha256sum $(PREFIX)/bin/ -m 755
|
|
install build/bin/gsign $(PREFIX)/bin/ -m 755
|
|
install build/bin/grepo $(PREFIX)/bin/ -m 755
|
|
|
|
install_static:
|
|
mkdir -p $(PREFIX)/lib/glacier
|
|
install build/lib/libglacier.a $(PREFIX)/lib/glacier/ -m 644
|
|
|
|
clean:
|
|
rm -rf build
|