help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need help with GNU make: "No rule to make target"


From: Paul Smith
Subject: Re: Need help with GNU make: "No rule to make target"
Date: Thu, 10 Oct 2013 14:19:00 -0400

On Thu, 2013-10-10 at 13:44 -0400, Jay Lawrence wrote:
> Two thoughts Jeremy, First you have an extra parenthesis '($(OBJS))', the
> outer parens aren't necessary and I don't know what they will do.
> 
>       # With substitution
>       tst_%: tst_%.c $(INCS) $(LIBVUTL) ($(OBJS)) $(LIBVLIB)
>            $(CC) $(CFLAGS) $< $(LDOPTS) -o $@

The extra parens are there to denote this as an archive build.  However
you have to remove the extra space after $(LIBVUTL); that wasn't there
in Jeremy's original file.

However, it's definitely possible that this is causing the problem in
any event.  Try the alternative below.

Also you might check with the current release of GNU make to see if it
works any better.

And finally, you should run "make -d" and see why make decides that the
pattern rule doesn't match.  It generates a lot of output but you should
be able to determine which prerequisite causes make to give up on it.

> Secondly, when I build pattern rules, I separate the dependencies from the
> recipe. I would write this as (with the extra () removed):
> 
>       # With substitution
>       tst_%: $(INCS) $(LIBVUTL) $(OBJS) $(LIBVLIB)
>       tst_%: tst_%.c
>            $(CC) $(CFLAGS) $< $(LDOPTS) -o $@

That won't work, because a pattern rule with no recipe just deletes the
pattern.  You have to write the prerequisite rule with a real target,
such as:

    $(TSTS): (INCS) $(LIBVUTL)($OBJS)) $(LIBVLIB)



> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden On Behalf Of Burri,
> Jeremy
> Sent: Thursday, October 10, 2013 1:29 PM
> To: Jed Brown; address@hidden
> Subject: RE: Need help with GNU make: "No rule to make target"
> 
> Actually attaching the attachment would help.
> 
> -----Original Message-----
> From: Burri, Jeremy 
> Sent: Thursday, October 10, 2013 10:28 AM
> To: 'Jed Brown'; address@hidden
> Subject: RE: Need help with GNU make: "No rule to make target"
> 
> Hi Jeb,
> 
> Sorry for the delayed response.  I do my development on a closed system (no
> network access), so I have to print out the material and retype it.  Here is
> the stripped down version of the Makefile which still exhibits the issue:
> 
>       ROOTDIR    = ../../..
> 
>       VLIBDIR    = $(ROOTDIR)/libs/vlib
>       LIBVLIB    = $(VLIBDIR)/lib/libvec.a
>       LIBVUTL    = $(VLIBDIR)/tst/libutl.a
> 
>       MYLDOPTS   = -lmkl_intel_lp64 -lmkl_core -lmkl_sequential -lpthread
> -lrt
> 
>       USE_INTEL  = /usr/local/etc/use_ictce4
>       INTEL_VERS = 64 20100414Z
>       ICCFLGS    = -O3 -ip -axPTW -D_GNU_SOURCE -D H5_USE_16_API
> 
>       MKL_PATH       := $(shell $(USE_INTEL) mkl_library_path
> $(INTEL_VERS))
>       export PATH    := $(shell $(USE_INTEL) path $(INTEL_VERS))
>       export LD_PATH := $(shell $(USE_INTEL) ld_library_path
> $(INTEL_VERS))
> 
>       VECINC = $(VLIBDIR)/include
>       MKLINC = /opt/intel/ictce/4.0.0.020/mkl/include
> 
>       INCS = vparm.h $(VECINC)/vlib.h
>       OBJS = prttime.o fftunpk.o
> 
>       CONLY = -c
>       CFLAGS = -I$(VECINC) -I$(MKLINC) $(ICCFLGS)
>       LDFLAGS = -L$(MKL_PATH)
>       LDOPTS = $(LIBVUTL) $(LIBVLIB) $(LDFLAGS) $(MYLDOPTS)
>       AR = ar
>       ARFLAGS = rcv
>       CC = icc
> 
>       TSTS = tst_rvfft2d
> 
>       all: $(LIBVUTL) $(TSTS)
> 
>       $(LIBVUTL): $(OBJS)
>           $(AR) $(ARFLAGS) $(LIBVUTL) $?
> 
>       # With substitution
>       tst_%: tst_%.c $(INCS) $(LIBVUTL)($OBJS)) $(LIBVLIB)
>            $(CC) $(CFLAGS) $< $(LDOPTS) -o $@
> 
>       # Without substitution
>       #tst_rvfft2d: tst_rvfft2d.c $(INCS) $(LIBVUTL)($OBJS)) $(LIBVLIB)
>       #     $(CC) $(CFLAGS) $< $(LDOPTS) -o $@
> 
>       $(LIBVLIB): FORCE
>           cd ..; $(MAKE)
> 
>       clean:
>            rm -f *.o
>            rm -f $(TSTS)
>            rm -f $(LIBVUTL)
>       
>       FORCE:
> 
>       run: runtst
> 
>       runtst:
>            for tst in $(TSTS); do ./$$tst; done
> 
> Here is the output when running make:
> 
>       address@hidden tst]$ make -f Makefile_tst clean all
>       rm -f *.o
>       rm -f tst_rvfft2d
>       rm -f ../../../libs/vlib/tst/libutl.a
>       icc -I../../../libs/vlib/include
> -I/opt/intel/ictce/4.0.0.020/mkl/include -O3 -ip -axPTW -D_GNU_SOURCE -D
> H5_USE_16_API -c -o prttime.o prttime.c
>       icc -I../../../libs/vlib/include
> -I/opt/intel/ictce/4.0.0.020/mkl/include -O3 -ip -axPTW -D_GNU_SOURCE -D
> H5_USE_16_API -c -o fftunpk.o fftunpk.c
>       ar rcv ../../../libs/vlib/tst/libutl.a prttime.o fftunpk.o
>       a - prttime.o
>       a - fftunpk.o
>       make: *** No rule to make target 'tst_rvfft2d', needed by 'all'.
> Stop.
> 
> Since I have to retype the material, I was worried about making a typo so I
> included the print out with the original material in it.  You will see a
> copy of the above Makefile and output.  You will also find the output when
> substitution is not used. Remember, the above Makefile works in RHEL4 with
> make 3.80, but does not work with RHEL5 with make 3.81.
> 
> As a test, I created a simple Makefile with substitution and of course it
> works fine. You can see the Makefile and output in the same attached file.
> This would lead me to believe that there is an issue with my Makefile (no
> big surprise), but the issue is manifesting itself is a way that I don't
> understand. It does not seem to be an issue with the actual pattern
> substitution, but if this is true then why is it manifesting itself as a
> pattern substitution error?
> 
> -Jeremy
> 
> -----Original Message-----
> From: Jed Brown [mailto:address@hidden On Behalf Of Jed Brown
> Sent: Tuesday, October 08, 2013 5:48 PM
> To: Burri, Jeremy; address@hidden
> Subject: RE: Need help with GNU make: "No rule to make target"
> 
> "Burri, Jeremy" <address@hidden> writes:
> >  When I run "make all" I get the following under RHEL5 with make v3.81:
> >
> >     Make: *** No rule to make target 'tst_rvfft2d', needed by 'all'.
> Stop.
> 
> Huh, I can't reproduce.  Is the above your complete makefile and do you have
> anything in MAKEFLAGS?
> 
> 
> _______________________________________________
> Help-make mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-make





reply via email to

[Prev in Thread] Current Thread [Next in Thread]