Run make with Makefile in memory

Suppose I have an encrypted Makefile at hand, I want to write a Perl program to decrypt it and run it with it make -f

. Is this possible without writing the decrypted Makefile back to the hard drive?

+2


source to share


4 answers


Have your program write the decrypted Makefile to stdout and execute it to do -.

See man make, the part that says:



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

+8


source


You can try setting LD_PRELOAD at startup make

to give make

some fake fopen / fclose functions that read the makefile from memory.



0


source


make -f <(decrypt file)

      

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

PS you'll want to consider the swap space by saying that it shouldn't be changed.

Also it won't help with the files included first.

0


source


You can use an encrypted file system. The shell script can run the key agent, for the filesystem then make can start searching and saving everything to / from the encrypted filesystem. I successfully accomplished this using sshfs (not an encrypted filesystem, but an encrypted connection to a remote filesystem locked in a room).

0


source







All Articles