rumptools
include/mini-os/machine
include/xen
+
+app-tools/rumpxen-app-cc
+app-tools/specs
+app-tools/rumpxen-app-configure
+app-tools/rumpxen-app-make
HTTPD_OBJS+= httpd/content-bozo.o httpd/dir-index-bozo.o
.PHONY: default
-default: objs $(TARGET)
+default: objs app-tools $(TARGET)
objs:
mkdir -p $(OBJ_DIR)/lib $(OBJ_DIR)/xen/$(TARGET_ARCH_DIR)
$(LD) $(LDFLAGS) $(LDFLAGS_FINAL) $@.o $(EXTRA_OBJS) -o $@
#gzip -f -9 -c $@ >$@.gz
+
+APP_TOOLS += rumpxen-app-cc specs
+APP_TOOLS += rumpxen-app-configure rumpxen-app-make
+
+.PHONY: app-tools
+app-tools: $(addprefix app-tools/, $(APP_TOOLS))
+
+$(eval \
+APP_TOOLS_LDLIBS := $(patsubst -L%, -L$$(abspath %), $(LDARCHLIB) $(LDLIBS)))
+# We need to expand this twice because the replacement argument to
+# patsubst is normally expanded only once (beforehand), but we want to
+# apply abspath to each individual argument.
+
+APP_TOOLS_OBJS := \
+ $(abspath $(filter-out %/rumpkern_demo.o, $(OBJS))) \
+ $(APP_TOOLS_LDLIBS)
+
+APP_TOOLS_ARCH := $(subst x86_32,i386, \
+ $(subst x86_64,amd64, \
+ $(XEN_TARGET_ARCH)))
+
+app-tools/%: app-tools/%.in Makefile Config.mk
+ sed <$< >$@.tmp \
+ -e 's#!ARCH!#$(strip $(APP_TOOLS_ARCH))#;' \
+ -e 's#!BASE!#$(abspath .)#;' \
+ -e 's#!APPTOOLS!#$(abspath app-tools)#;' \
+ -e 's#!OBJS!#$(APP_TOOLS_OBJS)#;' \
+ -e 's#!HEAD_OBJ!#$(abspath $(HEAD_OBJ))#;' \
+ -e 's#!LDSCRIPT!#$(abspath $(LDSCRIPT))#;'
+ if test -x $<; then chmod +x $@.tmp; fi
+ mv -f $@.tmp $@
+
.PHONY: clean arch_clean
arch_clean:
--- /dev/null
+#!/bin/bash
+set -e
+outargs=()
+
+fail () { echo >&2 "stunt ld: $*"; exit 127; }
+
+noshift () { fail "no arg for $a"; }
+
+echo "stunt ld: $*"
+
+while [ $# != 0 ]; do
+ a=$1; shift
+ case "$a" in
+ [^-]*|-L*|-l*|--whole-archive|--no-whole-archive)
+ outargs+=("$a")
+ ;;
+ -m)
+ march="$1"; shift || noshift
+ outargs+=("$a" "$march")
+ ;;
+ -o)
+ outfile="$1"; shift || noshift
+ ;;
+ --as-needed|--no-as-needed)
+ ;;
+ --stunt-final-script)
+ finallds="$1"; shift || noshift
+ ;;
+ --stunt-intermediate)
+ inter1="$1"; shift || noshift
+ inter2="$1"; shift || noshift
+ ;;
+ *)
+ fail "unknown option $a"
+ ;;
+ esac
+done
+
+if [ x"$outfile" = x ]; then outfile=a.out; fi
+
+set -x
+ld -nostdlib -r "${outargs[@]}" -o "$inter1"
+objcopy -w -G xenos_* -G _start "$inter1" "$inter2"
+ld -m "$march" -T "$finallds" "$inter2" -o "$outfile"
--- /dev/null
+#!/bin/sh
+set -e
+case " $* " in
+*" -v "*) set -x ;;
+esac
+exec gcc -D__RUMPUSER_XEN__ -D__NetBSD__ -specs=!APPTOOLS!/specs "$@"
--- /dev/null
+#!/bin/sh
+# invoke this (for example) as .../app-configure ./configure --prefix=...
+set -e
+prog=$1; shift
+exec "$prog" --host=!ARCH!-rumpxen-netbsd CC=!APPTOOLS!/rumpxen-app-cc
--- /dev/null
+#!/bin/sh
+# invoke this (for example) as .../app-build make target
+set -e
+prog=$1; shift
+exec "$prog" CC=!APPTOOLS!/rumpxen-app-cc "$@"
--- /dev/null
+%rename cpp_options old_cpp_options
+
+*cpp_options:
+-nostdinc -isystem !BASE!/rump/include %(old_cpp_options)
+
+*linker:
+!APPTOOLS!/ld --stunt-intermediate %g.link1 %g.link2 --stunt-final-script !LDSCRIPT!
+
+*link:
+%{m64:-m elf_x86_64} %{m64|mx32:;:-m elf_i386} %{mx32:-m elf32_x86_64}
+
+*endfile:
+!OBJS!
+
+*startfile:
+!HEAD_OBJ!
+
+%rename link_libgcc old_link_libgcc
+
+%rename libgcc old_libgcc