help-make
[Top][All Lists]
Advanced

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

generate a File-ID??


From: Torsten Mohr
Subject: generate a File-ID??
Date: Mon, 3 Jul 2006 20:58:58 +0200
User-agent: KMail/1.9.1

Hi,

in a large project with several source files (in C) for an
embedded target with not much ROM we want to use a self-written
"assert" that does not print out the file name (too much program
space) but uses a "file ID" that i want to hand over to the
compiler when generating the object file.

So when there are several files like:

SRC := main.c init.c io.c ...

Then i'd like to tell the compiler _individually_ for each file
what "file ID" this file has.

At the moment i think about adding a command line #define like:

obj/%.o : %.c
        $(CC) -DF_ID=F_ID_$(subst .,_,$<)

If then F_ID_main_c := 1 the compiler option should expand to
-DF_ID=1 for "main.c".

Now the question, if there is a list of sources in SRC, can i
somehow automatically generate variables F_ID_main_c, F_ID_init_c
and so on?  I think of a clever combination of $(words), $(wordlist),
$(eval) and maybe others?


Or do you see some other way to achieve what i want to do?


Best regards,
Torsten.




reply via email to

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