Mike
Mike

Reputation: 2705

Target pattern contains no '%'. Makefile

I have searched this problem in google, but still don't have some way to resolve a problem. I have 2 Makefiles: One as example and one as my file. Example:

BINDDIR=/src/binding
XBUILD=/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild
PROJECT_ROOT=XMBindingLibrarySample
PROJECT=$(PROJECT_ROOT)/XMBindingLibrarySample.xcodeproj
TARGET=XMBindingLibrarySample
BTOUCH=/Developer/MonoTouch/usr/bin/btouch

 XMBindingLibrary.dll
libXMBindingLibrarySample-i386.a:
$(XBUILD) -project $(PROJECT) -target $(TARGET) -sdk iphonesimulator -configuration Release clean build -mv $(PROJECT_ROOT)/build/Release-iphonesimulator/lib$(TARGET).a $@
libXMBindingLibrarySample-armv6.a:
$(XBUILD) -project $(PROJECT) -target $(TARGET) -sdk iphoneos -arch armv6 -configuration Release clean      build -mv $(PROJECT_ROOT)/build/Release-iphoneos/lib$(TARGET).a $@

libXMBindingLibrarySample-armv7.a:
$(XBUILD) -project $(PROJECT) -target $(TARGET) -sdk iphoneos -arch armv7 -configuration Release clean build -mv $(PROJECT_ROOT)/build/Release-iphoneos/lib$(TARGET).a $@

libXMBindingLibrarySampleUniversal.a: libXMBindingLibrarySample-armv7.a libXMBindingLibrarySample-i386.a
lipo -create -output $@ $^

XMBindingLibrary.dll: AssemblyInfo.cs XMBindingLibrarySample.cs extras.cs libXMBindingLibrarySampleUniversal.a

$(BTOUCH) -unsafe --outdir=tmp -out:$@ XMBindingLibrarySample.cs -x=AssemblyInfo.cs -x=extras.cs --link-with=libXMBindingLibrarySampleUniversal.a,libXMBindingLibrarySampleUniversal.a

clean:
-rm -f *.a *.dll

My file:

BTOUCH=/Developer/MonoTouch/usr/bin/btouch
BINDDIR=/src/binding
XBUILD=/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild
PROJECT_ROOT=IIViewDeckControllerSample
PROJECT=$(PROJECT_ROOT)/IIViewDeckController.xcodeproj
TARGET=IIViewDeckController

all: IIViewDeckController.dll

libIIViewDeckController-i386.a:
$(XBUILD) -project $(PROJECT) -target $(TARGET) -sdk iphonesimulator -configuration Release clean build -mv $(PROJECT_ROOT)/build/Release-iphonesimulator/lib$(TARGET).a $@

libIIViewDeckController-armv7.a:
$(XBUILD) -project $(PROJECT) -target $(TARGET) -sdk iphoneos -arch armv7 -configuration Release clean build  -mv $(PROJECT_ROOT)/build/Release-iphoneos/lib$(TARGET).a $@

libIIViewDeckControllerUniversal.a: libIIViewDeckController-armv7.a libIIViewDeckController-i386.a
lipo -create -output $@ $^

IIViewDeckController.dll: AssemblyInfo.cs APIDefinition.cs StructsAndEnums.cs libIIViewDeckControllerUniversal.a
$(BTOUCH) -unsafe  -out:$@ APIDefinition.cs -x=AssemblyInfo.cs -x=StructsAndEnums.cs --link-with=libIIViewDeckControllerUniversal.a,libIIViewDeckControllerUniversal.a

clean:
-rm -f *.a *.dll

With example file everything is OK, with mine I have Error:

Makefile:4: *** target pattern contains no `%'.  Stop.
make: *** [all] Error 2

Upvotes: 47

Views: 99691

Answers (9)

fearless_fool
fearless_fool

Reputation: 35239

Another cause of this message: Absolute pathnames

I had an IDE-generated project created on a Windows PC, pushed to github, and then cloned on a Mac. I got the same message ("*** target pattern contains no '%'.").

In my case, it was because the Makefile contained absolute pathnames of the form "C:/Users/...".

The fix was to remove the offending files from the IDE project then re-add them, but being sure to specify relative pathnames.

(I know this is far off the OP's issue, but the error message was the same, and this might be helpful to someone else.)

Upvotes: 2

Alok Prasad
Alok Prasad

Reputation: 700

Saw the issue when your source files are contained in directory whose name contains colon (:).

Upvotes: 3

Mark Lakata
Mark Lakata

Reputation: 20907

I had this problem if there was a colon in the target file name (i.e. a time stamp), for example:

 all: foo_01:34.txt
 
 foo_%.txt: bar_%.txt
      foobar $< > $@

I had to escape it:

 all: foo_01\:34.txt
 
 foo_%.txt: bar_%.txt
      foobar $< > $@

Upvotes: 0

RzR
RzR

Reputation: 3186

Make sure there is no : in your path, i.e. cd ${url} => ://. If so, escape it like this:

cd ${url} => \://

Upvotes: 13

sagar bade
sagar bade

Reputation: 7

Solved: just go to the project tab it will present on vertical tab section then go to general and just change the location of project

Upvotes: -3

Charles Merriam
Charles Merriam

Reputation: 20520

This is a badly written error message from Make. It means "one of your filenames had a character that could be part of a regular expression". Make is very naive about filesystems and quoting. It doesn't believe that:

foo:  'The bar.'

refers to a literal string. It takes The as one word, bar. as another word, and then barfs on the period. Do this instead:

foo:  The\ bar\.

or in your case, backslash to the period in .xcodeproj.

Upvotes: 56

Jeroen
Jeroen

Reputation: 63820

This won't work:

default:
        echo "Hello world!"

This will:

default:
	echo "Hello world!"

Can you spot the difference?

That's right, the first one has spaces, the second one has tabs. The one with spaces will give you:

Makefile:2: *** missing separator. Stop.

And this is why we cannot have nice things...

Upvotes: 53

Resigned June 2023
Resigned June 2023

Reputation: 4947

This error occurred for me because I had a rule of the form

foo: bar:
        baz

(note the trailing :).

Upvotes: 21

Stephane Delcroix
Stephane Delcroix

Reputation: 16232

Drop the line 11 on https://github.com/mkovalyk/IIViewDeckControllerBinding/blob/master/src/binding/Makefile. %' is not recognised by make

Upvotes: -5

Related Questions