Bogdan M.
Bogdan M.

Reputation: 1128

Solaris Imakefile Copy file rule

I am trying to port an application from windows to solaris and I found out that the Imakefile is not defined well, or at least is not working at expecting.

I have some rules defined to copy some protobuf files as:

file1.pb.cc:
    cp -p $(PROTODIR)/file1.pb.cc .

file2.pb.cc:
    cp -p $(PROTODIR)/file2.pb.cc .

file3.pb.cc:
    cp -p $(PROTODIR)/file3.pb.cc .

On windows all the files are copied.

On solaris, only first is copied, then nothing happens.

If I re-run make, I get the message 'file1.pb.cc' is up to date (which is ok, because is there) and the execution is finished.

So, why the other files are not copied ?

Thanks, Bogdan

Upvotes: 1

Views: 185

Answers (2)

Nicola Musatti
Nicola Musatti

Reputation: 18236

As you can see from the documentation, I don't think you can omit the destination of your copies.

Upvotes: 0

Some programmer dude
Some programmer dude

Reputation: 409432

You need to add a rule at the top of the file:

default: file1.pb.cc file2.pb.cc file3.pb.cc

The name of the rule is not important, just that it is first. The reason is because make will by default only execute the first rule in the file if not given an argument.

This default rule then depends on the files you want copied, and make will check for rules for them.

Upvotes: 1

Related Questions