asterinas/regression/Makefile

46 lines
1.5 KiB
Makefile
Raw Normal View History

2023-05-29 05:29:53 +00:00
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
CUR_DIR := $(patsubst %/,%,$(dir $(MKFILE_PATH)))
BUILD_DIR := $(CUR_DIR)/build
INITRAMFS := $(BUILD_DIR)/initramfs
2023-06-19 08:28:14 +00:00
RAMDISK := $(BUILD_DIR)/ramdisk.cpio.gz
SHELL := /bin/bash
ifneq (, $(wildcard $(INITRAMFS)/. ))
INITRAMFS_DIRS := $(shell find $(INITRAMFS) -type d 2>/dev/null | sed 's/ /\\ /g' | sed 's/:/\\:/g' || true)
INITRAMFS_FILES := $(shell find $(INITRAMFS) -type f 2>/dev/null | sed 's/ /\\ /g' | sed 's/:/\\:/g' || true)
endif
2023-05-29 05:29:53 +00:00
.PHONY: all clean
2023-05-29 05:29:53 +00:00
all: build
2023-05-29 05:29:53 +00:00
$(INITRAMFS):
@rm -rf $@ && mkdir -p $@
2023-05-29 05:29:53 +00:00
@# Mkdir necessary folders
2023-07-11 02:34:56 +00:00
@mkdir -p $@/bin $@/etc $@/sbin $@/usr/bin $@/root $@/tmp $@/opt $@/proc $@/dev $@/lib64 $@/lib/x86_64-linux-gnu
2023-07-05 06:08:58 +00:00
@# Install busybox
@/bin/busybox --install -s $@/bin
@cp /usr/bin/busybox $@/usr/bin
2023-05-29 05:29:53 +00:00
@# Copy necessary libs
2023-05-29 02:25:12 +00:00
@cp -L /lib64/ld-linux-x86-64.so.2 $@/lib64
@cp -L /lib/x86_64-linux-gnu/libc.so.6 $@/lib/x86_64-linux-gnu
@cp -L /lib/x86_64-linux-gnu/libstdc++.so.6 $@/lib/x86_64-linux-gnu
@cp -L /lib/x86_64-linux-gnu/libm.so.6 $@/lib/x86_64-linux-gnu
@cp -L /lib/x86_64-linux-gnu/libgcc_s.so.1 $@/lib/x86_64-linux-gnu
@cp -L /lib/x86_64-linux-gnu/libpthread.so.0 $@/lib/x86_64-linux-gnu
2023-05-29 05:29:53 +00:00
@# Copy from apps
@make --no-print-directory -C apps
ifeq ($(ENABLE_SYSCALL_TEST), 1)
@# Copy syscall test suite
@make --no-print-directory -C syscall_test
endif
2023-05-29 02:25:12 +00:00
$(RAMDISK): $(INITRAMFS) $(INITRAMFS_DIRS) $(INITRAMFS_FILES)
@echo "Generating the ramdisk image..."
2023-06-19 08:28:14 +00:00
@(cd $(INITRAMFS); find . | cpio -o -H newc | gzip) > $@
2023-05-29 05:29:53 +00:00
build: $(RAMDISK)
clean:
2023-05-29 05:29:53 +00:00
@rm -rf $(BUILD_DIR)