Make Syntax Error Unexpected
Contents |
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
Syntax Error Word Unexpected (expecting ) ) Shell Script
About Us Learn more about Stack Overflow the company Business Learn more about syntax error: "(" unexpected bash hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join line 1: syntax error: unexpected word (expecting ")") the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Syntax error: word unexpected (expecting
Syntax Error At Line 1 (' Unexpected In Shell Script
“)”)? up vote 5 down vote favorite 2 PLATFORM = x86 CUD = cuda X86 = x86 PAN = panda ARM = arm app: ifeq($(PLATFORM),$(CUD)) CC = dum3 endif ifeq($(PLATFORM), $(X86)) CC = gcc endif ifeq($(PLATFORM),$(PAN)) CC = dum1 endif ifeq($(PLATFORM),$(ARM)) CC = dum2 endif $(CC) -o ./Executable/list ./Source/ll_main.c ./Library/liblst.a ./Executable/list When I make this it shows error.... Syntax error: word unexpected (expecting ")") ?
Syntax Error ( Unexpected Bash Array
Plzz.. Help.. makefile share|improve this question asked Jan 20 '14 at 5:36 Chirag Parekh 11115 add a comment| 1 Answer 1 active oldest votes up vote 14 down vote accepted The formatting in your question (both the makefile and the error message) is too messed up to be sure, but my suspicion is that your ifeq is indented with a TAB. That's not right; ifeq is a make command. (Almost) all lines with TAB characters as the first character on the line in a makefile is passed to the shell. The shell doesn't know anything about ifeq, so, depending on your shell, might print an error like that. You should move the app: target after the ifeq blocks to just before the use of $(CC) (and ensure the $(CC) ... line is indented with a TAB as the first character on that line). In the future please be sure to use SO's formatting capabilities, and be sure to cut and paste error messages exactly, plus a few lines of context before and after, when asking questions. share|improve this answer answered Jan 20 '14 at 5:43 MadScientist 27k32240 1 Thanks MadScientist it really helped........... &
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 Learn more about hiring syntax error ( unexpected ubuntu developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question
Ksh Syntax Error Unexpected
x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; bash function syntax error unexpected it only takes a minute: Sign up Make error for ifeq: syntax error near unexpected token up vote 26 down vote favorite 4 I'm writing a Makefile that does string matching at one place, the code is like: if test http://stackoverflow.com/questions/21226905/syntax-error-word-unexpected-expecting ...; \ then \ shell scripts... \ fi ifeq ($(DIST_TYPE),nightly) shell scripts ... endif Here the first if is shell script, the second ifeq is GNU Make's conditional. However the following error generates: ifeq (nightly,nightly) /bin/sh: -c: line 0: syntax error near unexpected token `nightly,nightly' /bin/sh: -c: line 0: `ifeq (nightly,nightly)' What's happening here? It seems that Make is trying to call the shell. Thank you. makefile share|improve this question edited Dec 19 '10 at 14:29 asked Dec 19 http://stackoverflow.com/questions/4483313/make-error-for-ifeq-syntax-error-near-unexpected-token '10 at 14:16 Ryan Li 3,33132244 You are confusing conditional statements in sh (such as the first) with conditional statements in make (such as the second). –reinierpost Jun 11 '12 at 8:11 add a comment| 2 Answers 2 active oldest votes up vote 94 down vote accepted I played around the code and found that the conditional statements should be written without indention, and this solved my problem. If there is no indention, Make will treat it as a directive for itself; otherwise, it's regarded as a shell script. Example code Wrong: target: ifeq (foo, bar) ... endif Correct: target: ifeq (foo, bar) ... endif share|improve this answer edited Jun 10 '12 at 18:04 Till 18k34581 answered Dec 19 '10 at 14:50 Ryan Li 3,33132244 10 I just wanted to thank and salut you for this answer. I've also added an example into it. :) –Till Jun 10 '12 at 18:03 That's so non-obvious, thanks for this answer, saved me hours of frustration –omouse Feb 2 at 19:48 Wow been looking for a while how to get if/else working in my makefile. This is sooo simple but didn't see this anywhere! Thanks! –Eisi Sig Mar 14 at 10:04 add a comment| up vote 0 down vote In addition, if the conditional statements is used in define functions, like: define myFunc ifeq (foo, bar) ... endif enddef In this case, Mak
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 http://stackoverflow.com/questions/17620887/makefile-conditional-error the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of http://www.udoo.org/forum/threads/solved-failed-compile-syntax-error-during-make.798/ 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Makefile conditional error up vote 6 down vote favorite 1 I am attempting to do a make syntax error statement to check the architecture. I am very close to getting it to work: test: ifeq ("$(shell arch)", "armv7l") echo "This is an arm system" else echo "This is not an arm system." endif I have one issue: although this seems to resolve to ifeq ("i386", "armv7l") which should be false, I get the following error: $ make ifeq ("i386", "armv7l") /bin/sh: -c: line 0: syntax error near unexpected token `"i386",' /bin/sh: syntax error unexpected -c: line 0: `ifeq ("i386", "armv7l")' make: *** [test] Error 2 So, it is resolving to two strings comparing to each other, but there is a syntax error. What's wrong here? makefile conditional gnu-make share|improve this question asked Jul 12 '13 at 17:42 Christian Stewart 8,01994995 add a comment| 2 Answers 2 active oldest votes up vote 9 down vote accepted You cannot use make statements like ifeq inside a recipe. Recipes (the lines that begin with TAB) are passed to the shell. The shell doesn't understand ifeq; that's a make construct. You'll have to use shell if-statements inside a recipe. And, you don't have to use $(shell ...) in a recipe, because you're already in a shell. test: if [ `arch` = armv7l ]; then \ echo "This is an arm system"; \ else \ echo "This is not an arm system."; \ fi This is likely not the best way to handle this, but since you didn't provide any info on what you're really trying to do with this it's all we can say. share|improve this answer edited Jul 12 '13 at 17:59 answered Jul 12 '13 at 17:46 MadScientist 27k32240 How much clearer can it be? I'm just trying to check the architecture and conditionally do statements. But tha
17 Likes Received: 0 Hi everyone, I am trying to compile the kernel and am having some problems. This is my first kernel compile so it is very possible that I am missing something, although I have followed the instructions exactly. Looking through the UDOO manual (under Downloads > Documentation) I execute the below commands: Code: curl http://download.udoo.org/files/crosscompiler/arm-fsl-linux-gnueabi.tar.gz | tar -xzv sudo apt-get install build-essential ncurses-dev uboot-mkimage git git clone http://github.com/UDOOboard/Kernel_Unico kernel cd kernel make ARCH=arm UDOO_defconfig make ARCH=arm menuconfig make -j4 CROSS_COMPILE=../arm-fsl-linux-gnueabi/bin/arm-fsl-linux-gnueabi- ARCH=arm uImage modules Up until the actual compilation (last command) all is well. But when I execute the last command I get these errors. Code: root@udoo:/usr/src/kernel# sudo make -j4 CROSS_COMPILE=../arm-fsl-linux-gnueabi/bin/arm-fsl-linux-gnueabi- ARCH=arm uImage modules ../arm-fsl-linux-gnueabi/bin/arm-fsl-linux-gnueabi-gcc: 1: ../arm-fsl-linux-gnueabi/bin/arm-fsl-linux-gnueabi-gcc: Syntax error: "(" unexpected make: execvp: /usr/src/kernel/scripts/setsecoversion: Permission denied CHK include/linux/version.h CC scripts/mod/empty.o ../arm-fsl-linux-gnueabi/bin/arm-fsl-linux-gnueabi-gcc: 1: ../arm-fsl-linux-gnueabi/bin/arm-fsl-linux-gnueabi-gcc: Syntax error: "(" unexpected make[2]: *** [scripts/mod/empty.o] Error 2 make[1]: *** [scripts/mod] Error 2 make: *** [scripts] Error 2 make: *** Waiting for unfinished jobs.... Just to confirm. Up until that error, everything was fine. I downloaded the cross-compiler and did a git clone just fine. No issues there. I even deleted the files (the compiler and the kernel) and did it all again because I thought there may have been a corruption. The point of this exercise is to build the kernel with the TUN driver installed, so I also tried configuring the TUN driver on and then I also tried just compiling it at vanilla defaults. Same issue still. From what I can gather file ../arm-fsl-linux-gnueabi/bin/arm-fsl-linux-gnueabi-gcc is a C++ executable. Which would explain why I can't open it up and see any source code to see where the syntax error is... When I do a 'file' of it I get Code: ../arm-fsl-linux-gnueabi/bin/arm-fsl-linux-gnueabi-gcc: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.0, stripped I am very noob here and probably in over my head. So any assistance would be greatly appreciated. Thanks! ======= EDIT: SUCCESS! It's working now. All details below. Firstly, the reason why I was getting that error is because I was attempting to