Skip to content

Commit

Permalink
Rename the toolchain tuple to what was discussed on the mailing list.
Browse files Browse the repository at this point in the history
e.g. x86_64-rumprun-netbsd will work now both for xen and hw.  The
platform is selected during the "bake" phase, everything before that is
(or should be) platform-independent, only target ISA dependent.
  • Loading branch information
anttikantee committed Jun 30, 2015
1 parent bca647a commit 971d63d
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 24 deletions.
29 changes: 18 additions & 11 deletions app-tools/Makefile.app-tools
Expand Up @@ -13,30 +13,34 @@ $(error ${_APPTOOLS_MISSING} not defined)
endif

APP_TOOL_FILES= cc c++ configure make gmake
APP_TOOL_FILES+= specs-compile_or_ferment specs-stub specs-bake

APP_TOOL_SPECS= specs-compile_or_ferment specs-stub

APP_TOOL_PASSTHROUGH= ar as cpp ld nm objcopy objdump ranlib readelf
APP_TOOL_PASSTHROUGH+= size strings strip

_APP_TOOL_TARGETS:= \
$(APP_TOOL_FILES:%=$(APP_TOOLS_DIR)/rumprun-$(APP_TOOLS_PLATFORM)-%) \
$(APP_TOOL_PASSTHROUGH:%=$(APP_TOOLS_DIR)/rumprun-$(APP_TOOLS_PLATFORM)-%) \
$(APP_TOOLS_DIR)/rumpbake
GNUPLATFORM:= $(subst --,-rumprun-,$(APP_TOOLS_GNUPLATFORM))

_APP_TOOL_TARGETS:= \
$(APP_TOOL_FILES:%=$(APP_TOOLS_DIR)/$(GNUPLATFORM)-%) \
$(APP_TOOL_SPECS:%=$(APP_TOOLS_DIR)/%) \
$(APP_TOOL_PASSTHROUGH:%=$(APP_TOOLS_DIR)/$(GNUPLATFORM)-%) \
$(APP_TOOLS_DIR)/rumpbake \
$(APP_TOOLS_DIR)/rumprun-$(APP_TOOLS_PLATFORM)-specs-bake

.PHONY: app-tools
app-tools: $(_APP_TOOL_TARGETS)

APP_TOOLS_MAKE := $(APP_TOOLS_DIR)/rumprun-$(APP_TOOLS_PLATFORM)-make
APP_TOOLS_CC := $(APP_TOOLS_DIR)/rumprun-$(APP_TOOLS_PLATFORM)-cc
APP_TOOLS_MAKE := $(APP_TOOLS_DIR)/$(GNUPLATFORM)-make
APP_TOOLS_CC := $(APP_TOOLS_DIR)/$(GNUPLATFORM)-cc

define APPTOOLS_templ
$(APP_TOOLS_DIR)/${2}: \
$(APP_TOOLS_DIR)/${1} Makefile
sed <$$< >$$@.tmp \
-e 's#!CC!#$(CC)#g;' \
-e 's#!CXX!#$(CXX)#g;' \
-e 's#!GNUPLATFORM!#$(subst \
--,-rumprun-,${APP_TOOLS_GNUPLATFORM})#g;' \
-e 's#!GNUPLATFORM!#$(GNUPLATFORM)#g;' \
-e 's#!BASE_DIR!#$(abspath ../..)#g;' \
-e 's#!APPTOOLS_DIR!#$(APP_TOOLS_DIR)#g;' \
-e 's#!APPTOOLS_PLATFORM!#$(APP_TOOLS_PLATFORM)#g;' \
Expand All @@ -50,13 +54,16 @@ $(APP_TOOLS_DIR)/${2}: \
mv -f $$@.tmp $$@
endef
$(foreach tool,${APP_TOOL_FILES},$(eval \
$(call APPTOOLS_templ,${tool}.in,rumprun-$(APP_TOOLS_PLATFORM)-${tool})))
$(call APPTOOLS_templ,${tool}.in,$(GNUPLATFORM)-${tool})))
$(foreach spec,${APP_TOOL_SPECS},$(eval \
$(call APPTOOLS_templ,${spec}.in,${spec})))
$(eval $(call APPTOOLS_templ,rumpbake.in,rumpbake))
$(eval $(call APPTOOLS_templ,specs-bake.in,rumprun-$(APP_TOOLS_PLATFORM)-specs-bake))

define APPTOOLS_passthrough
uptool_$1=$(shell echo $1 | tr '[:lower:]' '[:upper:]')
toolval_$1=$${$${uptool_$1}}
$(APP_TOOLS_DIR)/rumprun-$(APP_TOOLS_PLATFORM)-$1:
$(APP_TOOLS_DIR)/$(GNUPLATFORM)-$1:
printf '#!/bin/sh\n\nexec %s "$$$${@}"\n' $${toolval_${1}} >$$@.tmp
chmod +x $$@.tmp
mv -f $$@.tmp $$@
Expand Down
6 changes: 3 additions & 3 deletions app-tools/cc.in
Expand Up @@ -68,22 +68,22 @@ done
case ${MODE} in
compile)
exec ${CC} ${CFLAGS} -no-integrated-cpp \
-specs=!APPTOOLS_DIR!/rumprun-!APPTOOLS_PLATFORM!-specs-compile_or_ferment \
-specs=!APPTOOLS_DIR!/specs-compile_or_ferment \
"$@" ${EXTRALIBS}
;;
ferment)
# Link the real (from user's PoV) output file as a relocatable object,
# with no rump components. '-u main' is necessary to pull in main if the
# user is linking it in from a library.
${CC} ${CFLAGS} -no-integrated-cpp \
-specs=!APPTOOLS_DIR!/rumprun-!APPTOOLS_PLATFORM!-specs-compile_or_ferment \
-specs=!APPTOOLS_DIR!/specs-compile_or_ferment \
-Wl,-r -Wl,-u,main \
-Wl,--defsym=__RuMpRuN_fermented__=0 \
"$@" ${EXTRALIBS} || die

# Try a stub link with minimal rump components. If that fails then stop.
${CC} ${CFLAGS} -no-integrated-cpp \
-specs=!APPTOOLS_DIR!/rumprun-!APPTOOLS_PLATFORM!-specs-stub \
-specs=!APPTOOLS_DIR!/specs-stub \
${OUTFILE} -o /dev/null
if [ $? -ne 0 ]; then
[ -f "${OUTFILE}" ] && rm -f ${OUTFILE}
Expand Down
4 changes: 2 additions & 2 deletions app-tools/configure.in
Expand Up @@ -3,7 +3,7 @@
set -e
prog=$1; shift

export CC=!APPTOOLS_DIR!/rumprun-!APPTOOLS_PLATFORM!-cc
export CXX=!APPTOOLS_DIR!/rumprun-!APPTOOLS_PLATFORM!-c++
export CC=!APPTOOLS_DIR!/!GNUPLATFORM!-cc
export CXX=!APPTOOLS_DIR!/!GNUPLATFORM!-c++

exec "$prog" --host=!GNUPLATFORM! "$@"
4 changes: 2 additions & 2 deletions app-tools/gmake.in
@@ -1,6 +1,6 @@
#!/bin/sh

export CC=!APPTOOLS_DIR!/rumprun-!APPTOOLS_PLATFORM!-cc
export CXX=!APPTOOLS_DIR!/rumprun-!APPTOOLS_PLATFORM!-c++
export CC=!APPTOOLS_DIR!/!GNUPLATFORM!-cc
export CXX=!APPTOOLS_DIR!/!GNUPLATFORM!-c++

exec gmake "$@"
4 changes: 2 additions & 2 deletions app-tools/make.in
@@ -1,6 +1,6 @@
#!/bin/sh

export CC=!APPTOOLS_DIR!/rumprun-!APPTOOLS_PLATFORM!-cc
export CXX=!APPTOOLS_DIR!/rumprun-!APPTOOLS_PLATFORM!-c++
export CC=!APPTOOLS_DIR!/!GNUPLATFORM!-cc
export CXX=!APPTOOLS_DIR!/!GNUPLATFORM!-c++

exec make "$@"
2 changes: 1 addition & 1 deletion app-tools/rumpbake.in
Expand Up @@ -132,7 +132,7 @@ for f in "$@"; do
echo "rumpbake: error: ${f}: not a rumprun relocatable object"
exit 1
fi
${APP_TOOLS_DIR}/${TOOLCHAIN}-objcopy \
${APP_TOOLS_DIR}/!GNUPLATFORM!-objcopy \
--redefine-sym main=rumpbake_main${objnum} \
${f} ${TMPDIR}/tmp${objnum}.obj
allobjs="${allobjs} ${TMPDIR}/tmp${objnum}.obj"
Expand Down
4 changes: 1 addition & 3 deletions tests/buildtests.sh
Expand Up @@ -17,11 +17,9 @@ PLATFORM=$1

case ${PLATFORM} in
hw)
TOOLS_PLATFORM=bmk
RUMPBAKE="rumpbake hw_generic"
;;
xen)
TOOLS_PLATFORM=xen
RUMPBAKE="rumpbake xen_pv"
;;
*)
Expand All @@ -33,7 +31,7 @@ shift
# XXX
export DOCXX=$(grep ^CONFIG_CXX ../platform/${PLATFORM}/config.mk)

export MAKE=${APPTOOLSDIR}/rumprun-${TOOLS_PLATFORM}-${MAKE-make}
export MAKE=${APPTOOLSDIR}/x86_64-rumprun-netbsd-${MAKE-make}

${MAKE} ${DOCXX} RUMPBAKE="${APPTOOLSDIR}/${RUMPBAKE}"

Expand Down

0 comments on commit 971d63d

Please sign in to comment.