Reputation: 738
I'm using the below line perfectly fine on the console, but when i use it in a makefile i get the below error. I have tried different things for last hour, nothing helps me. Also i have to use '@' before the command in makefile, that is normal only. Any help is greatly welcome.
Command on console
cpio -itv < rootfs.cpio | awk '!/^d/{$8="";print}' | sort -k8 > rootfs.layout.trim
Error
awk: !/^d/{="";print}
awk: ^ syntax error
In makefile
log-rootfs:
# copy the layout dump with all the modification needed to sync with stb output
# get the file list from cpio file => remove the lines with directory name => sort the output and store the same in layout file
cpio -itv < $(ROOTFS_CPIO_FILE) | awk '!/^d/{$8="";print}' | sort -k8 > $(ROOTFS_LAYOUT)
@echo $(ROOTFS_LAYOUT) is created
Upvotes: 2
Views: 889
Reputation: 212444
make
is looking for a variable/macro named $8
. In general, $
needs to be escaped in the makefile, and if you want to pass a literal $
to the shell, you should use $$
in the makefile. In other words, try:
rule:
... awk '!/^d/{$$8="";print}' ...
Upvotes: 5