LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 04-27-2007, 03:46 AM   #1
nikoladsp
LQ Newbie
 
Registered: Feb 2006
Location: novi sad,serbia
Distribution: slackware,minislack,ubuntu,suse,mandrake
Posts: 6

Rep: Reputation: 0
Question makefile for debug and release version


hi,
i would like to write one Makefile with capabilities to build debug and release version of one program, ie:

Code:
CC		= g++
BIN		= ./bin
CFLAGS	        = -Wall
RM		= rm -rf

	
debug: main.cpp
	CFLAGS="$CFLAGS -g -ggdb3"
	$(CC) $(CFLAGS) -o $(BIN)/cygtestd main.cpp
	
release: main.cpp
	CFLAGS="$CFLAGS -O2"
	$(CC) $(CFLAGS) $(BIN)/cygtest main.cpp
	
clean:
	$(RM) $(BIN)/*.o $(BIN)/*.exe
or something like this...i consulted GNU Makefile, without success can somebody help?

10x in advance...

ps
i am using eclipse + cygwin.
 
Old 04-27-2007, 04:30 AM   #2
nikoladsp
LQ Newbie
 
Registered: Feb 2006
Location: novi sad,serbia
Distribution: slackware,minislack,ubuntu,suse,mandrake
Posts: 6

Original Poster
Rep: Reputation: 0
Lightbulb

i will reply to myslef, but with another 2 questions
Code:
CC	= g++
CFLAGS	= -Wall
RM	= rm -rf

BIN	= ./bin
OUT	= 
DEBUG 	= yes

ifeq ($(DEBUG),yes)
	CFLAGS += -ggdb3
	OUT = $(BIN)/cygtestd.exe
else
	CFLAGS += -O2
	OUT = $(BIN)/cygtest.exe
endif
	 
all: main

main: main.o
	$(CC) $(BIN)/main.o -o $(OUT)
	
main.o: main.cpp
	$(CC) $(CFLAGS) -c main.cpp -o $(BIN)/main.o

clean:
	$(RM) $(BIN)/*.o $(OUT)
1. is this solution is OK to use?
2. how to make case-insensitive comparation in ifeq(...)?

10x

Last edited by nikoladsp; 04-27-2007 at 04:42 AM.
 
  


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
libstdc++ debug version - where to get? __saint Programming 1 01-16-2007 06:21 PM
Which version or Release should I install on my other PC? as400 Solaris / OpenSolaris 3 08-06-2006 01:37 AM
Compile C++ in Release vs. Debug Mode Hady Programming 7 06-13-2005 04:00 AM
Help-release version sureshkellemane Linux - General 1 02-18-2005 02:23 AM
ys flight debug linux version Qual Linux - Games 0 11-29-2003 08:27 PM

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

All times are GMT -5. The time now is 08:25 AM.

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