Makefile 909 Bytes
Newer Older
Stefan Lankes's avatar
Stefan Lankes committed
1
2
3
4
5
6
7
8
9
10
11
12
arch ?= x86_64
target ?= $(arch)-unknown-hermit
release ?= 0

opt :=
rdir := debug

ifeq ($(release), 1)
opt := --release
rdir := release
endif

13
14
15
# Todo - make this feature toggleable
ifeq ($(arch), aarch64)
opt += --features "aarch64-qemu-stdout"
16
export HERMIT_APP ?= $(PWD)/data/$(arch)/hello_world
17
18
endif

19
CONVERT :=
Stefan Lankes's avatar
Stefan Lankes committed
20
21
22
23
24
25
RN :=
ifdef COMSPEC
RM := del
else
RM := rm -rf
endif
26
SYSROOT := $(shell rustc --print sysroot)
27
OBJCOPY := $(shell find $(SYSROOT) -name llvm-objcopy -o -name llvm-objcopy.exe)
28
29
30
ifeq ($(arch), x86_64)
CONVERT := $(OBJCOPY) --strip-debug -O elf32-i386 target/$(target)-loader/$(rdir)/rusty-loader
endif
Stefan Lankes's avatar
Stefan Lankes committed
31

Stefan Lankes's avatar
Stefan Lankes committed
32
.PHONY: all loader clean docs
Stefan Lankes's avatar
Stefan Lankes committed
33
34
35
36
37
38
39
40
41
42
43
44

all: loader

clean:
	@cargo clean

docs:
	@echo DOC
	@cargo doc

loader:
	@echo Build loader
45
	echo "hermit app: $(HERMIT_APP)"
46
	cargo build $(opt) -Z build-std=core,alloc -Z build-std-features=compiler-builtins-mem --target $(target)-loader.json
47
	$(CONVERT)