0
votes

In one of my included Makefiles is a rule for %.kt_rfgw. When i first compile, there is No rule to make target and it failed. But when i do make a second time without any changes it will find the rules except the webserver doesn't need to rebuild.


Makefile:

TARGET:=kt_rfgw

all: webserver gateway

webserver:
  ...doing stuff...

gateway: $(CONTIKI_PROJECT).$(TARGET)
  ...doing stuff...

In a Makefile.Include:

$(warning Rule: "%.kt_rfgw:" found)%.$(TARGET): %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a
...doing stuff...




Error-Message when do make first time:

/c/...path.../Makefile.include:316: Rule: "%.kt_rfgw:" found
...
make[1]: *** No rule to make target `regelfern.kt_rfgw', needed by `gateway'.  Stop.

No-Message when do make first time:

/c/...path.../Makefile.include:316: Rule: "%.kt_rfgw:" found
...
...compiling...
1
Please include the rule for %.kt_rfgw. Ideally strip out all the unnecessary stuff and create a minimal, complete and verifiable example.l0b0
$(TARGET) is %.kt_rfgw, sorryChris
I think the problem is, that the target gateway needs a file which will created by the target webserver. But only at the very beginng the rules where checked for the target gateway. Is it possible to check again before starting the second target?Chris

1 Answers

0
votes

You probably forgot to tell make that the webserver rule builds $(CONTIKI_PROJECT).$(TARGET). So, on the first invocation, when make parses the Makefile, it discovers that it needs it to build target gateway, it complains that it does not know how to build this prerequisite. Then, it does what it can, that is execute the webserver rule, which creates $(CONTIKI_PROJECT).$(TARGET) (but too late). On the second invocation it still does not know how to build $(CONTIKI_PROJECT).$(TARGET), but as it is already there everything is fine.

As a quick and dirty hack try, maybe, to add:

$(CONTIKI_PROJECT).$(TARGET): webserver

to tell make that $(CONTIKI_PROJECT).$(TARGET) can be built by executing the webserver rule.