baptiste
baptiste

Reputation: 1169

No rule to make target based on parameter use

I am using a makefile to control the compilation of my project. At the start of my Makefile, I have:

ifdef PIXEL
    CFLAGS += -DBY_PIXEL
else
 ifdef LINE
    CFLAGS += -DBY_LINE
 else
  ifdef BLOCK
    CFLAGS += -DBY_BLOCK
  else
    CFLAGS += -DBY_PIXEL     (HERE)
  endif
 endif
endif

I have the error "No rule to make target XXX" where XXX is PIXEL, LINE or BLOCK. However when I don't write any parameter, it finds the target in the last else (where I put (HERE).

I dont fully understand why but I don't often write Makefile. Do you guys have an idea about it?

Upvotes: 0

Views: 68

Answers (1)

l0b0
l0b0

Reputation: 58848

To specify a variable for make, set it to a value after the make command. For example, make PIXEL=foo build

Upvotes: 1

Related Questions