Skip to content

Instantly share code, notes, and snippets.

@yottatsa
Last active January 3, 2022 11:35
Show Gist options
  • Select an option

  • Save yottatsa/acc12b009056d911f92828a32ddc6636 to your computer and use it in GitHub Desktop.

Select an option

Save yottatsa/acc12b009056d911f92828a32ddc6636 to your computer and use it in GitHub Desktop.
#!/bin/bash
# fixes make && auto** && gcc-3.3 build process
#
# $(srcdir)/treelang/parse.c $(srcdir)/treelang/parse.h: $(srcdir)/treelang/parse.y
# $(BISON) $(BISONFLAGS) -v $(srcdir)/treelang/parse.y\
# --output=$(srcdir)/treelang/parse.c --defines
#
# https://www.gnu.org/software/make/manual/html_node/Splitting-Recipe-Lines.html#Splitting-Recipe-Lines
FARG=$(echo -- $* | grep -o -- '-f *[^ ]*')
CARG=$(echo -- $* | grep -o -- '-C *[^ ]*')
if [ -n "${FARG}" ]
then
F="${FARG##-f }"
elif [ -n "${CARG}" ]
then
F="${CARG##-C }/Makefile"
else
F="Makefile"
fi
if [ -e "$F" ]
then
if ! [ -e "$F.sed" ]
then
cp "$F" "$F.sed"
sed -i 's,\\$, \\,' "$F"
fi
fi
exec /usr/bin/make.orig MAKE=/usr/bin/make "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment