replacing text with contents from another file

I'm trying to change the ramfs size in kernel .config automatically.

I have a ramfs_size file generated with du -s
cat ramfs_size
64512

I want to replace the linux .config's ramdisk size with the above value
CONFIG_BLK_DEV_RAM_SIZE=73728

Right now I'm doing something dumb like:
size=`cat ramfs_size`
linux_size=`awk -F'=' '/DEV_RAM_SIZE/ {print $2}' .config
sed -i 's/$linux_size/$size/g' .config

It's not working from Makefiles because I think it gets confused with the $ dereference... Is there a simpler awk/sed line I can do?

may not be dumb so much as uncuddled...unless there's a reverse typo it looks like you'd be able to achieve it once you properly wrap the inline function:

You'd posted:

size=`cat ramfs_size`
linux_size=`awk -F'=' '/DEV_RAM_SIZE/ {print $2}' .config
sed -i 's/$linux_size/$size/g' .config

Did you mean to say:

size=`cat ramfs_size`
linux_size=`awk -F'=' '/DEV_RAM_SIZE/ {print $2}' .config `
sed -i 's/$linux_size/$size/g' .config

Better yet:

size=$(cat ramfs_size)
linux_size=$(awk -F'=' '/DEV_RAM_SIZE/ {print $2}' .config )
sed -i 's/$linux_size/$size/g' .config

Whatever works, works, but backticks are too easily mistaken for nonsense...or left out...

Yes that's what I mean. Problem is I can't seem to invoke these lines in my Makefile. I think it gets confused with the $2 environment variable dereference.

did you re-check your makefile for the backticks? or try the alternate in-line formatting? back-ticks were deprecated for this very reason...although there may be others...