user5184385
user5184385

Reputation:

"make: *** No targets. Stop." error

I've prepared the following makefile, to automatically clean-up all the temporary projects I want to delete:

.SUFFIXES : bye


#  The default action is to
#      remove the latest project, i was working at...
byebye :
    rm -rf "$(ls -1dt /projects/new_* | head -n1)"


#  Remove a specific project.
#  Run make from the command-line as 'make new_1_bye' etc.
%_bye :
    rm -rf /projects/$*

But, if I run make as:

$ make

I get:

make: *** No targets.  Stop.

Why?

Upvotes: 1

Views: 4276

Answers (1)

Jonathan Leffler
Jonathan Leffler

Reputation: 755064

The .SUFFIXES line seems to cause the trouble. Suffixes normally start with a dot (.c, for example). Make appears to accept the suffix bye, but that means the line byebye: marks the start of a suffix rule, and the %_bye line is also a suffix rule. That adds up to mean there are no targets cited in the makefile, hence the error message.

If you use .SUFFIXES : .bye instead, make is then happy with the makefile.

Upvotes: 2

Related Questions