Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 11-17-2009, 02:44 PM   #1
LQ Newbie
Registered: Mar 2009
Posts: 24

Rep: Reputation: 0
Makefile with debug

Does anyone know if it is possible to make rules in a Makefile that would work like this:

> make debug module
> make module debug

where module can be any module that has a specific rule in the Makefile.

The thing I have is a Makefile with different rules that I compile like this:

> make module

What I would like is to add an option so I can compile whichever module with debug-information just by adding a debug to the make command. The debug-information I know how to do, the problem is how to make the Makefile work...

Anyone knows?
Old 11-18-2009, 10:22 AM   #2
Senior Member
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
Why not add Make targets like
module: ...
module-debug: ...
Then you can simply type

make module-debug
Make commands can accept multiple targets, so your examples would simply make the "debug"
and "module" targets one after the other. You could overwrite that behaviour (eg through an "alias" or
a custom script), but the above solution is probably easier.

Another option would be to use a compiler / make flag.

Please use CODE tags for easier reading.
Old 11-18-2009, 11:24 AM   #3
LQ Newbie
Registered: Mar 2009
Posts: 24

Original Poster
Rep: Reputation: 0
Well, I kind of settled for your solution also. I asked my professor and he said that what I was asking for was not possible with a Makefile. Not in an easy way anyhow... Thank you for your answer.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
makefile debug abhinav.arora Programming 2 03-10-2009 04:32 PM
Makefile debug target StevenR Programming 1 01-11-2009 08:47 PM
makefile for debug and release version nikoladsp Programming 1 04-27-2007 05:30 AM
How to debug without having debug section in an executable ? unclesam Linux - Newbie 0 02-02-2006 07:23 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:30 PM.

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