--- makefile.orig	2013-02-18 10:20:14.000000000 +0100
+++ makefile	2013-02-18 10:20:33.000000000 +0100
@@ -1,16 +1,16 @@
 CXX_FLAGS=-O3
 all:
-	echo -n const char *lua_code = \" > lua_code.h
-	cat luash.lua | sed 's/\\/\\\\/g' | sed 's/\"/\\\"/g' | gawk '{ print $$0"\\n" }' | tr -d '\n' >> lua_code.h
-	echo "\";" >> lua_code.h
-	g++ -o luash luash.cpp ${CXX_FLAGS} -llua -lreadline
+	/bin/echo -n const char *lua_code = \" > lua_code.h
+	cat luash.lua | sed 's/\\/\\\\/g' | sed 's/\"/\\\"/g' | awk '{ print $$0"\\n" }' | tr -d '\n' >> lua_code.h
+	/bin/echo "\";" >> lua_code.h
+	$(CXX) -o luash luash.cpp ${CXX_FLAGS} -llua -lreadline
 
 clean:
 	!(test -e lua_code.h) || rm lua_code.h
 	!(test -e luash) || rm luash
 
 install:
-	if [ "${PREFIX}" == "" ]; then cp luash /usr/local/bin/; else cp luash "${PREFIX}/bin/"; fi
+	if [ "${PREFIX}" == "" ]; then cp luash /usr/local/bin/; else cp luash "$(DESTDIR)${PREFIX}/bin/"; fi
 
 uninstall:
-	if [ "${PREFIX}" == "" ]; then rm /usr/local/bin/luash; else rm "${PREFIX}/bin/luash"; fi
+	if [ "${PREFIX}" == "" ]; then rm /usr/local/bin/luash; else rm "$(DESTDIR)${PREFIX}/bin/luash"; fi
