0

I'm a newbie with Linux, I'm using for few days, I'm trying to edit a makefile, adding a line in the CFLAGS field, via gedit, but when I compile the file It reverse back to the original version, losing the addition. How can I edit permanently a makefile?

2 Answers 2

1

What command are you using to compile? It sounds like the compiling system is automatically generating a Makefile, which overwrites the version you're editing. You may need to edit the file the compilation program uses to generate the Makefile instead. For example, if you're using autotools (the standard "./configure; make; sudo make install" deal) you should edit Makefile.am or Makefile.in.

0

Make the file immutable with chattr +i Makefile command. That will prevent everything from modifying the file.

1
  • since I had to edit the CFLAGS I needed to set sudo chattr +i, but now when I try to configure the file several "permission denied" print out and the process stops. update: I've unlocked the file with the sudo chattr -i command and now I can configure the file, but I'm back at the starting point.
    – Axel
    Dec 1, 2014 at 15:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .