Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions contrib/nix/Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
CC := $(shell command -v musl-clang 2>/dev/null || echo gcc)
CC := $(shell command -v musl-clang 2> /dev/null || echo gcc)
CFLAGS := -Os -static -ffunction-sections -fdata-sections
LDFLAGS := -Wl,--gc-sections
BUILDDIR ?= .
SRC := vmctl_init.c
OUT := $(BUILDDIR)/init
IMG := $(BUILDDIR)/init.img

.PHONY: clean
.PHONY: clean all

$(OUT): $(SRC)
@echo "Compiler: $(CC)"
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<

$(IMG): $(OUT)
Expand All @@ -19,3 +18,6 @@ all: $(IMG)

clean:
rm -f $(OUT) $(IMG)

print-%:
@echo $* = $($*)
8 changes: 2 additions & 6 deletions lib/qemu/nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,10 @@ _qemu_nix_create_nix_init () {
_require_program "$(command -v musl-clang 2> /dev/null || echo gcc)"

local make_path="${state_dir}/Makefile"
if [[ ! -f ${make_path} ]]; then
_add_pre_cmd "ln -s \"${BASEDIR}/contrib/nix/Makefile\" \"${make_path}\""
fi
_add_pre_cmd "cp -f \"${BASEDIR}/contrib/nix/Makefile\" \"${make_path}\""

local c_init_path="${state_dir}/vmctl_init.c"
if [[ ! -f ${c_init_path} ]]; then
_add_pre_cmd "ln -s \"${BASEDIR}/contrib/nix/vmctl_init.c\" \"${c_init_path}\""
fi
_add_pre_cmd "cp -f \"${BASEDIR}/contrib/nix/vmctl_init.c\" \"${c_init_path}\""

if [[ ${NIX_INIT_REBUILD} == "yes" ]]; then
_add_pre_cmd "make -C \"${state_dir}\" clean"
Expand Down