我想在这下面的代码行此命令的输出(也就是在我的makefile)来生成文件HEADER VAR分配,如:将makefile变量值分配给bash命令结果?
HEADER = $(shell for file in `find . -name *.h`;do echo $file; done)
的问题是,如果我打印的报头在我的makefile文件使用:
print:
@echo $(HEADER)
我得到
ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile ile
如果我直接在控制台运行此命令,并直接在我的生成文件是:
myaccount$ for file in `find . -name *.h`;do echo $file; done
./engine/helper/crypto/tomcrypt/headers/._tomcrypt_pk.h
./engine/helper/crypto/tomcrypt/headers/tomcrypt.h
./engine/helper/crypto/tomcrypt/headers/tomcrypt_argchk.h
./engine/helper/crypto/tomcrypt/headers/tomcrypt_cfg.h
./engine/helper/crypto/tomcrypt/headers/tomcrypt_cipher.h
./engine/helper/crypto/tomcrypt/headers/tomcrypt_custom.h
./engine/helper/crypto/tomcrypt/headers/tomcrypt_hash.h
./engine/helper/crypto/tomcrypt/headers/tomcrypt_mac.h
....
所以我得到我所有的头文件。我这样做是为了避免在我的makefile中手动指定所有的.h文件。
任何想法?
很不错的响应:),我这样做是这种方式,因为在我的for循环其实我执行更复杂的东西,所以我只是贴小片段在这里。非常感谢@ e.James。 – Goles