forked from containers/libkrun
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
43 lines (32 loc) · 1.03 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
38
39
40
41
42
43
LIBRARY_HEADER = include/libkrun.h
INIT_BINARY = init/init
OS = $(shell uname -s)
LIBRARY_RELEASE_Linux = target/release/libkrun.so
LIBRARY_DEBUG_Linux = target/debug/libkrun.so
LIBRARY_RELEASE_Darwin = target/release/libkrun.dylib
LIBRARY_DEBUG_Darwin = target/debug/libkrun.dylib
LIBDIR_Linux = lib64
LIBDIR_Darwin = lib
ifeq ($(PREFIX),)
PREFIX := /usr/local
endif
ifeq ($(SEV),1)
FEATURE_FLAGS := --features amd-sev
endif
.PHONY: install clean
all: $(LIBRARY_RELEASE_$(OS))
debug: $(LIBRARY_DEBUG_$(OS))
$(INIT_BINARY): init/init.c
gcc -O2 -static -Wall -o $@ init/init.c
$(LIBRARY_RELEASE_$(OS)): $(INIT_BINARY)
cargo build --release $(FEATURE_FLAGS)
$(LIBRARY_DEBUG_$(OS)): $(INIT_BINARY)
cargo build --debug $(FEATURE_FLAGS)
install: $(LIBRARY_RELEASE_$(OS))
install -d $(DESTDIR)$(PREFIX)/$(LIBDIR_$(OS))/
install -m 755 $(LIBRARY_RELEASE_$(OS)) $(DESTDIR)$(PREFIX)/$(LIBDIR_$(OS))/
install -d $(DESTDIR)$(PREFIX)/include
install -m 644 $(LIBRARY_HEADER) $(DESTDIR)$(PREFIX)/include
clean:
rm -f $(INIT_BINARY)
cargo clean