-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
37 lines (30 loc) · 1.27 KB
/
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
# Originally from the project dannyhammer/toad on GitHub.
# See: https://github.com/dannyhammer/toad/blob/main/Makefile
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# If on Windows, add the .exe extension to the executable and use PowerShell instead of `sed`
ifeq ($(OS),Windows_NT)
EXT := .exe
NAME := $(shell powershell -Command "(Get-Content Cargo.toml | Select-String '^name =').Line -replace '.*= ', '' -replace '\"', ''")
VERSION := $(shell powershell -Command "(Get-Content Cargo.toml | Select-String '^version =').Line -replace '.*= ', '' -replace '\"', ''")
else
EXT :=
NAME := $(shell sed -n '0,/^name = "\(.*\)"/s//\1/p' Cargo.toml)
VERSION := $(shell sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml)
endif
# OpenBench specifies that the binary name should be changeable with the EXE parameter
ifndef EXE
EXE := $(NAME)-$(VERSION)$(EXT)
else
EXE := $(EXE)$(EXT)
endif
# Compile an executable for use with OpenBench
openbench:
@echo Compiling $(EXE) for OpenBench
cargo rustc --release --bin byte-knight -- -C target-cpu=native --emit link=$(EXE)
# Remove the EXE created
clean:
@echo Removing $(EXE)
rm $(EXE)