开发者

Run make with Makefile in memory

Suppose I have an encrypted Makefile on hand, I want to write a Perl program to decrypt it and run make -f with it. Is this possible without writing the decrypted Makefile bac开发者_JAVA百科k to harddisk?


Have your program write the decrypted Makefile to stdout and pipe it to make -.

See man make, the part that says:

If makefile is `-', the standard input is read.


You could try setting LD_PRELOAD when you run make to give make some fake fopen/fclose functions that read the makefile out of memory.


make -f <(decrypt file)

This will work on linux and some other systems. It does not rely on make supporting this functionality. It is done in the OS. See http://www.gnu.org/software/bash/manual/bashref.html#Process-Substitution

P.S. you will want to consider swap space, telling make not to swap.

Also this will not help with files included by the first.


You could use an encrypted file system. A shell script could launch a key agent, for the file system then the make can run retrieving and saving everything to/from the encrypted file system. I have done successfully done this with sshfs (not an encrypted file system, but an encrypted connection to a remote file system locked in a room).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜