Re: sh and Makefile
From: Bill Seivert (seivert_at_pcisys.net)
Date: 02/26/05
- Next message: Markus Dehmann: "Re: sh and Makefile"
- Previous message: Alan Connor: "Re: Detect if a program is being traced"
- In reply to: Mark: "sh and Makefile"
- Next in thread: Markus Dehmann: "Re: sh and Makefile"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 25 Feb 2005 20:44:41 -0700
Mark wrote:
> Hello,
>
> I have an unusual scenario for you. I am attempting to automate the
> generation of some dependancies in make. I have written the following
> code inside my makefile but am getting errors. I'm afraid I'm a newbie
> to all this.
>
> Could someone please help!
>
> -------------------------------Makefile---------------------------------------
> SHELL = /bin/sh
> CXX = g++
> CXXFLAGS = -g -Wall
> DEFS = -D_MOSIX
>
> # Automatically generate dependencies and include them in Makefile
> depend: $(SOURCES) $(HEADERS)
> for file in `find . -name *.cpp`; do \
> filewosuffix=`echo "$$file" | sed 's/.cpp//g'` \
> g++ $$file -MT '${OBJDIR}/"$$filewosuffix".o' >> depend \
> echo '$${CXX} -c $${CXXFLAGS} $${DEFS} -o $$@ $$<' >> depend \
> done
> -------------------------------/Makefile---------------------------------------
>
> I am getting the following errors:
> /bin/sh: -c: line 2: syntax error: unexpected end of file
>
> Thanks for your help.
>
You probably want to erase depend since you are only
appending to it. You need more semicolons and use double
quotes around the *.cpp in the find command and on the final
echo. One semicolon after each statement:
depend: $(SOURCES) $(HEADERS)
cat </dev/null >depend ; \
for file in `find . -name "*.cpp"`; do \
filewosuffix=`echo "$$file" | sed 's/.cpp//g'` ; \
g++ $$file -MT '${OBJDIR}/"$$filewosuffix".o' >> depend ; \
echo "$${CXX} -c $${CXXFLAGS} $${DEFS} -o $$@ $$<" >> depend ; \
done
(untested)
Bill Seivert
- Next message: Markus Dehmann: "Re: sh and Makefile"
- Previous message: Alan Connor: "Re: Detect if a program is being traced"
- In reply to: Mark: "sh and Makefile"
- Next in thread: Markus Dehmann: "Re: sh and Makefile"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|