Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Feb 1999 21:43:04 +1000
From:      Greg Black <gjb@comkey.com.au>
To:        "Ryan, Martin" <MRyan@VICMAIN.YPA.telstra.com.au>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: Help with {P}make 
Message-ID:  <19990222114304.15625.qmail@alpha.comkey.com.au>
In-Reply-To: <36D0A0A5@ypmail.nds.telecom.com.au>  of Mon, 22 Feb 1999 10:08:00 EST
References:  <36D0A0A5@ypmail.nds.telecom.com.au> 

next in thread | previous in thread | raw e-mail | index | archive | help
I've restored freebsd-questions to the list of recipients.  I
don't do private consulting for free.

> >> TESTDIR         = /home/www-hotstage/cgi-bin
> >> INSTALLDIR      = /home/www/cgi-bin
> >> PLSCRIPTS       = sites.pl sites-popup.pl
> >>
> >> test            : $(TESTDIR)/$(PLSCRIPTS)

Have a good look at "$(TESTDIR)/$(PLSCRIPTS)" and expand it for
yourself.  It doesn't make a lot of sense, since it produces two
words, the first of which has a directory path prepended to a
filename and the second of which is a naked filename.

> >> $(TESTDIR)/$(PLSCRIPTS) : $(.PREFIX).pl
> >>       perl -c $(.PREFIX).pl
> >>       cp $(.PREFIX).pl  $(.TARGET)
> >
> >We need to know (precisely) what you wanted this to do.  That
> >means: what command lines did you hope to see make generate?
> 
> perl -c sites.pl sites-popup.pl
> cp sites.pl sites-popup.pl /home/www-hotstage/cgi-bin

These commands aren't remotely like the specification you have
given for make.  What you want is something like:

test:	$(PLSCRIPTS)
	perl -c $(.ALLSRC)
	cp $(.ALLSRC) $(TESTDIR)

This isn't quite right in all probability, because I don't know
enough about the details of this stuff you're doing.  But it
should point you in the right direction.

> >Finally, when trying to understand what make does, unless you're
> >an expert (which probably means you had a wasted life), you need
> >to stay away from "make -n" -- there are too many circumstances
> >when that does not generate the same command lines that would be
> >generated without the "-n".
> 
> from the Pmake tutorial
> 
> :"Your  most helpful tool to make sure the makefile is at
> least syntactically correct is the -n flag, which allows
> you  to  see if PMake  will  choke  on the makefile."

The Pmake Tutorial is a fine document, but it's not perfect.
That's one of its more imperfect suggestions.  If you have
trouble believing that, just hop into some of the system
directories on any BSD system, run make with and without the -n
flag and be amazed at how rarely the -n flag will give you even
a vague hint of what the real make would have done.

> I gave a bit of a preamble at the start because I'm also looking for   
> answers to these;
> Q4) Is there a better way to do this using make?

It's still not clear to me just what you want to do.  But it
certainly sounds like something that you can do easily enough
with make.  You may need to read the tutorial a couple more
times before it becomes `easy', however.

> Q5) Is there a better way to do this using something else?

Well, make is the tool that ws invented for this stuff.  It does
a pretty good job, but it's not easy to learn and most people
never master it.  The common approach, and it works for lots of
people, is to build up the makefile a little at a time, working
from the tutorial, until you have something that approaches your
goals.  The tutorial actually does this quite well.

> I've re-read my initial post, Greg, and I dont think I was being too   
> verbose.

It's the privilege of the people giving out the free help to
decide if the questions are expressed suitably or not :-)

-- 
Greg Black <gjb@acm.org>



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990222114304.15625.qmail>