Skip to content

Instantly share code, notes, and snippets.

@Pixailz
Created May 20, 2022 05:15
Show Gist options
  • Save Pixailz/6a9022f8b379b0e8b7063eaaf5de33fc to your computer and use it in GitHub Desktop.
Save Pixailz/6a9022f8b379b0e8b7063eaaf5de33fc to your computer and use it in GitHub Desktop.
# little script found on this repo https://github.com/gpoblon/libft
# need the see whats going one here (even in the make file, style method with tputs for the "cursor")
MYPATH=$(pwd)
CUR_MAKEFILE=$MYPATH/Makefile
if [ -e $CUR_MAKEFILE ]
then
echo "regenerate Makefile"
sed "`grep -n 'SRC =' $CUR_MAKEFILE | sed 's/:.*//'`, \$d" $CUR_MAKEFILE > NEWMAKEFILE
grep 'SRC =' $CUR_MAKEFILE >> NEWMAKEFILE
expr "$(find ./src | grep "\.c$" | sed -e 's/src\///' -e 's/\.\///' -e 's/$/\\/')" : "\(.*\).$" >> NEWMAKEFILE
echo "" >> NEWMAKEFILE
echo "INC_D = inc/" >> NEWMAKEFILE
sed "1, `grep -n 'INC_D =' $CUR_MAKEFILE | sed 's/:.*//'`d" $CUR_MAKEFILE >> NEWMAKEFILE
mv $CUR_MAKEFILE ~/Documents/.OLDMakefile
mv NEWMAKEFILE $CUR_MAKEFILE
echo "Makefile done (copy still alive in ~/Documents/.OLDMakefile)"
else
echo "Makefile not found."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment