help-make
[Top][All Lists]
Advanced

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

Re: generate a File-ID??


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

Hi,

> In that case I think you meant:
> > obj/%.o : %.c
> >         $(CC) -DF_ID=$(F_ID_$(subst .,_,$<))

yes, correct.  I just wrote it as guessed without testing.

>   tm> Now the question, if there is a list of sources in SRC, can i
>   tm> somehow automatically generate variables F_ID_main_c, F_ID_init_c
>   tm> and so on?  I think of a clever combination of $(words),
>   tm> $(wordlist), $(eval) and maybe others?
>
> I really don't think this is a good idea.  If you generate it like this
> then whenever you add a new file to the system all the existing files
> will be renumbered, unless you're sure you always only ever add them at
> the end of the list.

Yes, correct.  But we'll also generate a list of sources per release
then.

> Also, what about files in different directories?  They'll have the same
> ID#.  Or, do you plan to have a directory ID# as well?  Or maybe
> restrict the build environment so that no filename can appear twice,
> even in different directories (yuck...)

Yes, correct.  The $(subst) was just an example, i also would have
replaces / to _.

> My advice is don't risk it, and write out the list of numbers by hand,
> either in your makefile or in some .h file.

Those are quite many files and by doing this by hand it will be probable
that errors happen.

> One advantage of doing it in the makefile is that you won't have to
> rebuild the world every time you add a new file (and thus change the .h
> file).


Thanks for your hints,
Torsten.




reply via email to

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