58 lines
1.1 KiB
Makefile
58 lines
1.1 KiB
Makefile
CC ?= gcc
|
|
ARCH ?= x86_64
|
|
TOOLCHAIN ?= musl
|
|
SHELL ?= /bin/sh
|
|
KVSFLIST := \
|
|
src/KVS/main.c \
|
|
src/KVS/tpm.c \
|
|
src/KVS/rmasmoke.c \
|
|
src/KVS/ui.c
|
|
|
|
CFLAGS := \
|
|
-Iinclude \
|
|
-g \
|
|
-O3 \
|
|
-Llib \
|
|
-static
|
|
|
|
ifeq ($(ARCH), aarch64)
|
|
CC := aarch64-linux-gnu-gcc
|
|
endif
|
|
|
|
ifeq ($(ARCH), armv7)
|
|
CC ?= armv7-linux-gnu-gcc
|
|
TOOLCHAIN := musleabihf
|
|
endif
|
|
|
|
TARGET = ${ARCH}-unknown-linux-${TOOLCHAIN}
|
|
|
|
all: clean build kvs kvg
|
|
|
|
kvs: build build/bin/kvs-$(ARCH)
|
|
kvg: build build/bin/kvg-$(ARCH)
|
|
kvg-c: build build/bin/kvg-c
|
|
|
|
build:
|
|
$(shell mkdir -p build/bin)
|
|
|
|
build/bin/kvs-$(ARCH): src/KVS/main.c
|
|
$(CC) $(KVSFLIST) -o build/bin/kvs-$(ARCH) $(CFLAGS)
|
|
chmod +rx build/bin/kvs-$(ARCH)
|
|
|
|
build/bin/kvg-$(ARCH): src/KVG/main.rs
|
|
cargo build --bin KVG --target=$(TARGET) --release
|
|
cp target/$(TARGET)/release/KVG build/bin/kvg-$(ARCH)
|
|
|
|
# The C version of KVS, not normally built.
|
|
# Also guaranteed to be out-of-date.
|
|
build/bin/kvg-c: src/KVG/main.c
|
|
$(CC) src/KVG/main.c -o build/bin/kvg-c $(CFLAGS)
|
|
chmod +rx build/bin/kvg-c
|
|
|
|
install:
|
|
cp -r build/* /usr/local/
|
|
|
|
clean:
|
|
rm -rf build
|
|
rm -rf target
|