makefile - GNU Make: sed doesn't work when piped inside of $(shell) -


here experimental makefile.

.secondexpansion:  ~/hello.txt:  $(shell echo '$$(@d)/')$(shell echo '$$(@f)' | sed -e 's/hello/bye/')     echo "$^" 

somehow sed command doesn't work, , make complains circular dependency

gmake: circular /users/sim/hello.txt <- /users/me/hello.txt dependency dropped. gmake: *** no rule make target `echo', needed `/users/me/hello.txt'.  stop. 

my expected behavior gnu make looking ~/bye.txt instead. doing wrong?

although can specify "bye.txt" explicitly in small example, i'd still know why sed command doesn't apply. thank help.

i don't understand why have $(shell echo '$$(@d)/'); why not write $$(@d)/ directly?

as second one, doesn't work because $(shell ...) function evaluated immediately, not during second expansion. need defer shell function writing $$(shell ...).

however, i'm not sure work. don't understand why you're doing this; assume there's larger context makes useful. because, can want above much more straightforwardly using static pattern rules:

~/hello.txt : %/hello.txt : %/bye.txt         echo "$^" 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -