From 265175be7a7b872138b073012652f3dda3efe9b3 Mon Sep 17 00:00:00 2001 From: Antti Kantee Date: Thu, 15 Oct 2015 22:41:09 +0000 Subject: [PATCH] Give app-tools its own Makefile instead of it being a .inc This means that app-tools are now built directly by build-rr.sh instead of being driven by platform/x/Makefile. --- app-tools/{Makefile.app-tools => Makefile} | 29 ++++++++++++---------- build-rr.sh | 1 + platform/Makefile.inc | 4 +-- platform/hw/Makefile | 9 ++----- platform/xen/Makefile | 11 +++----- 5 files changed, 24 insertions(+), 30 deletions(-) rename app-tools/{Makefile.app-tools => Makefile} (86%) diff --git a/app-tools/Makefile.app-tools b/app-tools/Makefile similarity index 86% rename from app-tools/Makefile.app-tools rename to app-tools/Makefile index 0e3fa43..e0c1705 100644 --- a/app-tools/Makefile.app-tools +++ b/app-tools/Makefile @@ -1,14 +1,14 @@ -_APPTOOLS_PARAMS= APP_TOOLS_PLATFORM APP_TOOLS_DIR - -define varchk_tmpl -ifeq ($${$1},) - _APPTOOLS_MISSING=$1 +ifeq ($(CONFIG),) +$(error CONFIG missing) endif -endef -$(foreach var,${_APPTOOLS_PARAMS},$(eval $(call varchk_tmpl,${var}))) -ifdef _APPTOOLS_MISSING -$(error ${_APPTOOLS_MISSING} not defined) + +include ${CONFIG} +ifeq (${BUILDRUMP_TOOLFLAGS},) +$(error invalid config file ${CONFIG}) endif +include ${BUILDRUMP_TOOLFLAGS} + +APP_TOOLS_DIR:= $(abspath .) APP_TOOL_FILES= configure make gmake toolchain.cmake recipe.s APP_TOOL_COMPILERS= cc c++ @@ -24,13 +24,16 @@ MACHINE_ARCH:= $(shell ${RUMPMAKE} -f bsd.own.mk -V '$${MACHINE_ARCH}') _CCVARIANT:=$(shell ${RUMPMAKE} -f bsd.own.mk -V '$${HAVE_LLVM:Dclang:Ugcc}') _CXXVARIANT:=$(shell ${RUMPMAKE} -f bsd.own.mk -V '$${HAVE_LLVM:Dclang++:Ug++}') +include ../global.mk +LDFLAGS_BAKE:= ${LDFLAGS.${PLATFORM}.${MACHINE_ARCH}} + _APP_TOOL_TARGETS:= \ $(APP_TOOL_FILES:%=$(APP_TOOLS_DIR)/$(GNUPLATFORM)-%) \ $(APP_TOOLS_DIR)/$(GNUPLATFORM)-$(_CCVARIANT) \ $(APP_TOOLS_DIR)/$(GNUPLATFORM)-$(_CXXVARIANT) \ $(APP_TOOL_SPECS:%=$(APP_TOOLS_DIR)/%) \ $(APP_TOOL_PASSTHROUGH:%=$(APP_TOOLS_DIR)/$(GNUPLATFORM)-%) \ - $(APP_TOOLS_DIR)/specs-bake-$(GNUPLATFORM)-$(APP_TOOLS_PLATFORM) + $(APP_TOOLS_DIR)/specs-bake-$(GNUPLATFORM)-$(PLATFORM) .PHONY: app-tools app-tools: $(_APP_TOOL_TARGETS) @@ -51,7 +54,7 @@ $(APP_TOOLS_DIR)/${2}: \ -e 's#!GNUPLATFORM!#$(GNUPLATFORM)#g;' \ -e 's#!DESTDIR!#$(DESTDIR)#g;' \ -e 's#!APPTOOLS_DIR!#$(APP_TOOLS_DIR)#g;' \ - -e 's#!APPTOOLS_PLATFORM!#$(APP_TOOLS_PLATFORM)#g;' \ + -e 's#!APPTOOLS_PLATFORM!#$(PLATFORM)#g;' \ -e 's#!CPPFLAGS!#$(BUILDRUMP_TOOL_CPPFLAGS)#g;' \ -e 's#!CFLAGS!#$(BUILDRUMP_TOOL_CFLAGS)#g;' \ -e 's#!CXXFLAGS!#$(BUILDRUMP_TOOL_CXXFLAGS)#g;' \ @@ -65,7 +68,7 @@ $(foreach spec,${APP_TOOL_SPECS},$(eval \ $(call APPTOOLS_templ,${spec}.in,${spec}))) $(eval $(call APPTOOLS_templ,cc.in,$(GNUPLATFORM)-${_CCVARIANT})) $(eval $(call APPTOOLS_templ,cc.in,$(GNUPLATFORM)-${_CXXVARIANT})) -$(eval $(call APPTOOLS_templ,specs-bake.in,specs-bake-$(GNUPLATFORM)-$(APP_TOOLS_PLATFORM))) +$(eval $(call APPTOOLS_templ,specs-bake.in,specs-bake-$(GNUPLATFORM)-$(PLATFORM))) define APPTOOLS_passthrough uptool_$1=$(shell echo $1 | tr '[:lower:]' '[:upper:]') @@ -77,5 +80,5 @@ $(APP_TOOLS_DIR)/$(GNUPLATFORM)-$1: endef $(foreach t,${APP_TOOL_PASSTHROUGH},$(eval $(call APPTOOLS_passthrough,${t}))) -app-tools_clean: +clean: rm -f $(_APP_TOOL_TARGETS) diff --git a/build-rr.sh b/build-rr.sh index 92b4e39..0829257 100755 --- a/build-rr.sh +++ b/build-rr.sh @@ -315,6 +315,7 @@ EOF builduserspace () { + ${MAKE} -C app-tools CONFIG=$(pwd)/${PLATFORMDIR}/config.mk usermtree ${STAGING} diff --git a/platform/Makefile.inc b/platform/Makefile.inc index 45bfd3d..355fd02 100644 --- a/platform/Makefile.inc +++ b/platform/Makefile.inc @@ -34,7 +34,7 @@ platformlibs: ${COREDIR}/${PLATFORM}/libbmk_core.a ${RUMPUSERDIR}/${PLATFORM}/li compiler_rt: ${COMPILERRTDIR}/${PLATFORM}/libcompiler_rt.a .PHONY: buildtest -buildtest: ../../tests/hello/hello.c ${MAINOBJ} commonlibs app-tools +buildtest: ../../tests/hello/hello.c ${MAINOBJ} commonlibs ${APP_TOOLS_CC} -g -o $@ $< -lrumprun_tester @echo Testing baking ... @export RUMPRUN_WARNING_STFU=please ; for board in \ @@ -57,7 +57,7 @@ commonclean: rm -f bmk.ldscript .PHONY: tests -tests: ${MAINOBJ} commonlibs app-tools +tests: ${MAINOBJ} commonlibs ../../tests/buildtests.sh ${PLATFORM} ../../tests/runtests.sh ${PLATFORM_DEFAULT_TESTER} diff --git a/platform/hw/Makefile b/platform/hw/Makefile index cd20667..164f424 100644 --- a/platform/hw/Makefile +++ b/platform/hw/Makefile @@ -8,7 +8,7 @@ include ${BUILDRUMP_TOOLFLAGS} endif ifneq (${KERNONLY},true) -TARGETS:= app-tools userlibs +TARGETS:= userlibs else TARGETS:= compiler_rt endif @@ -57,11 +57,6 @@ include arch/${ARCHDIR}/Makefile.inc .PHONY: clean cleandir test -APP_TOOLS_PLATFORM= hw -APP_TOOLS_DIR:= $(abspath ../../app-tools) - -include ${APP_TOOLS_DIR}/Makefile.app-tools - include/hw/machine: @ln -sf ../arch/${MACHINE_ARCH} include/hw/machine @@ -77,7 +72,7 @@ ${MAINOBJ}: ${OBJS_BMK} platformlibs ${OBJCOPY} -w -G bmk_* -G rumpuser_* -G jsmn_* \ -G rumprun_platform_rumpuser_init -G _start $@ -clean: app-tools_clean commonclean +clean: commonclean rm -f ${OBJS_BMK} include/hw/machine buildtest ${MAINOBJ} cleandir: clean diff --git a/platform/xen/Makefile b/platform/xen/Makefile index b998b49..90aaace 100644 --- a/platform/xen/Makefile +++ b/platform/xen/Makefile @@ -20,7 +20,7 @@ OBJ_DIR ?= $(CURDIR)/obj TARGETS= prepare links mini-os $(MAINOBJ) ifneq (${KERNONLY},true) -TARGETS+= app-tools userlibs +TARGETS+= userlibs else TARGETS+= compiler_rt endif @@ -78,14 +78,9 @@ $(MAINOBJ): $(RUMP_OBJS) platformlibs -L${COREDIR}/xen -L${RUMPUSERDIR}/xen -Wl,--whole-archive \ -lbmk_rumpuser -lbmk_core -Wl,--no-whole-archive -APP_TOOLS_PLATFORM= xen -APP_TOOLS_DIR= $(abspath ../../app-tools) +.PHONY: clean arch_clean -include $(APP_TOOLS_DIR)/Makefile.app-tools - -.PHONY: clean arch_clean app-tools_clean - -clean: app-tools_clean commonclean +clean: commonclean $(MAKE) -C xen OBJ_DIR=$(OBJ_DIR)/xen clean rm -f $(OBJ_DIR)/*.o $(OBJ_DIR)/lib/*.o buildtest $(MAINOBJ) -- 2.39.5