Thread View: comp.unix.programmer
7 messages
7 total messages
Started by Alex Vinokur
Wed, 09 May 2001 09:14
Dependencies in makefile
Author: Alex Vinokur
Date: Wed, 09 May 2001 09:14
Date: Wed, 09 May 2001 09:14
16 lines
1254 bytes
1254 bytes
-- I am using GNU make. Can I write in makefile dependencies as following : xxx.o : *.h instead of xxx.o: aaa.h bbb.h ? ============================ Alex Vinokur mailto:alexvn@bigfoot.com http://up.to/alexvn ============================
Re: Dependencies in makefile
Author: David Schwartz
Date: Wed, 09 May 2001 08:36
Date: Wed, 09 May 2001 08:36
14 lines
1402 bytes
1402 bytes
Alex Vinokur wrote: > I am using GNU make. > > Can I write in makefile dependencies as following : > xxx.o : *.h > instead of > xxx.o: aaa.h bbb.h > ? What would that mean? Which header files? DS
Re: Dependencies in makefile
Author: Jonathan Kamens
Date: Wed, 09 May 2001 13:45
Date: Wed, 09 May 2001 13:45
60 lines
2695 bytes
2695 bytes
In article <3AF90198.CE0A2ED8@webmaster.com>,
David Schwartz <davids@webmaster.com> writes:
>> I am using GNU make.
>>
>> Can I write in makefile dependencies as following :
>> xxx.o : *.h
>> instead of
>> xxx.o: aaa.h bbb.h
>> ?
>
> What would that mean? Which header files?
Um, it would mean all of the files which match the wildcard, i.e., all
the header files in the directory, obviously. In other words,
"Rebuild this object if any of the header files changes."
To answer the original poster's question, yes, in GNU Make you can use
wildcards in dependencies, but you need to make sure that at least one
file matching the wildcard actually exists, or you'll get an error.
For example:
/tmp> mkdir test-make
/tmp> cd test-make
/tmp/test-make> cat > Makefile
foo: *.h
touch foo
/tmp/test-make> make foo
make: *** No rule to make target `*.h', needed by `foo'. Stop.
/tmp/test-make> touch a.h
/tmp/test-make> make foo
touch foo
/tmp/test-make> make foo
make: `foo' is up to date.
/tmp/test-make> touch b.h
/tmp/test-make> make foo
touch foo
/tmp/test-make> make foo
make: `foo' is up to date.
/tmp/test-make> touch a.h
/tmp/test-make> make foo
touch foo
/tmp/test-make> make foo
make: `foo' is up to date.
/tmp/test-make>
You can alo use $(wildcard *.h) instead of *.h in your dependency, in
which case you won't get an error if there aren't any *.h files:
/tmp/test-make> cat > Makefile2
foo: $(wildcard *.h)
touch foo
/tmp/test-make> rm *.h
/tmp/test-make> make -f Makefile2 foo
make: `foo' is up to date.
/tmp/test-make> touch a.h
/tmp/test-make> make -f Makefile2 foo
touch foo
/tmp/test-make> make -f Makefile2 foo
make: `foo' is up to date.
/tmp/test-make>
Re: Dependencies in makefile
Author: Alex Vinokur
Date: Wed, 09 May 2001 14:19
Date: Wed, 09 May 2001 14:19
26 lines
1597 bytes
1597 bytes
David Schwartz wrote: > Alex Vinokur wrote: > > > I am using GNU make. > > > > Can I write in makefile dependencies as following : > > xxx.o : *.h > > instead of > > xxx.o: aaa.h bbb.h > > ? > > What would that mean? Which header files? > > DS I mean that there are two header files only : aaa.h and bbb.h. ================================== Alex Vinokur mailto:alexvn@bigfoot.com http://up.to/alexvn http://visitweb.com/alexvn.math ==================================
Re: Dependencies in makefile
Author: Erik Max Francis
Date: Wed, 09 May 2001 15:37
Date: Wed, 09 May 2001 15:37
21 lines
1471 bytes
1471 bytes
Alex Vinokur wrote:
> I am using GNU make.
>
> Can I write in makefile dependencies as following :
> xxx.o : *.h
> instead of
> xxx.o: aaa.h bbb.h
> ?
GNU make has the wildcard builtin:
xxx.o: $(wildcard *.h)
--
Erik Max Francis / max@alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/ \ I just want to create my own life. I can just be me.
\__/ Ekene Nwokoye
REALpolitik / http://www.realpolitik.com/
Get your own customized newsfeed online in realtime ... for free!
Re: Dependencies in makefile
Author: Jonathan Kamens
Date: Wed, 09 May 2001 17:06
Date: Wed, 09 May 2001 17:06
8 lines
1241 bytes
1241 bytes
In article <3AF9643D.98B1A864@alcyone.com>, Erik Max Francis <max@alcyone.com> writes: >GNU make has the wildcard builtin: > >xxx.o: $(wildcard *.h) But, as I wrote in another message, it also allows dependencies to be direct wildcards without wrapping them in $(wildcard ...).
Re: Dependencies in makefile
Author: wim delvaux
Date: Sat, 12 May 2001 12:29
Date: Sat, 12 May 2001 12:29
20 lines
1527 bytes
1527 bytes
David Schwartz wrote: > Alex Vinokur wrote: > > > I am using GNU make. > > > > Can I write in makefile dependencies as following : > > xxx.o : *.h > > instead of > > xxx.o: aaa.h bbb.h > > ? > > What would that mean? Which header files? > > DS generally you can. I do not know what you want to acchieve but yes you can specify wildcard dependencies W
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads