From fe9740317f031ac23272de6467789c9a3e5c65fe Mon Sep 17 00:00:00 2001 From: Xiao Pan Date: Sun, 16 Jun 2024 22:57:08 -0700 Subject: feat: auto get filenames when make so no need to manually add new filenames --- Makefile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 3568ed7..0cb548f 100644 --- a/Makefile +++ b/Makefile @@ -7,8 +7,16 @@ # For a command not to echo itself, prefix @ to the command # https://unix.stackexchange.com/a/740226/459013 -SH = alarm backlight bell ccgp cfg chmodef curlqb dateft dirnameall gita gitfork gitmetap gitmetar gitpu grrc il lastarg loop lsp mll mmi mpra mpva mpvy mvln mvtr mvtu news o orgext pa pq px qg qw rate reco rfp sbar ta time-uuid topa upd vinfo wh wtr xmq prp vip vpn dnd cgm ggm ccp u -PACMAN_HOOKS = setcap-intel_gpu_top.hook setcap-iotop-c.hook setcap-nethogs.hook +# SH = $(wildcard sh/*) will print filenames with sh/ dir (more about wildcard see `info make` ) +# - more make commands maybe able to substitute it to only basename, maybe see https://stackoverflow.com/a/14447924 +# I use `find sh -type f -printf '%f '` which only prints basename +# - note: "SH = $$(...)" seems replace ${SH} with $(...), so everytime I use ${SH}, shell command in $(...) is run once, which is not ideal +# - so I use "SH = $(shell ...)" to only run it once when assign variable +# alternative: `find sh -type f -execdir basename -a '{}' \+` +# busybox find does not support -printf and -execdir, so here's another alternative: `find sh -type f -exec basename -a '{}' \+` +# about $$: https://stackoverflow.com/q/28533059 +SH = $(shell find sh -type f -printf '%f ') +PACMAN_HOOKS = $(shell find pacman_hooks -type f -printf '%f ') PREFIX = /usr/local install: -- cgit v1.2.3-70-g09d2