help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Extracting Name of File in CFLAGS


From: Ajay Jain
Subject: Extracting Name of File in CFLAGS
Date: Tue, 29 Nov 2011 11:21:08 +0530

Hello Experts,

I have an elaborate recursive make system and I want an easy way to have
the name of the source file handy. To this end, I can use

.o : %.c
    $Q$(CC) -D BASENAME_FILE="$(shell basename $<)" $(CFLAGS) -c $< -o $@

However, this is probably not very neat as I want all variables to reflect
in CFLAGS.

I am more comfortable in using something like ..
CFLAGS += -D BASENAME_FILE="$$(notdir $$<)"

in my top level Makefile and hope that this will be enough in my
multi-layer build system. However, this does not work. Can somebody help me
on this?

Regards,
Ajay.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]