2

我在控制台上使用下面的行非常好,但是当我在makefile中使用它时,我得到了下面的错误。过去一个小时我尝试了不同的东西,没有任何帮助。另外我必须在makefile中的命令之前使用'@',这只是正常的。非常欢迎任何帮助。

控制台上的命令

cpio -itv < rootfs.cpio | awk '!/^d/{$8="";print}' | sort -k8 > rootfs.layout.trim

错误

awk: !/^d/{="";print}
awk:       ^ syntax error

在生成文件中

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
4

1 回答 1

5

make正在寻找一个名为$8. 一般来说,$需要在makefile中进行转义,如果要向$shell传递文字,则应该$$在makefile中使用。换句话说,尝试:

rule:
  ... awk '!/^d/{$$8="";print}' ...
于 2013-08-27T13:47:46.283 回答