Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"commence before first target. Stop." error

Tags:

makefile

In *.mak file I receive commands "commence before first target. Stop." I didn't change it before.

How to solve this problem?

like image 823
EK. Avatar asked May 26 '10 11:05

EK.


6 Answers

make (or NMAKE, or whatever flavour of make you are using) can be quite picky about the format of makefiles - check that you didn't actually edit the file in any way, e.g. changed line endings, spaces <-> tabs, etc.

like image 164
Paul R Avatar answered Oct 23 '22 00:10

Paul R


This means that there is a line which starts with a space, tab, or some other whitespace without having a target in front of it.

like image 43
chacham15 Avatar answered Oct 22 '22 23:10

chacham15


This could be echoing outside the target, for instance

# Variable 
BAR = 
ifeq ($(FOO), 1)
    @echo "FooBar"  <----- generate the error
    BAR += foobar
endif
 
# Targets
all: 
...
...
like image 37
Thiago Navarro Avatar answered Oct 23 '22 00:10

Thiago Navarro


Also, make sure you dont have a space after \ in previous line Else this is the error

like image 27
Sravya Avatar answered Oct 22 '22 23:10

Sravya


if you have added a new line, Make sure you have added next line syntax in previous line. typically if "\" is missing in your previous line of changes, you will get this error.

like image 29
Raghu Avatar answered Oct 22 '22 23:10

Raghu


It's a simple Mistake while adding a new file you just have to make sure that \ is added to the file before and the new file remain as it is eg.

Check Out what to do if i want to add a new file named customer.cc

like image 1
Siddharth Joshi Avatar answered Oct 22 '22 23:10

Siddharth Joshi