From 1dbfa356e648537f1dba65cdfa557d43c5bf9485 Mon Sep 17 00:00:00 2001
From: Olivier Blin <oblin@mandriva.com>
Date: Tue, 14 Aug 2007 11:52:11 +0000
Subject: make gdb debugging easier (-g, no optimization, no stripping, stdio
 frontend) if DEBUG is set

---
 mdk-stage1/Makefile.common | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

(limited to 'mdk-stage1')

diff --git a/mdk-stage1/Makefile.common b/mdk-stage1/Makefile.common
index 21586cb1c..f5209a58e 100644
--- a/mdk-stage1/Makefile.common
+++ b/mdk-stage1/Makefile.common
@@ -17,9 +17,14 @@
 ARCH := $(patsubst i%86,i386,$(shell uname -m))
 ARCH := $(patsubst sparc%,sparc,$(ARCH))
 
+# DEBUG = 1
+
  #- default frontend is newt (honoured by main Makefile whenever possible)
+ifdef DEBUG
+F = STDIO
+else
 F = NEWT
-# F = STDIO
+endif
 
 DIET = $(shell test -x /usr/bin/diet && echo diet)
 
@@ -30,8 +35,14 @@ else
 L = GLIBC
 endif
 
+ifdef DEBUG
+OPTFLAGS = -g
+else
+OPTFLAGS = -Os
+endif
+
 #- flags used by all stuff
-CFLAGS = -Os -pipe -Wall -fomit-frame-pointer -fno-strict-aliasing
+CFLAGS = $(OPTFLAGS) -pipe -Wall -fomit-frame-pointer -fno-strict-aliasing
 
 ifneq (ppc, $(ARCH))
 ifneq (sparc, $(ARCH))
@@ -49,5 +60,9 @@ LDFLAGS = $($(L)_LDFLAGS)
 
 STAGE1_LIBC = $($(L)_LIBC)
 
+ifdef DEBUG
+STRIPCMD = echo not stripping
+else
 STRIPCMD = strip -R .note -R .comment
+endif
 
-- 
cgit v1.2.1