www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/17/13:15:39

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: How do I do this with make?
Date: Sat, 17 Jan 1998 17:51:57 +0000
Organization: None
Distribution: world
Message-ID: <vLi4GHA9+Ow0EwMI@talula.demon.co.uk>
References: <69nuae$492$1 AT star DOT cs DOT vu DOT nl>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 26
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Ruiter de M writes:
>What I hope to do is to use ONE dependancy in ONE makefile in ONE run 
>of `make' to handle this, because the names of the dirs can change and 
>I want them in a variable. I have tried all sorts of things but it was 
>not possible.

I am no make expert but I think the VPATH directive will be able to do
what you want. For example in the Allegro makefile I write:

VPATH = demo docs examples setup src tests tools src/djgpp

obj/djgpp/%.o: %.c allegro.h
        gcc $(CFLAGS) -o $@ -c $<

This makes it possible to compile .c into .o from any of the directories
named in the VPATH, without needing to explicitly state the path to the
file (make will search those directories for it). Of course this isn't
any good if you have different files with the same names in various
directories, but I find it extremely handy since it lets me organise the
code in a sensible directory structure without having to list any paths
in the makefile.


--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
"Pigs use it for a tambourine" - Frank Zappa

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019