Skip to content

File compression

Compress any build artifact. The compression format is chosen by appending the relevant file suffix to the uncompressed file's name.

Compress file with xz

  • Target: build/${file}.xz
  • Built dependencies:
    • build/${file} - The file to compress.

Example

The following Makefile rule shows how to define a phony target build that generates the xz-compressed build/disk.raw.xz file from the build artifact build/disk.raw.

.PHONY: build
build: build/disk.raw.xz

This assumes the built dependency build/disk.raw can be generated by other rules which are not shown.

Compress file with gzip

  • Target: build/${file}.gz
  • Built dependencies:
    • build/${file} - The file to compress.