Sorry I was confusing Pattern-specific variable assignments with dependencies ...
Jay -----Original Message----- From: Paul Smith [mailto:[email protected]] Sent: Thursday, October 10, 2013 2:19 PM To: Jay Lawrence Cc: 'Burri, Jeremy'; 'Jed Brown'; [email protected] Subject: Re: Need help with GNU make: "No rule to make target" 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: [email protected] > [mailto:[email protected]] On Behalf Of Burri, > Jeremy > Sent: Thursday, October 10, 2013 1:29 PM > To: Jed Brown; [email protected] > 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'; [email protected] > 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: > > [jburri@h1 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:[email protected]] On Behalf Of Jed Brown > Sent: Tuesday, October 08, 2013 5:48 PM > To: Burri, Jeremy; [email protected] > Subject: RE: Need help with GNU make: "No rule to make target" > > "Burri, Jeremy" <[email protected]> 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 > [email protected] > https://lists.gnu.org/mailman/listinfo/help-make _______________________________________________ Help-make mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-make
