summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtc%netscape.com <devnull@localhost>2003-04-16 01:23:52 +0000
committerwtc%netscape.com <devnull@localhost>2003-04-16 01:23:52 +0000
commitc000326732a89dfa8d46f5116efb4dec8fdf8579 (patch)
tree9c0a49339e7b55404cd9ba34de73b1946820162e
parent7e145ac9c2c2368a3ec0e3eee9a15b9538deeb3d (diff)
downloadnspr-hg-c000326732a89dfa8d46f5116efb4dec8fdf8579.tar.gz
Bug 105271: compile source files with absolute pathnames so that the
debuggers can find them automatically. Currently enabled on Windows and OS/2 only. The patch is contributed by Julien Pierre. r=wtc.
-rw-r--r--config/rules.mk34
1 files changed, 30 insertions, 4 deletions
diff --git a/config/rules.mk b/config/rules.mk
index 3cecd88d..7d8a7aef 100644
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -379,17 +379,39 @@ ifeq ($(OS_ARCH),SunOS)
sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@
endif
+#
+# Translate source filenames to absolute paths. This is required for
+# debuggers under Windows and OS/2 to find source files automatically.
+#
+
+ifeq ($(OS_ARCH),OS2)
+NEED_ABSOLUTE_PATH = 1
+endif
+
+ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
+NEED_ABSOLUTE_PATH = 1
+endif
+
+ifdef NEED_ABSOLUTE_PATH
+PWD := $(shell pwd)
+abspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD)/$(1)))
+endif
+
$(OBJDIR)/%.$(OBJ_SUFFIX): %.cpp
@$(MAKE_OBJDIR)
ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
- $(CCC) -Fo$@ -c $(CCCFLAGS) $<
+ $(CCC) -Fo$@ -c $(CCCFLAGS) $(call abspath,$<)
else
ifeq ($(MOZ_OS2_TOOLS),VACPP)
- $(CCC) -Fo$@ -c $(CCCFLAGS) $<
+ $(CCC) -Fo$@ -c $(CCCFLAGS) $(call abspath,$<)
+else
+ifdef NEED_ABSOLUTE_PATH
+ $(CCC) -o $@ -c $(CCCFLAGS) $(call abspath,$<)
else
$(CCC) -o $@ -c $(CCCFLAGS) $<
endif
endif
+endif
WCCFLAGS1 = $(subst /,\\,$(CFLAGS))
WCCFLAGS2 = $(subst -I,-i=,$(WCCFLAGS1))
@@ -397,14 +419,18 @@ WCCFLAGS3 = $(subst -D,-d,$(WCCFLAGS2))
$(OBJDIR)/%.$(OBJ_SUFFIX): %.c
@$(MAKE_OBJDIR)
ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
- $(CC) -Fo$@ -c $(CFLAGS) $<
+ $(CC) -Fo$@ -c $(CFLAGS) $(call abspath,$<)
else
ifeq ($(MOZ_OS2_TOOLS),VACPP)
- $(CC) -Fo$@ -c $(CFLAGS) $<
+ $(CC) -Fo$@ -c $(CFLAGS) $(call abspath,$<)
+else
+ifdef NEED_ABSOLUTE_PATH
+ $(CC) -o $@ -c $(CFLAGS) $(call abspath,$<)
else
$(CC) -o $@ -c $(CFLAGS) $<
endif
endif
+endif
$(OBJDIR)/%.$(OBJ_SUFFIX): %.s