Skip to content

Instantly share code, notes, and snippets.

@amn
Created October 25, 2024 08:26
Show Gist options
  • Save amn/fa8b75db148abe55a8004451a5642e81 to your computer and use it in GitHub Desktop.
Save amn/fa8b75db148abe55a8004451a5642e81 to your computer and use it in GitHub Desktop.
A "reverse list" function for [GNU] Make

To reverse a list of words separated by white-space, the reverse can be called as a function with e.g. $(call reverse, a b c).

reverse = $(lastword $(1)) $(and $(1),$(call reverse,$(wordlist 1,$(shell echo $$(($(words $(1)) - 1))),$(1))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment