Skip to content

Instantly share code, notes, and snippets.

@AuruTus
Created February 20, 2023 11:24
Show Gist options
  • Select an option

  • Save AuruTus/28fcbfabb8ee4c700bf91de1fdf2a7f9 to your computer and use it in GitHub Desktop.

Select an option

Save AuruTus/28fcbfabb8ee4c700bf91de1fdf2a7f9 to your computer and use it in GitHub Desktop.
Makefile useful hints and snippets
# TO MATCH FILES RECURSIVELY
## recursive wildcard
## use it like `SRC := ${call rwildcard, ., *.c *.o *.s}`
rwildcard := ${foreach d,${wildcard ${1:=/*}},${call rwildcard,$d,$2} ${filter ${subst *,%,$2},$d}}
## use find cmd
## NOTE: I prefer this one
SRC := ${shell find . -type f -name *.c -or -name *.o}
# How to prevent make echoing commands to the console
## just add `@` before this command
build:
@go build -o main main.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment