mercredi 29 juin 2016

Makefile with pattern and directories

For a game I've a lot of textures to refenerate, this can take some times and so I only want to regenerate modified one instead of all of them.

I've a makefile with a structure similar to this one (which here s simplified for the example):

all:\
  wall

wall:\
  wall/red\
  wall/blue\
  wall/mixed

wall/%:\
  wall/%/top.png\
  wall/%/left.png\
  wall/%/right.png\
  wall/%/down.png\
    echo $@ $<

wall/red/%.png:\
  .source/wall/model/%.png
    convert $< -fill "rgb(255,0,0)" -colorize 15,15,15,0 -level "0%,100%,0.8" $@

wall/blue/%.png:\
  .source/wall/model/%.png
    convert $< -fill "rgb(0,0,255)" -colorize 15,15,15,0 -level "0%,100%,0.8" $@

wall/black/%.png:\
  .source/wall/model/%.png
    convert $< -fill "rgb(0,0,0)" -level "0%,100%,0.4" $@

wall/white/%.png:\
  .source/wall/model/%.png
    convert $< -fill "rgb(255,127,0)" -level "0%,70%,1.2" $@

wall/mixed/%.png:\
  wall/white/%.png\
  wall/black/%.png\
  .source/wall/mask/%.png
    convert $(word 1,$^) $(word 2,$^) $(word 3,$^) -composite $@

My problem here is that :

wall/%:
    echo $@

is working (it return me "wall/red", "wall/blue" and "wall/mixed") but :

wall/%:\
  wall/%/top.png\
  wall/%/left.png\
  wall/%/right.png\
  wall/%/down.png\
    echo $@

don't works (it return that there is no rules to build "wall/red" for "wall") and I don't know why because I've already seen rules like :

obj/%.o: %.c $(DEPS)

that works correctly.

Aucun commentaire:

Enregistrer un commentaire