From eafda88a2eac8bb89cb0c8a1f0e1cc44a8097ad2 Mon Sep 17 00:00:00 2001 From: Antti Kantee Date: Thu, 22 Oct 2015 12:21:27 +0000 Subject: [PATCH] Build libs into objdir. Well, the ones built by platform/Makefile.inc, at any rate. --- platform/Makefile.inc | 35 +++++++++++++++++------------------ platform/hw/Makefile | 4 ++-- platform/xen/Makefile | 4 ++-- tests/nolibc/Makefile | 2 +- 4 files changed, 22 insertions(+), 23 deletions(-) diff --git a/platform/Makefile.inc b/platform/Makefile.inc index 032eae6..da7b381 100644 --- a/platform/Makefile.inc +++ b/platform/Makefile.inc @@ -16,23 +16,26 @@ endif MAINOBJ:= ${RROBJ}/rumprun-${PLATFORM}-${MACHINE_ARCH}.o -COREDIR:= $(shell pwd)/../../lib/libbmk_core -RUMPUSERDIR:= $(shell pwd)/../../lib/libbmk_rumpuser -COMPILERRTDIR:= $(shell pwd)/../../lib/libcompiler_rt +RROBJLIB:= ${RROBJ}/lib +LIBDIR:= $(abspath ../../lib) COMMONDIR:= $(abspath ../) define BUILDLIB_target -.PHONY: ${1}/${PLATFORM}/${2} -${1}/${PLATFORM}/${2}: - ( cd ${1} \ - && ${RUMPMAKE} MAKEOBJDIR=${PLATFORM} ${3} obj \ - && ${RUMPMAKE} MAKEOBJDIR=${PLATFORM} ${3} dependall ) +.PHONY: $${RROBJLIB}/${1}/${1}.a +$${RROBJLIB}/${1}/${1}.a: + ( cd $${LIBDIR}/${1} \ + && ${RUMPMAKE} MAKEOBJDIR=${RROBJLIB}/${1} ${2} obj \ + && ${RUMPMAKE} MAKEOBJDIR=${RROBJLIB}/${1} ${2} dependall ) + +${1}_clean: + ( cd $${LIBDIR}/${1} && \ + ${RUMPMAKE} MAKEOBJDIR=${RROBJLIB}/${1} ${2} cleandir ) endef -$(eval $(call BUILDLIB_target,${COREDIR},libbmk_core.a)) -$(eval $(call BUILDLIB_target,${RUMPUSERDIR},libbmk_rumpuser.a)) -$(eval $(call BUILDLIB_target,${COMPILERRTDIR},libcompiler_rt.a,RUMPSRC=${RUMPSRC})) +$(eval $(call BUILDLIB_target,libbmk_core)) +$(eval $(call BUILDLIB_target,libbmk_rumpuser)) +$(eval $(call BUILDLIB_target,libcompiler_rt,RUMPSRC=${RUMPSRC})) PSEUDOSTUBS=${RROBJ}/rumprun-pseudolinkstubs @@ -44,8 +47,8 @@ bmk.ldscript: ${LDSCRIPT} commonlibs: platformlibs userlibs userlibs: ${PSEUDOSTUBS}.o -platformlibs: ${COREDIR}/${PLATFORM}/libbmk_core.a ${RUMPUSERDIR}/${PLATFORM}/libbmk_rumpuser.a bmk.ldscript -compiler_rt: ${COMPILERRTDIR}/${PLATFORM}/libcompiler_rt.a +platformlibs: ${RROBJLIB}/libbmk_core/libbmk_core.a ${RROBJLIB}/libbmk_rumpuser/libbmk_rumpuser.a bmk.ldscript +compiler_rt: ${RROBJLIB}/libcompiler_rt/libcompiler_rt.a .PHONY: buildtest buildtest: ../../tests/hello/hello.c @@ -61,11 +64,7 @@ buildtest: ../../tests/hello/hello.c @echo done .PHONY: commonclean -commonclean: - ( cd ${COREDIR} && ${RUMPMAKE} MAKEOBJDIR=${PLATFORM} cleandir ) - ( cd ${RUMPUSERDIR} && ${RUMPMAKE} MAKEOBJDIR=${PLATFORM} cleandir ) - ( cd ${COMPILERRTDIR} && \ - ${RUMPMAKE} RUMPSRC=${RUMPSRC} MAKEOBJDIR=${PLATFORM} cleandir ) +commonclean: libbmk_core_clean libbmk_rumpuser_clean libcompiler_rt_clean rm -f ${PSEUDOSTUBS}.c ${PSEUDOSTUBS}.o rm -f bmk.ldscript diff --git a/platform/hw/Makefile b/platform/hw/Makefile index f6d7ed3..56e7419 100644 --- a/platform/hw/Makefile +++ b/platform/hw/Makefile @@ -50,8 +50,8 @@ links: include/hw/machine ../../include/bmk-pcpu ${MAINOBJ}: ${OBJS_BMK} platformlibs ${CC} -nostdlib ${CFLAGS} -Wl,-r ${OBJS_BMK} -o $@ \ - -L${COREDIR}/hw -L${RUMPUSERDIR}/hw -Wl,--whole-archive \ - -lbmk_rumpuser -lbmk_core -Wl,--no-whole-archive + -L${RROBJLIB}/libbmk_core -L${RROBJLIB}/libbmk_rumpuser \ + -Wl,--whole-archive -lbmk_rumpuser -lbmk_core -Wl,--no-whole-archive ${OBJCOPY} -w -G bmk_* -G rumpuser_* -G jsmn_* \ -G rumprun_platform_rumpuser_init -G _start $@ diff --git a/platform/xen/Makefile b/platform/xen/Makefile index a12ee6b..291a8af 100644 --- a/platform/xen/Makefile +++ b/platform/xen/Makefile @@ -58,8 +58,8 @@ links: $(MAINOBJ): $(RUMP_OBJS) platformlibs $(CC) -Wl,-r $(CFLAGS) $(LDFLAGS) $(RUMP_OBJS) -nostdlib -o $@ \ - -L${COREDIR}/xen -L${RUMPUSERDIR}/xen -Wl,--whole-archive \ - -lbmk_rumpuser -lbmk_core -Wl,--no-whole-archive + -L${RROBJLIB}/libbmk_core -L${RROBJLIB}libbmk_rumpuser \ + -Wl,--whole-archive -lbmk_rumpuser -lbmk_core -Wl,--no-whole-archive .PHONY: clean arch_clean diff --git a/tests/nolibc/Makefile b/tests/nolibc/Makefile index 692e7c2..8d34f51 100644 --- a/tests/nolibc/Makefile +++ b/tests/nolibc/Makefile @@ -4,7 +4,7 @@ include ${BUILDRUMP_TOOLFLAGS} CFLAGS+= ${BUILDRUMP_TOOL_CFLAGS} LDFLAGS:= -L$(abspath ../../rumprun/lib) -LDFLAGS+= -L$(abspath ../../lib/libcompiler_rt/${PLATFORM}) +LDFLAGS+= -L${RROBJ}/lib/libcompiler_rt CPPFLAGS+= -I../../include -I../../rumprun/include -I../../platform/${PLATFORM}/include -- 2.39.5