How to execute SED command from Makefile
<p>So I am attempting to run a sed command from a Makefile on RaspberryPi running Raspbian. The commands I am using works perfectly when I type them directly into the terminal, but when I attempt to execute them from a Makefile I get the following feedback:</p>

<p>sed: -e expression #1, char 14: extra characters after command</p>

<pre><code>#
#  Quick and dirty Makefile for logsnag
#

CC      = gcc

INCLUDE     = -I.

CFILES      = myThing.c
OBJS        = myThing.o

CFLAGS          = ${INCLUDE}

all:    myThing

myThing: ${OBJS}
    ${CC} ${CFLAGS} ${OBJS} -o myThing

myThing.o: ${CFILES}
    ${CC} ${CFLAGS} myThing.c -c

install:    myThing
    sudo cp -f myThing/usr/local/bin
    sudo cp -f ../bin/startlogging.sh /usr/local/bin
    sudo cp -f ../cfg/rotateThing.cfg /etc

    if [ ! -d /var/log/thingLog ]; then\
        sudo mkdir /var/log/thingLog;\
    fi;

    sudo sed -i -e '$i touch /var/log/thingLog/thing.log /var/log/thingLog/myThing \n' /etc/rc.local;
    sudo sed -i -e '$i logrotate -f /etc/rotateThing.cfg \n' /etc/rc.local;
    sudo sed -i -e '$i touch /var/log/thingLog/thing.log /var/log/thingLog/myThing \n' /etc/rc.local;
    sudo sed -i -e '$i /usr/local/bin/startlogging.sh &gt; /var/log/thingLog/myThing 2&gt;&amp;1 &amp; \n' /etc/rc.local;

clean:
    rm -f myThing *.o
</code></pre>