Current dir in makefile?

Programming, for all ages and all languages.
Post Reply
CodeCat
Member
Member
Posts: 158
Joined: Tue Sep 23, 2008 1:45 pm
Location: Eindhoven, Netherlands

Current dir in makefile?

Post by CodeCat »

This is probably a stupid question, but is there some predefined variable or something else in (GNU) makefiles that expands to the current directory? I want it to run a command that requires only absolute pathnames, so rather than tying it to one dir I would prefer it if make could fill it in. Looked in the make manual, but didn't find anything useful there.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Current dir in makefile?

Post by Combuster »

Try shelling pwd and grabbing the output.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Current dir in makefile?

Post by Solar »

$(CURDIR)
Every good solution is obvious once you've found it.
CodeCat
Member
Member
Posts: 158
Joined: Tue Sep 23, 2008 1:45 pm
Location: Eindhoven, Netherlands

Re: Current dir in makefile?

Post by CodeCat »

Works, thanks! (Can't believe I missed that one)
Post Reply