-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
43 lines (35 loc) · 848 Bytes
/
Makefile
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
##
# Puff - a Huff compiler in Racket
#
# @file
# @version 0.1
KECCAK_LIB_DIR = rust_src/keccaklib
KECCAK_LIB_TARGET_DIR = $(KECCAK_LIB_DIR)/target/release
LIB_NAME = libkeccak_lib
LIB_DIR = lib
ifeq ($(OS),Windows_NT)
LIB_EXT = .dll
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
LIB_EXT = .so
endif
ifeq ($(UNAME_S),Darwin)
LIB_EXT = .dylib
endif
endif
deps: build_rust copy_lib
install: deps
racket install.rkt
build_rust:
@echo "Building Rust library..."
cd $(KECCAK_LIB_DIR) && cargo build --release
copy_lib:
@echo "Copying library to $(LIB_DIR) directory..."
mkdir -p $(LIB_DIR)
cp $(KECCAK_LIB_TARGET_DIR)/$(LIB_NAME)$(LIB_EXT) $(LIB_DIR)/$(LIB_NAME)$(LIB_EXT)
clean:
@echo "Cleaning up..."
cd $(KECCAK_LIB_DIR) && cargo clean
rm -f $(LIB_DIR)/$(LIB_NAME)$(LIB_EXT)
# end