LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-12-2007, 06:13 AM   #1
RudraB
Member
 
Registered: Mar 2007
Distribution: Fedora
Posts: 264

Rep: Reputation: 23
Unhappy creating log file


hello friends,
i am a bit trouble and looking some help. i have written a makefile ,that compiles a number of profram using fortran compiler,g95.
i have switched -Wall tag so it gives some warnning as well.
this the output of my make: $ make run "flag= -Wall"
as u can understand, blue lines are general make output and red lines are output of -Wall.
g95 -O3 -Wall -c main.f90
g95 -O3 -Wall -c map.f90

In file map.f90:10

integer::i,j,k,dx,dy,d2
1
Warning (137): Variable 'dx' at (1) is never used and never set
In file map.f90:10

integer::i,j,k,dx,dy,d2
1
Warning (137): Variable 'd2' at (1) is never used and never set
In file map.f90:10

integer::i,j,k,dx,dy,d2
1
Warning (137): Variable 'dy' at (1) is never used and never set
g95 -O3 -Wall -c coeff.f90
In file coeff.f90:6

integer,parameter::eps=.138,t=-1
1
Warning (141): Implicit conversion at (1) causes precision loss

g95 -O3 -Wall main.o map.o coeff.o -o run

i have managed to seperate these two types of prompt using
make run 2>warnning.log
but is there any way to edit my make file so that it will create the log file itself without specifying 2>log eachtime while 'make' it?
looking for your kind help.
Regards
advanced
 
Old 12-12-2007, 06:52 AM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
Just add 2>&1 to the end of the gcc invocation lines in your Makefile. e.g. note the lines which use $(CC) here:
Code:
CC = gcc
CFLAGS = -g -Wall
LFLAGS =

SOURCES = main.c extra.c
OBJECTS = $(SOURCES:.c=.o)
BINARY = myprog

$(BINARY) : $(OBJECTS)
        $(CC) $(LFLAGS) $(OBJECTS) -o $(BINARY) 2>&1

.PHONY: clean
clean :
        rm $(BINARY) $(OBJECTS)

%.o : %.c
        $(CC) -c $(CFLAGS) -o $@ $< 2>&1
 
Old 12-12-2007, 11:35 PM   #3
RudraB
Member
 
Registered: Mar 2007
Distribution: Fedora
Posts: 264

Original Poster
Rep: Reputation: 23
dera friend, thanks for your reply...but it doesnt work...
firstly, i want the warnnings to be put on a different file...error.log(say)
when i put 2>&1,it still prints the warnning on screen.
on the other hand, if i put 2>w.log, wgenever compiler is invoked, its prompting nothin to that file....thats what is puzzellin me.....plz. chek
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
creating a log file ttumelty Programming 2 12-13-2005 12:30 PM
Creating the log-file dr_sad Programming 5 04-12-2005 05:01 PM
Creating a Log file nguye103 Linux - Newbie 1 10-21-2004 06:16 PM
Creating a log file in unix?? linux_dejan Programming 3 09-03-2004 10:56 PM
Cron - not creating log file t3___ Linux - Newbie 3 02-26-2004 06:50 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration