>> On Thu, 30 Sep 2010 09:20:36 +0530, >> Anand Sivaram <aspn...@gmail.com> said:
AS> On Thu, Sep 30, 2010 at 09:12, Boyd Stephen Smith Jr. wrote: B> On Wednesday 29 September 2010 15:18:46 abdelkader belahcene wrote: A> yes but normally gcc should be configured, where is the config file, B> It's in the same place as the config file for ls, cp, and rm. (There B> isn't one.) This is where the BSD version of make has an advantage over GNU make. It checks for system-wide defaults in the file /etc/make.conf: me% uname -sr FreeBSD 6.2-RELEASE me% cat /etc/make.conf CPUTYPE?=pentium4 CFLAGS= -O2 -pipe -funroll-loops COPTFLAGS= -O -pipe AS> I think using an alias 'gcc -lm' is not a good idea. It may be looking AS> easier for this particular C file, but '-lm' would be linked always for AS> even in the case of hello_world.c which is really unnecessary. The additional linking won't do much besides take an extra millisecond of time and add around 25 bytes to your binary; that's what I saw when comparing on a Deadrat Enterprise system. Build the executable both ways, run "nm" and chop the first 10 characters to see for yourself. The results should be identical. You're right about the alias -- it works fine right up to the part where someone changes their login shell or alias setup. It's safer to use a script as a front-end, so you can check for environment variables in a global or user-specific config file: #!/bin/sh # front-end for make with preset preferences. export PATH=/usr/local/bin:/bin:/sbin:/usr/sbin:/usr/bin cbase='make.conf' for cfg in /etc/$cbase $HOME/etc/$cbase; do test -f "$cfg" && . $cfg done exec /usr/bin/make ${1+"$@"} # Use full path just to be safe... exit 1 Under Linux, the config file looks like this: me% cat $HOME/etc/make.conf # Default values for make. export CC="gcc" export CFLAGS="-O2 -pipe -funroll-loops" export COPTFLAGS="-O -pipe" Comparison: me% cat Makefile hello: hello.o hello.o: hello.c me% cat hello.c #include <stdio.h> #include <stdlib.h> main() { printf("hello, world\n"); #ifdef unix printf("unix defined\n"); #endif exit(0); } me% make cc -c -o hello.o hello.c cc hello.o -o hello me% ./make # using the frontend script gcc -O2 -pipe -funroll-loops -c -o hello.o hello.c gcc hello.o -o hello -- Karl Vogel I don't speak for the USAF or my company Beauty is only a light switch away. --Perkins Library, Duke University, Durham, North Carolina -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20100930192027.79c5ab...@kev.msw.wpafb.af.mil