santu47
santu47

Reputation: 652

What is targets in a makefile implicit commands

Can any one tell me what is targets in the below make file with some implicit rules. I have searched in net alot, but haven't found anything helpful. It will be pleasure if anyone explains what is targets, construction commands, dependencies, and macros in a makefile.

COBJECTS = menu.o users.o resellers.o propspects.o
HFILES = menu.h

leads: $(COBJECTS)
    gcc -o leads $(COBJECTS)

menu.o users.o resellers.o prospects.o: $(HFILES)

Upvotes: 0

Views: 110

Answers (2)

Beta
Beta

Reputation: 99084

In this rule:

leads: $(COBJECTS)
    gcc -o leads $(COBJECTS)

the target is leads, the prerequisites are $(COBJECTS), the command is gcc -o leads $(COBJECTS).

In this rule:

menu.o users.o resellers.o prospects.o: $(HFILES)

the targets are menu.o users.o resellers.o prospects.o and the prerequisite is $(HFILES). It has no commands.

Upvotes: 1

Etan Reisner
Etan Reisner

Reputation: 80921

The only really meaningful target defined in that makefile is leads. That also happens to be the default target so make and make leads will do the same thing.

There are other targets that exist as part of the rules necessary to build the leads target but those are all internal make defaults and not very interesting to run by hand.

Among the list of other possible targets (and among the more interesting out of the entirely uninteresting bunch) are:

  • menu.o
  • users.o
  • resellers.o
  • prospects.o

Upvotes: 1

Related Questions