Makefile Syntax Error End Of File Unexpected
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss java syntax error: end of file unexpected (expecting ")") the workings and policies of this site About Us Learn more about
Unexpected Expecting Fi
Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions
Syntax Error: "fi" Unexpected (expecting
Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other.
Aapt: Syntax Error: End Of File Unexpected (expecting ")")
Join them; it only takes a minute: Sign up /bin/sh: Syntax Error: end of file unexpected up vote 2 down vote favorite I am getting an error when running the following makefile with make -f makefile2 install (apart install the rest is working): all:myapp #which compiler CC = gcc #Where to install INSTDIR = /usr/local/bin #where are include syntax error unexpected end of file bash files kept INCLUDE = . #Options for development CFLAGS = -g -Wall -ansi #Options for release # CFLAGS = -O -Wall -ansi myapp: main.o 2.o 3.o $(CC) -o myapp main.o 2.o 3.o main.o: main.c a.h $(CC) -I$(INCLUDE) $(CFLAGS) -c main.c 2.o: 2.c a.h b.h $(CC) -I$(INCLUDE) $(CFLAGS) -c 2.c 3.o: 3.c b.h c.h $(CC) -I$(INCLUDE) $(CFLAGS) -c 3.c clean: -rm main.o 2.o 3.o install: myapp @if [ -d $(INSTDIR) ]; \ then \ cp myapp $(INSTDIR);\ chmod a+x $(INSTDIR)/myapp;\ chmod og-w $(INSTDIR)/myapp;\ echo "Installed in $(INSTDIR)";\ else echo "Sorry, $(INSTDIR) does not exist";\ fi I'm getting the following error: error /bin/sh: 7: Syntax error: end of file unexpected make: *** [install] Error 2 From what I understand it is a white space/tabulation/non unix character problem in the last lines of the makefile (after install:). But even trying to delete all spaces and replacing with tabulation I didn't manage to run the makefile properly. The code comes directly from a programming book I'm reading and is an example. Any help appreciated! linux makefile share|improve th
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business /bin/sh: 1: syntax error: end of file unexpected (expecting "then") Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation syntax error unexpected expecting fi ubuntu Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just android studio syntax error: "(" unexpected (expecting "fi") like you, helping each other. Join them; it only takes a minute: Sign up Bash: for loop in Makefile: unexpected end of file up vote 2 down vote favorite 1 I am writing a Makefile, which will list http://stackoverflow.com/questions/14573694/bin-sh-syntax-error-end-of-file-unexpected all headers included by a.cpp, b.cpp and c.h files. However, I got the error of unexpected EOF. Similar questions are always caused by the line terminator, like they used CRLF instead of LF for an EOL. However, my Text editor was set to using LF and I recheck this by delete all EOL and re-added. Unfortunately, the error still remains. Here are the codes: #!/bin/bash list-header: for file in a.cpp b.cpp b.h do echo "$file http://stackoverflow.com/questions/30412874/bash-for-loop-in-makefile-unexpected-end-of-file includes headers: " grep -E '^#include' $file | cut -f2 done I got this error message: for file in "Bigram.cpp client.cpp Bigram.h" /bin/sh: -c: line 1: syntax error: unexpected end of file" Thanks in advance for any help. bash makefile share|improve this question asked May 23 '15 at 12:50 Baozi CAI 94 An example where the "unexpected end of file" is caused by the different EOL formats. [link]stackoverflow.com/questions/6366530/… –Baozi CAI May 23 '15 at 12:53 A Makefile is not a bash script. –chepner May 23 '15 at 13:42 add a comment| 1 Answer 1 active oldest votes up vote 4 down vote accepted First note you have to escape $ that you want the shell to see, otherwise make will expand them before calling the shell. However, your main problem is that every logical line in a make recipe is a separate shell command. So, this rule: list-header: for file in a.cpp b.cpp b.h do echo "$file includes headers: " grep -E '^#include' $file | cut -f2 done will cause make to invoke the shell commands: /bin/sh -c 'for file in a.cpp b.cpp b.h' /bin/sh -c 'do' /bin/sh -c 'echo "ile includes headers: "' /bin/sh -c 'grep -E '^#include' ile | cut -f2' /bin/sh -c 'done' You need to use backslashes to "continue" a logical line across newlines i
HCL Search Reviews Search ISOs Go to Page... LinuxQuestions.org > Forums > Non-*NIX Forums > Programming [SOLVED] Shell Scripting "syntax error : unexpected end of file" User Name Remember Me? Password http://www.linuxquestions.org/questions/programming-9/shell-scripting-syntax-error-unexpected-end-of-file-804990/ Programming This forum is for all programming questions. The question does not have to be directly related to Linux and any language is fair game. Notices Welcome to LinuxQuestions.org, a friendly and active Linux Community. You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other syntax error special features. Registration is quick, simple and absolutely free. Join our community today! Note that registered members see fewer ads, and ContentLink is completely disabled once you log in. Are you new to LinuxQuestions.org? Visit the following links: Site Howto | Site FAQ | Sitemap | Register Now If you have any problems with the registration process or your account login, please contact us. If you need to reset end of file your password, click here. Having a problem logging in? Please visit this page to clear all LQ-related cookies. Introduction to Linux - A Hands on Guide This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter. For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own. Click Here to receive this Complete Guide absolutely free. Search this Thread 04-29-2010, 10:24 AM #1 roxie600 LQ Newbie Registered: Apr 2010 Posts: 5 Rep: Shell Scripting "syntax error : unexpected end of file" hey I am very new to shell scripting and keep getting this error message so any advice would be gladly received! I have simplified my code majorly and still get the same error so