I want to ignore executable files that do not have an extension
For example:
gcc -o foo foo.c
I know I could add 'foo' to my .gitignore file, but if I decide to change the name of the executable I would need to update my .gitignore file...
I usually handle this using makefile hacks. In my Makefile i have the name of the executable $(name) and then I do this:
#first rule
all: gitignoreadd ... more depends
... some commands ...
gitignoreadd:
grep -v "$(name)" .gitignore > temp
echo $(name) >> temp
mv temp .gitignore
gitignoreremove:
grep -v "$(name)" .gitignore > temp
mv temp .gitignore
That rule can then just be a dependency of the make somewhere appropriate. Then you usually have a 'make clean' rule as follows:
clean: gitignoreremove
rm *.o *.othergarbagefiles $(name)
This should do the trick. It's a hack but it works for me. The only thing is that you must run make clean before changing the name to automatically clean everything up.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With