standard OS defines
does anyone know where i can find a list of standardized OS defines? i've come across the list below, but i haven't found an authoritative resource convince me these are standard/correct. even if they are i'm sure what i've found is a just a subset of a larger list--but i don't know where to look.
__CYGWIN____NetBSD____OpenBSD____linux____sun__
also, is there a tool that like getconf that i can use to pipe these defines into gcc at compile time?
thanks in advance,
bryan
Quoted 11 lines · On Wednesday 22 August 2007 14:35:21 Bryan Christ wrote:
does anyone know where i can find a list of standardized OS defines? i've come across the list below, but i haven't found an authoritative resource convince me these are standard/correct. even if they are i'm sure what i've found is a just a subset of a larger list--but i don't know where to look.
__CYGWIN____NetBSD____OpenBSD____linux____sun__
Take a look at:
info cpp "System-specific Predefined Macros"
A good list is here:
http://predef.sourceforge.net/preos.html
Quoted 2 lines
also, is there a tool that like getconf that i can use to pipe these defines into gcc at compile time?
You can define macros on the command line by passing the -D flag to gcc.
Quoted 3 lines
thanks in advance,
bryan
-
Thanks! This list is exactly what I was looking for. Too bad there's not a tool for piping to gcc--I was trying to avoid -D.
Bryan
Quoted 27 lines · Stephen Kratzer
Quoted 11 lines · On Wednesday 22 August 2007 14:35:21 Bryan Christ wrote:
does anyone know where i can find a list of standardized OS defines? i've come across the list below, but i haven't found an authoritative resource convince me these are standard/correct. even if they are i'm sure what i've found is a just a subset of a larger list--but i don't know where to look.
__CYGWIN____NetBSD____OpenBSD____linux____sun__Take a look at:
info cpp "System-specific Predefined Macros"A good list is here:
http://predef.sourceforge.net/preos.htmlQuoted 2 lines
also, is there a tool that like getconf that i can use to pipe these defines into gcc at compile time?
You can define macros on the command line by passing the -D flag to gcc.
Quoted 3 lines
thanks in advance,
bryan
-
Quoted 4 lines · On Wednesday 22 August 2007 15:28:17 Bryan Christ wrote:
Thanks! This list is exactly what I was looking for. Too bad there's not a tool for piping to gcc--I was trying to avoid -D.
Bryan
This is about as ugly as it gets, but here it is anyway:
echo -e "#ifndef __SOMETHING__\n#define __SOMETHING__\n#endif" | cat - infile.c | gcc -x c -o outfile.c -
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
ugly or not--thanks again!
Quoted 9 lines · Stephen Kratzer
Quoted 4 lines · On Wednesday 22 August 2007 15:28:17 Bryan Christ wrote:
Thanks! This list is exactly what I was looking for. Too bad there's not a tool for piping to gcc--I was trying to avoid -D.
Bryan
This is about as ugly as it gets, but here it is anyway:
echo -e "#ifndef __SOMETHING__\n#define __SOMETHING__\n#endif" | cat -
infile.c| gcc -x c -ooutfile.c-
Quoted 6 lines · On Wednesday 22 August 2007 15:47:25 Stephen Kratzer wrote:
Quoted 4 lines · On Wednesday 22 August 2007 15:28:17 Bryan Christ wrote:
Thanks! This list is exactly what I was looking for. Too bad there's not a tool for piping to gcc--I was trying to avoid -D.
Bryan
Quoted 8 lines
This is about as ugly as it gets, but here it is anyway:
echo -e "#ifndef __SOMETHING__\n#define __SOMETHING__\n#endif" | cat -
infile.c| gcc -x c -ooutfile.c-
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
The outfile shouldn't have a .c extension since it's a binary. My bad. The following is slightly cleaner, but not much:
sed '1 i\#ifndef __SOMETHING__\n#define __SOMETHING__\n#endif\n' infile.c | gcc -x c -o outfile -
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html