guilin 桂林
guilin 桂林

Reputation: 17422

Cause of "no rule to make target" with make?

Isn't Makefile syntax is

target: require_files
   cmd...

Why I got this problem?

Makefile

MXMLC = /opt/flex/bin/mxmlc
MXMLC_RELEASE = $(MXMLC) -debug=false -compiler.optimize=true

release: bin-release/Wrapper.swf, bin-release/Application.swf

bin-release/Application.swf: src/**/*.as, lib/*.swc
    $(MXMLC_RELEASE) -output bin-release/Application.swf src/Application.as
    @@-rm ../server/public/game/Application.swf
    $(CP) bin-release/Application.swf ../server/public/game/Application.swf

bin-release/Wrapper.swf: src/*.as, src/engine/**/*.as, lib/*.swc
    $(MXMLC_RELEASE) -output bin-release/Wrapper.swf src/Wrapper.as
    @@-rm ../server/public/game/Wrapper.swf
    $(CP) bin-release/Wrapper.swf ../server/public/game/Wrapper.swf

$: make bin-release/Application.swf

~/workspace/project/src/flash [2]19:20 make: * No rule to make target src/constant/*.as,', needed bybin-release/Application.swf'. Stop.

Upvotes: 3

Views: 1288

Answers (2)

William Morris
William Morris

Reputation: 3684

You can locate the files using find, for example:

ASFILES  = $(shell find src -name "*.as")
SWCFILES = $(shell find lib -name "*.swc")

And then use the list in your rules:

bin-release/Application.swf: $(ASFILES) $(SWCFILES)
        $(MXMLC_RELEASE) etc

I imagine you would then use the .as and .swc files in the recipe (i.e. the $(MXMLC_RELEASE) bit) although you don't currently.

Upvotes: 2

sehe
sehe

Reputation: 393009

Drop the commas

MXMLC = /opt/flex/bin/mxmlc
MXMLC_RELEASE = $(MXMLC) -debug=false -compiler.optimize=true

release: bin-release/Wrapper.swf bin-release/Application.swf

bin-release/Application.swf: src/**/*.as lib/*.swc
    $(MXMLC_RELEASE) -output bin-release/Application.swf src/Application.as
    @@-rm ../server/public/game/Application.swf
    $(CP) bin-release/Application.swf ../server/public/game/Application.swf

bin-release/Wrapper.swf: src/*.as src/engine/**/*.as lib/*.swc
    $(MXMLC_RELEASE) -output bin-release/Wrapper.swf src/Wrapper.as
    @@-rm ../server/public/game/Wrapper.swf
    $(CP) bin-release/Wrapper.swf ../server/public/game/Wrapper.swf

Upvotes: 6

Related Questions