2

I am facing a rather strange problem with make. My make file contains:

all: item1 item2
item1: dep1 dep2
dep1:
 @echo
 cd $(HOME)/apps; /bin/rm -f $(D_ALL_OBJECTS) 
 cd $(SRCHOME)/fusionapps; make -k -f $(SOMEMAKEFILE) $(D_ALL_OBJECTS)
 @echo
dep2:
 @echo
 cd $(HOME)/apps; /bin/rm -f $(D2_ALL_OBJECTS) 
 cd $(SRCHOME)/fusionapps; make -k -f $(SOMEMAKEFILE) $(D2_ALL_OBJECTS)
 @echo
item2: ...
.....

Now, "make -f Makefile item1" works, but when I try "make -f Makefile all" it doesn't work. Do you people see any problems in my makefile?

Thanks


Addendum:

Well, it looks like make doesn't allow targets that have same name as some directory in the current level. Observation:

  • "all" is a directory @ $(HOME)/apps
  • all1: item1 item2 works
  • all: item1 item2 doesn't work

So any target name having same name as a directory seems to fail (as in, fails to do anything useful).

I am pretty sure I am doing something absurdly wrong here.

Jonathan Leffler
759k145 gold badges961 silver badges1.3k bronze badges
asked Feb 25, 2009 at 13:23
2
  • make: Nothing to be done for `all'. Commented Feb 25, 2009 at 14:24
  • Fails to do anything useful - sort of. The directory exists; if it was last modified (a file added or removed) since the dependencies were last changed, there is nothing that make needs to do to bring it up to date. It is good advice not to use a directory name as a target. Commented Feb 2, 2010 at 15:20

3 Answers 3

3

When you write:

all: item1 item2

and then request make all, that tells make:

  • Find a file system object called all and make sure anything it depends on (item1, item2) is up to date.
  • If all does not exist or is out of date w.r.t either of the file system objects called item1 or item2, then do the specified actions (none in this example) and then consider all up to date.
  • If all is a directory, it exists. If it has been modified recently, it will be up to date.

The suggestion to use .PHONY: all item1 item2 is good for GNU Make; it does not work with other variants of make.

Do not use target names that are directory names - unless you're sure you know what you're doing. And use .PHONY.

answered Feb 25, 2009 at 13:57
Sign up to request clarification or add additional context in comments.

Comments

1

Try phony-declaring your all-target.

answered Feb 25, 2009 at 13:35

Comments

0

Well looks like make doesn't allow targets who have same name as some directory in the current level. Observation :

-"all" is a directory @ $(HOME)/apps -all1/2/3: item1 item2 works -all: item1 item2 doesn't work so is the any target name having same name as the directory.

I am pretty sure I am doing anything absurdly wrong here.

answered Feb 25, 2009 at 13:48

1 Comment

Please add extra info to the question. I've done it for you; now remove this. Thanks.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.