It works! Thanks. J
De: Johny Mattsson [mailto:[email protected]] Enviada: sexta-feira, 29 de Julho de 2011 00:25 Para: Carlos Rodrigues Cc: tinyos-help Assunto: Re: [Tinyos-help] Create a random value during make On Thu, Jul 28, 2011 at 11:20 PM, Carlos Rodrigues <[email protected]> wrote: It is possible create a random value during a make? For example in Makefile have something like this: CFLAGS += -DVALUE_RANDOM Assuming you're on a *nix system (and using GNU make, but that should be a given), you could do something like: 1) For low randomness (but maybe sufficient for you), just use a process ID: CFLAGS+= -DMY_RANDOM_VALUE=$(shell echo $$$$) or 2) For much better randomness, grab a couple of bytes from /dev/random, like so: CFLAGS+= -DMY_RANDOM_VALUE=$(shell dd if=/dev/random bs=2 count=1 2>/dev/null | od -tu2 | awk '{print $$2}') There are probably shorter/neater way to do the latter, but I'll leave that as the traditional exercise for the reader. Cheers, /Johny
_______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
