Article View: comp.unix.wizards
Article #20985Re: question on makefiles......
From: Rajappa Iyer
Date: Sun, 19 Jan 1992 11:26
Date: Sun, 19 Jan 1992 11:26
71 lines
3164 bytes
3164 bytes
In article <1992Jan18.190736.11729@markv.com> lance@markv.com (Lance Ellinghouse) writes:
>I want to make the Source code in the current directory and the object code
>directorie completely configurable..
>so I created a set of dependencies like this:
>
>$(DEST)/file1.o: file1.c
>$(DEST)/file2.o: file2.c
>$(DEST)/file3.o: file3.c
>$(DEST)/file4.o: file4.c
>$(DEST)/file5.o: file5.c
>
>I then defined DEST to be something like:
>
>DEST = /usr/tmp
>
>I then set up an inference rule to be:
>
>.c.o:
> $(CC) -c $(CFLAGS) -Fo$@ $<
>
>
>now everything works just fine if DEST is a RELATIVE
>directory to the current one.. but when DEST is a full
>pathname, it will NOT run the inference rules on them at
I think you mean the other way around -- this won't work when you
use a relative path name and will work when you use a fully
qualified path name.
>all!! I would like to have it a relative path, but it
>is not possible.. It must be a full pathname..
Thought so. :-)
>
>Am I doing something wrong?
Well, not really... but make treats anything that starts with a '.'
as a suffix rule. So it is not able to "parse" your dependency properly
when you use relative path for DEST (it would start with a period).
This is really a problem with make.
>Anyone have any sugestions???
Try starting off the dependency from column 2. I can't guarantee that
this will work though.
>DOS "NMAKE" has a REALLY nice feature by being able to
>define the inference rule itself with the source and destination
>directories instead of the dependency lines! you would do something
>like:
>
>.c{$(DEST)}.o:
> $(CC) -c $(CFLAGS)...
>
>This will make it look in $(DEST) for the .o files FIRST and then
>fall back to the current directory.. Is there a way to do this with
>standard UNIX make????
No!
>Or is there a PD Make that will support this type of declaration???
Not exactly this type... But GNU make (for instance) supports a macro
called VPATH which makes it possible for you to specify the directories
where targets may be found if they are not in current directory. This
is a BSDism -- so any PD make claiming to be BSD-make compatible should
support this. I don't know of any, sorry.
Hope that helps.
Rajappa
--
Rajappa Iyer (Banker Group, Citicorp Software)
Internet : banker@shakti.ernet.in
Technical Details
Message-ID:
<1992Jan19.112635.4330@ncst.ernet.in>Path:
arc1-ca.pugleaf.net!sparky!uunet!shakti!bankerReferences:
<1992Jan18.190736.11729@markv.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1048e3,c0320cd0fce38cda X-Google-Attributes: gid1048e3,public X-Google-Thread: 134180,c0320cd0fce38cda X-Google-Attributes: gid134180,public X-Google-Thread: fe21a,c0320cd0fce38cda X-Google-Attributes: gidfe21a,public X-Google-Thread: 10f9b1,c0320cd0fce38cda X-Google-Attributes: gid10f9b1,public X-Google-ArrivalTime: 1992-01-19 03:59:38 PST Newsgroups: comp.unix.wizards,comp.unix.i386,comp.unix.sysv386,biz.sco.opendesktop Path: arc1-ca.pugleaf.net!sparky!uunet!shakti!banker From: banker@ncst.ernet.in (Rajappa Iyer) Subject: Re: question on makefiles...... Message-ID: <1992Jan19.112635.4330@ncst.ernet.in> Organization: Citicorp Overseas Software Ltd. References: <1992Jan18.190736.11729@markv.com> Date: Sun, 19 Jan 1992 11:26:35 GMT