forked from hermit-os/loader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
46 lines (37 loc) · 869 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
44
45
46
arch ?= x86_64
target ?= $(arch)-unknown-hermit
release ?= 0
opt :=
rdir := debug
ifeq ($(release), 1)
opt := --release
rdir := release
endif
# Todo - make this feature toggleable
ifeq ($(arch), aarch64)
export HERMIT_APP ?= $(PWD)/data/$(arch)/hello_world
endif
CONVERT :=
RN :=
ifdef COMSPEC
RM := del
else
RM := rm -rf
endif
SYSROOT := $(shell rustc --print sysroot)
OBJCOPY := $(shell find $(SYSROOT) -name llvm-objcopy -o -name llvm-objcopy.exe)
ifeq ($(arch), x86_64)
CONVERT := $(OBJCOPY) --strip-debug -O elf32-i386 target/$(target)-loader/$(rdir)/rusty-loader
endif
.PHONY: all loader clean docs
all: loader
clean:
@cargo clean
docs:
@echo DOC
@cargo doc
loader:
@echo Build loader
echo "hermit app: $(HERMIT_APP)"
cargo build $(opt) -Z build-std=core,alloc -Z build-std-features=compiler-builtins-mem --target $(target)-loader.json
$(CONVERT)