Files
finit/test/test-root/Makefile
T
2021-02-24 18:48:26 +01:00

74 lines
1.3 KiB
Makefile

.PHONY: clean check
ARCH ?= x86_64
FINITBIN ?= ./sbin/finit
BBVER ?= 1.31.0
BBBIN = busybox-$(ARCH)
BBURL ?= https://www.busybox.net/downloads/binaries/$(BBVER)-defconfig-multiarch-musl/$(BBBIN)
binaries = ./bin/cat \
./bin/cp \
./bin/date \
./bin/echo \
./bin/env \
./bin/find \
./bin/kill \
./bin/ls \
./bin/mkdir \
./bin/mkfifo \
./bin/mknod \
./bin/mount \
./bin/printf \
./bin/pgrep \
./bin/ps \
./bin/rm \
./bin/sh \
./bin/sleep \
./bin/top \
./bin/touch
dirs = ./dev \
./etc \
./proc \
./sbin \
./sys \
./test_assets \
./tmp
_libs_src = $(shell ldd $(FINITBIN) | grep -Eo '/[^ ]+')
libs = $(foreach path,$(_libs_src),.$(path))
all: $(binaries) $(dirs) $(libs)
$(dirs):
mkdir -p $@
./bin/$(BBBIN):
wget -O $@ $(BBURL)
chmod +x ./bin/$(BBBIN)
md5sum -c $(BBBIN).md5
$(binaries): ./bin/$(BBBIN)
cd ./bin; \
rm -f $(notdir $@); \
ln -s $(BBBIN) $(notdir $@)
$(libs):
mkdir -p $(dir $@)
cp /$@ $@
clean:
rm -f ./bin/$(BBBIN)
rm -rf $(binaries)
rm -rf ./dev
rm -rf ./etc
rm -rf ./lib64
rm -rf ./proc
rm -rf ./sbin
rm -rf ./sys
rm -rf ./test_assets
rm -rf ./tmp
rm -rf ./usr
rm -rf ./var