From owner-freebsd-questions Mon Feb 22 11: 9:50 1999 Delivered-To: freebsd-questions@freebsd.org Received: from alpha.comkey.com.au (alpha.comkey.com.au [203.9.152.215]) by hub.freebsd.org (Postfix) with SMTP id 57BC711EC0 for ; Mon, 22 Feb 1999 11:09:38 -0800 (PST) (envelope-from gjb@comkey.com.au) Received: (qmail 15626 invoked by uid 1001); 22 Feb 1999 11:43:04 -0000 Message-ID: <19990222114304.15625.qmail@alpha.comkey.com.au> X-Posted-By: GBA-Post 1.04 06-Feb-1999 X-PGP-Fingerprint: 5A91 6942 8CEA 9DAB B95B C249 1CE1 493B 2B5A CE30 Date: Mon, 22 Feb 1999 21:43:04 +1000 From: Greg Black To: "Ryan, Martin" Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Help with {P}make References: <36D0A0A5@ypmail.nds.telecom.com.au> In-reply-to: <36D0A0A5@ypmail.nds.telecom.com.au> of Mon, 22 Feb 1999 10:08:00 EST Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message