summaryrefslogtreecommitdiffstats
path: root/make/custom
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2007-12-17 00:35:52 +0000
committerChris Johns <chrisj@rtems.org>2007-12-17 00:35:52 +0000
commitfa0533a2df038b90b8da1f683dc1e74b9ddcf430 (patch)
treeb8f9b31f73c34117178dc33321698a943dbfdb2c /make/custom
parent2007-12-17 Chris Johns <chrisj@rtems.org> (diff)
downloadrtems-fa0533a2df038b90b8da1f683dc1e74b9ddcf430.tar.bz2
2007-12-17 Chris Johns <chrisj@rtems.org>
* custom/mcf5235.cfg, custom/mrm332.cfg, custom/pc386.cfg: Split the make-exe and make-cxx-exe into bsp-link-c, bsp-link-cxx and bsp-post-link make macros. This allow external autotools support.
Diffstat (limited to 'make/custom')
-rw-r--r--make/custom/mcf5235.cfg28
-rw-r--r--make/custom/mrm332.cfg48
-rw-r--r--make/custom/pc386.cfg36
3 files changed, 75 insertions, 37 deletions
diff --git a/make/custom/mcf5235.cfg b/make/custom/mcf5235.cfg
index d1532f0643..a19c2361d1 100644
--- a/make/custom/mcf5235.cfg
+++ b/make/custom/mcf5235.cfg
@@ -32,17 +32,29 @@ endif
# The following are definitions of make-exe which will work using ld as
# is currently required.
-define make-exe
+define bsp-link-c
$(LINK.c) $(AM_CFLAGS) $(AM_LDFLAGS) \
- -o $(basename $@).nxe $(LINK_OBJS) $(LINK_LIBS)
- $(OBJCOPY) -O binary --strip-all $(basename $@).nxe $@
- $(SIZE) $(basename $@).nxe
+ -o $(basename $@)$(EXEEXT) $(LINK_OBJS) $(LINK_LIBS)
endef
-define make-cxx-exe
+
+define bsp-link-cxx
$(LINK.cc) $(AM_CFLAGS) $(AM_LDFLAGS) \
- -o $(basename $@).nxe $(LINK_OBJS) $(LINK_LIBS)
- $(OBJCOPY) -O binary --strip-all $(basename $@).nxe $@
- $(SIZE) $(basename $@).nxe
+ -o $(basename $@)$(EXEEXT) $(LINK_OBJS) $(LINK_LIBS)
+endef
+
+define bsp-post-link
+ $(OBJCOPY) -O binary --strip-all $(basename $@)$(EXEEXT) $(basename $@).nxe
+ $(SIZE) $(basename $@)$(EXEEXT)
+endef
+
+define make-exe
+ $(bsp-link-c)
+ $(bsp-post-link)
+endef
+
+define make-cxx-exe
+ $(bsp-link-cxx)
+ $(bsp-post-link)
endef
# Miscellaneous additions go here
diff --git a/make/custom/mrm332.cfg b/make/custom/mrm332.cfg
index 3207ee2202..cddf6aea5c 100644
--- a/make/custom/mrm332.cfg
+++ b/make/custom/mrm332.cfg
@@ -26,14 +26,28 @@ ifeq ($(MRM_IN_ROM),yes)
# Build a rommable image - move the .data section after the .text section
# in the image.
CPU_CFLAGS += -qnolinkcmds -T $(exec_prefix)/mrm332/lib/linkcmds_ROM
+endif
# This is a good way to get debug information. The output file is large
# though and greatly slows the build process so only do this if needed.
# $(OBJDUMP) -dxC $(basename $@).nxe > $(basename $@).dump
+#
+# chrisj: This is questionable. Why not keep unstipped ELF files
+# about the use objdump and nm to get at the debug
+# information rather than subject everyone to this.
+#
-define make-exe
- $(LINK.c) $(AM_CFLAGS) $(AM_LDFLAGS) -o $(basename $@).pxe \
+define bsp-link-c
+ $(LINK.c) $(AM_CFLAGS) $(AM_LDFLAGS) -o $(basename $@)$(EXEEXT) \
$(LINK_OBJS) $(LINK_LIBS)
+endef
+define bsp-link-cxx
+ $(LINK.cc) $(AM_CFLAGS) $(AM_LDFLAGS) -o $(basename $@)$(EXEEXT) \
+ $(LINK_OBJS) $(LINK_LIBS)
+endef
+
+ifeq ($(MRM_IN_ROM),yes)
+define bsp-post-link
$(OBJCOPY) --adjust-section-vma \
.data=`m68k-rtems-objdump --section-headers $(basename $@).pxe | \
awk 'function h2d(x) { x=toupper(x); digits=length(x); s=0 ; \
@@ -43,25 +57,33 @@ define make-exe
return s } ;\
/\.text/ { base = $$4 ; size = $$3 };\
END { printf("0x%x", h2d(base) + h2d(size)) }'\
- ` $(basename $@).pxe $(basename $@).nxe
- $(OBJCOPY) -O srec $(basename $@).nxe $(basename $@).srec
+ ` $(basename $@).pxe $(basename $@)$(EXEEXT)
+ $(OBJCOPY) -O srec $(basename $@)$(EXEEXT) $(basename $@).srec
sed -e 's/.$$//' -e '/^S0/d' $(basename $@).srec | \
- $(PACKHEX) > $(basename $@).exe
+ $(PACKHEX) > $(basename $@).nxe
$(NM) -g -n $(basename $@).pxe > $(basename $@).pnum
$(NM) -g -n $(basename $@).nxe > $(basename $@).num
- $(SIZE) $(basename $@).nxe
+ $(SIZE) $(basename $@)$(EXEEXT)
endef
else
-define make-exe
- $(LINK.c) $(AM_CFLAGS) $(AM_LDFLAGS) -o $(basename $@).nxe \
- $(LINK_OBJS) $(LINK_LIBS)
- $(OBJCOPY) -O srec $(basename $@).nxe $(basename $@).srec
+define bsp-post-link
+ $(OBJCOPY) -O srec $(basename $@)$(EXEEXT) $(basename $@).srec
# m68k-rtems-objdump -dxC $(basename $@).nxe > $(basename $@).dump
sed -e 's/.$$//' -e '/^S0/d' $(basename $@).srec | \
- $(PACKHEX) > $(basename $@).exe
- $(NM) -g -n $(basename $@).nxe > $(basename $@).num
- $(SIZE) $(basename $@).nxe
+ $(PACKHEX) > $(basename $@).nxe
+ $(NM) -g -n $(basename $@)$(EXEEXT) > $(basename $@).num
+ $(SIZE) $(basename $@)$(EXEEXT)
endef
endif
+define make-exe
+ $(bsp-link-c)
+ $(bsp-post-link)
+endef
+
+define make-cxx-exe
+ $(bsp-link-cxx)
+ $(bsp-post-link)
+endef
+
# Miscellaneous additions go here
diff --git a/make/custom/pc386.cfg b/make/custom/pc386.cfg
index 72079833a9..4b9a4bd01d 100644
--- a/make/custom/pc386.cfg
+++ b/make/custom/pc386.cfg
@@ -45,15 +45,24 @@ HEADERADDR=0x00097E00
# The following are definitions of make-exe which will work using ld as
# is currently required.
-define make-exe
+define bsp-link-c
$(LINK.c) $(AM_CFLAGS) $(AM_LDFLAGS) -Wl,-Ttext,$(RELOCADDR) \
- -o $(basename $@).nxe \
+ -o $(basename $@)$(EXEEXT) \
$(LINK_OBJS) $(LINK_LIBS)
+endef
+
+define bsp-link-cxx
+ $(LINK.cc) $(AM_CFLAGS) $(AM_LDFLAGS) -Wl,-Ttext,$(RELOCADDR) \
+ -o $(basename $@)$(EXEEXT) \
+ $(LINK_OBJS) $(LINK_LIBS)
+endef
+
+define bsp-post-link
$(OBJCOPY) -O elf32-i386 \
--remove-section=.rodata \
--remove-section=.comment \
--remove-section=.note \
- --strip-unneeded $(basename $@).nxe $@
+ --strip-unneeded $(basename $@)$(EXEEXT) $(basename $@).nxe
$(OBJCOPY) -O binary $(basename $@).nxe $(basename $@).bin
$(PROJECT_TOOLS)/bin2boot -v $(basename $@).bt $(HEADERADDR)\
$(START16FILE) $(START16ADDR) 0 $(basename $@).bin $(RELOCADDR) 0
@@ -69,20 +78,15 @@ define make-exe
# $(LINK.c) $(AM_CFLAGS) $(AM_LDFLAGS) -Wl,-Ttext,$(RELOCADDR) \
# -o $@ $(LINK_OBJS) $(LINK_LIBS)
endef
+
+define make-exe
+ $(bsp-link-c)
+ $(bsp-post-link)
+endef
+
define make-cxx-exe
- $(LINK.cc) $(AM_CFLAGS) $(AM_CXXFLAGS) $(AM_LDFLAGS) \
- -Wl,-Ttext,$(RELOCADDR) -o $(basename $@).nxe \
- $(LINK_OBJS) $(LINK_LIBS)
- $(OBJCOPY) -O elf32-i386 \
- --remove-section=.rodata \
- --remove-section=.comment \
- --remove-section=.note \
- --strip-unneeded $(basename $@).nxe $@
- $(OBJCOPY) -O binary $(basename $@).nxe $(basename $@).bin
- $(PROJECT_TOOLS)/bin2boot -v $(basename $@).bt $(HEADERADDR)\
- $(START16FILE) $(START16ADDR) 0 $(basename $@).bin $(RELOCADDR) 0
- $(NM) -g -n $(basename $@).nxe > $(basename $@).num
- $(SIZE) $(basename $@).nxe
+ $(bsp-link-cxx)
+ $(bsp-post-link)
endef
# Miscellaneous additions go here