File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -62,10 +62,27 @@ check-toolchain:
6262% -build : check-toolchain
6363 CROSS_CONTAINER_ENGINE=$(CROSS_CONTAINER_ENGINE ) RUSTFLAGS=" $( RUSTFLAGS) " $(CARGO_RUNNER ) +nightly build --all-targets --target $* $(if $(TARGET_PROFILE ) ,--profile $(TARGET_PROFILE ) ) $(CARGO_FLAGS )
6464
65+ # Create a compressed cpio archive containing a binary renamed to 'init'.
66+ # Usage: $(call create-init-cpio,<source-binary>,<output-base-path>)
67+ # Produces: <output-base-path>.cpio.gz
68+ define create-init-cpio
69+ tmp=$$(mktemp -d ) && \
70+ cp "$(1 ) " "$$tmp/init" && \
71+ (cd "$$tmp" && find init | cpio --create --format=newc --quiet > "$(abspath .) /$(2 ) .cpio") && \
72+ gzip --best --force "$(abspath .) /$(2 ) .cpio" && \
73+ rm -rf "$$tmp"
74+ endef
75+
6576% -cpio : T=target/$* /$(if $(TARGET_PROFILE ) ,$(TARGET_PROFILE ) ,debug)
6677% -cpio : % -build
67- cd $T && find init | cpio --create --format=newc > init-$* .cpio
68- cd $T && gzip --keep --best --force init-$* .cpio
78+ @echo " Packaging: $T /init"
79+ @$(call create-init-cpio,$T/init,$T/init-$* )
80+ @for bin in $T /examples/* ; do \
81+ [ -f " $$ bin" ] && [ -x " $$ bin" ] || continue ; \
82+ name=$$(basename "$$bin") ; \
83+ echo " Packaging: $T /examples/$$ name" ; \
84+ $(call create-init-cpio,$$bin,$T/examples/$$name) ; \
85+ done
6986
7087clean :
7188 cargo clean
You can’t perform that action at this time.
0 commit comments