Reduce verbosity of some make commands
authorGan Shun <ganshun@gmail.com>
Fri, 9 Jun 2017 20:32:18 +0000 (13:32 -0700)
committerBarret Rhoden <brho@cs.berkeley.edu>
Thu, 15 Jun 2017 22:32:25 +0000 (18:32 -0400)
Redirect the outputs of the toolchain build to
tools/compilers/gcc-glibc/build_logs and the outputs of make
apps-install and apps-clean to $AKAROS_ROOT/build_logs

This change also fixes a bug in unsetting multiline environment
variables.

Signed-off-by: Gan Shun <ganshun@gmail.com>
Change-Id: Iac496c3e01853e6e97f31345a86256ce7b2c1284
[for apps-targets, changed 'info' -> 'echo']
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
.gitignore
Makefile
tools/compilers/gcc-glibc/Makefile

index 4061842..bd10255 100644 (file)
@@ -46,3 +46,4 @@ TAGS
 cscope.*
 *~
 #*
+*.log
index f7c7861..57e79e7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -59,7 +59,7 @@ NO_PRINT_DIRECTORY ?= --no-print-directory
 export_parent_env := $(shell export | sed 's/$$/;/')
 
 # Save the ability to clear the current environment for future use
-clear_current_env := for c in $$(env | cut -d '=' -f 1); do unset $$c; done;
+clear_current_env := for c in $$(awk 'BEGIN{for (v in ENVIRON){print v}}'); do unset $$c; done;
 
 define export_user_variables
        CROSS_COMPILE="$(CROSS_COMPILE)"\
@@ -209,7 +209,7 @@ export CONFIG_SHELL HOSTCC HOSTCXX HOSTCFLAGS HOSTCXXFLAGS
 #         cmd_cc_o_c       = $(CC) $(c_flags) -c -o $@ $<
 #
 # If $(quiet) is empty, the whole command will be printed.
-# If it is set to "quiet_", only the short version will be printed. 
+# If it is set to "quiet_", only the short version will be printed.
 # If it is set to "silent_", nothing will be printed at all, since
 # the variable $(silent_cmd_cc_o_c) doesn't exist.
 #
@@ -333,10 +333,10 @@ endif # $(dot-config)
 AKAROSINCLUDE   := -I$(srctree)/kern/include/
 
 # CROSS_COMPILE is defined per-arch.  Each arch can set other makeflags, kbuild
-# directories, etc. 
+# directories, etc.
 -include $(srctree)/kern/arch/$(ARCH)/Makefile
 
-CC         := $(CROSS_COMPILE)gcc 
+CC         := $(CROSS_COMPILE)gcc
 CPP        := $(CROSS_COMPILE)g++
 AS         := $(CROSS_COMPILE)as
 AR         := $(CROSS_COMPILE)ar
@@ -364,7 +364,7 @@ CFLAGS_KERNEL += -std=gnu99 -fgnu89-inline
 CFLAGS_KERNEL += -fno-strict-aliasing -fno-omit-frame-pointer
 CFLAGS_KERNEL += -fno-stack-protector
 CFLAGS_KERNEL += -Wall -Wno-format -Wno-unused -Werror -Wreturn-type
-CFLAGS_KERNEL += -DROS_KERNEL 
+CFLAGS_KERNEL += -DROS_KERNEL
 CFLAGS_KERNEL += -include include/generated/autoconf.h -include include/common.h
 CFLAGS_KERNEL += -fplan9-extensions
 ifeq ($(CONFIG_64BIT),y)
@@ -433,7 +433,7 @@ $(srctree)/Makelocal: ;
 # Akaros Kernel Build
 # =========================================================================
 # Add top level directories, either to an existing entry (core-y) or to its
-# own. 
+# own.
 #
 # From these, we determine deps and dirs.  We recursively make through the
 # dirs, generating built-in.o at each step, which are the deps from which we
@@ -540,7 +540,7 @@ $(ext2_bdev_obj): $(ext2-bdev)
 # Not the worlds most elegant link command.  link-kernel takes the obj output
 # name, then the linker script, then everything else you'd dump on the ld
 # command line, including linker options and objects to link together.
-# 
+#
 # After the script is done, we run the arch-specific command directly.
 quiet_cmd_link-akaros = LINK    $@
       cmd_link-akaros = $(CONFIG_SHELL) scripts/link-kernel.sh $@ \
@@ -662,7 +662,7 @@ fill-kfs: $(OBJDIR)/.dont-force-fill-kfs user tests
 
 # Use doxygen to make documentation for ROS (Untested since 2010 or so)
 doxygen-dir := $(CUR_DIR)/Documentation/doxygen
-docs: 
+docs:
        @echo "  Making doxygen"
        @doxygen-dir=$(doxygen-dir) doxygen $(doxygen-dir)/rosdoc.cfg
        @if [ ! -d $(doxygen-dir)/rosdoc/html/img ]; \
@@ -698,19 +698,31 @@ $(app-dirs-clean):
 
 PHONY +=  apps-install
 apps-install: $(app-dirs-install)
-       @$(call make_as_parent, -C tools/apps/busybox)
-       @$(call make_as_parent, -C tools/apps/ipconfig install)
-       @$(call make_as_parent, -C tools/dev-libs/elfutils install)
-       @$(call make_as_parent, -C tools/dev-util/perf install)
-       @$(call make_as_parent, -C tools/sys-apps/bash install)
+       @$(shell mkdir -p $(AKAROS_ROOT)/build_logs)
+       @$(call make_as_parent, -C tools/apps/busybox) > build_logs/busybox_install.log 2>&1
+       @echo busybox install succeeded.
+       @$(call make_as_parent, -C tools/apps/ipconfig install) > build_logs/ipconfig_install.log 2>&1
+       @echo ipconfig install succeeded.
+       @$(call make_as_parent, -C tools/dev-libs/elfutils install) > build_logs/elfutils_install.log 2>&1
+       @echo elfutils install succeeded.
+       @$(call make_as_parent, -C tools/dev-util/perf install) > build_logs/perf_install.log 2>&1
+       @echo perf install succeeded.
+       @$(call make_as_parent, -C tools/sys-apps/bash install) > build_logs/bash_install.log 2>&1
+       @echo bash install succeeded.
 
 PHONY += apps-clean
 apps-clean: $(app-dirs-clean)
-       @$(call make_as_parent, -C tools/apps/busybox clean)
-       @$(call make_as_parent, -C tools/apps/ipconfig clean)
-       @$(call make_as_parent, -C tools/dev-libs/elfutils clean)
-       @$(call make_as_parent, -C tools/dev-util/perf clean)
-       @$(call make_as_parent, -C tools/sys-apps/bash clean)
+       @$(shell mkdir -p $(AKAROS_ROOT)/build_logs)
+       @$(call make_as_parent, -C tools/apps/busybox clean) > build_logs/busybox_clean.log 2>&1
+       @echo busybox clean succeeded.
+       @$(call make_as_parent, -C tools/apps/ipconfig clean) > build_logs/ipconfig_clean.log 2>&1
+       @echo ipconfig clean succeeded.
+       @$(call make_as_parent, -C tools/dev-libs/elfutils clean) > build_logs/elfutils_clean.log 2>&1
+       @echo elfutils clean succeeded.
+       @$(call make_as_parent, -C tools/dev-util/perf clean) > build_logs/perf_clean.log 2>&1
+       @echo perf clean succeeded.
+       @$(call make_as_parent, -C tools/sys-apps/bash clean) > build_logs/bash_clean.log 2>&1
+       @echo bash clean succeeded.
 
 # Cross Compiler
 # =========================================================================
index dffba65..c84fbec 100644 (file)
@@ -105,7 +105,7 @@ endif
 ifeq ($(ARCH),riscv)
     AKAROS_ARCH_DIR := riscv
     ARCH_CFLAGS :=
-    GLIBC_CONFIGURE_FLAGS := 
+    GLIBC_CONFIGURE_FLAGS :=
     GCC_BUILD_FLAGS :=
 endif
 ifeq ($(CONFIG),cross)
@@ -168,7 +168,7 @@ define BUILD_ERROR
     for this variable in there.
 endef
 BUILD_ERRORS := $(call add_error, $(BUILD_ERROR))
-endif 
+endif
 
 ifeq ($(CONFIG),native)
 ifeq ($(shell which $(ARCH)-ucb-akaros-gcc 2>/dev/null),)
@@ -234,25 +234,32 @@ unexport LD_LIBRARY_PATH
 check-env-real:
        @echo "    Your environment checks out. Build away!"
 
+define make_and_log
+       $(MAKE) $(1) > build_logs/$(2).log 2>&1
+       @echo "make $(2) succeeded"
+endef
+
 ifeq ($(CONFIG),cross)
 build-real:
-       $(MAKE) .$(BINARY_PREFIX)binutils-install
-       $(MAKE) .$(BINARY_PREFIX)gcc-stage1-install
-       $(MAKE) .$(BINARY_PREFIX)headers-clean
-       $(MAKE) .$(BINARY_PREFIX)akaros-headers-install
-       $(MAKE) .$(BINARY_PREFIX)dummy-libs-install
-       $(MAKE) .$(BINARY_PREFIX)glibc-stage1-install
-       $(MAKE) .$(BINARY_PREFIX)gcc-stage2-install
-       $(MAKE) .$(BINARY_PREFIX)glibc-stage2-install
-       $(MAKE) .$(BINARY_PREFIX)akaros-libs-install
-       $(MAKE) .$(BINARY_PREFIX)gcc-stage3-install
-       $(MAKE) .$(BINARY_PREFIX)gmp-install
-       $(MAKE) .$(BINARY_PREFIX)mpfr-install
-       $(MAKE) .$(BINARY_PREFIX)mpc-install
+       $(shell mkdir -p build_logs)
+       $(call make_and_log,.$(BINARY_PREFIX)binutils-install,$(BINARY_PREFIX)binutils-install)
+       $(call make_and_log,.$(BINARY_PREFIX)gcc-stage1-install,$(BINARY_PREFIX)gcc-stage1-install)
+       $(call make_and_log,.$(BINARY_PREFIX)headers-clean,$(BINARY_PREFIX)headers-clean)
+       $(call make_and_log,.$(BINARY_PREFIX)akaros-headers-install,$(BINARY_PREFIX)akaros-headers-install)
+       $(call make_and_log,.$(BINARY_PREFIX)dummy-libs-install,$(BINARY_PREFIX)dummy-libs-install)
+       $(call make_and_log,.$(BINARY_PREFIX)glibc-stage1-install,$(BINARY_PREFIX)glibc-stage1-install)
+       $(call make_and_log,.$(BINARY_PREFIX)gcc-stage2-install,$(BINARY_PREFIX)gcc-stage2-install)
+       $(call make_and_log,.$(BINARY_PREFIX)glibc-stage2-install,$(BINARY_PREFIX)glibc-stage2-install)
+       $(call make_and_log,.$(BINARY_PREFIX)akaros-libs-install,$(BINARY_PREFIX)akaros-libs-install)
+       $(call make_and_log,.$(BINARY_PREFIX)gcc-stage3-install,$(BINARY_PREFIX)gcc-stage3-install)
+       $(call make_and_log,.$(BINARY_PREFIX)gmp-install,$(BINARY_PREFIX)gmp-install)
+       $(call make_and_log,.$(BINARY_PREFIX)mpfr-install,$(BINARY_PREFIX)mpfr-install)
+       $(call make_and_log,.$(BINARY_PREFIX)mpc-install,$(BINARY_PREFIX)mpc-install)
 else
 build-real:
-       $(MAKE) .$(BINARY_PREFIX)binutils-install
-       $(MAKE) .$(BINARY_PREFIX)gcc-stage3-install
+       $(shell mkdir -p build_logs)
+       $(call make_and_log,.$(BINARY_PREFIX)binutils-install,$(BINARY_PREFIX)binutils-install)
+       $(call make_and_log,.$(BINARY_PREFIX)gcc-stage3-install,$(BINARY_PREFIX)gcc-stage3-install)
 endif
 
 uninstall-real:
@@ -317,8 +324,8 @@ cross-binutils-configure:
                --disable-nls \
                --with-sysroot=$(SYSROOT)
 
-.$(BINARY_PREFIX)binutils-configure: 
-       $(MAKE) $(BINARY_PREFIX)binutils-builddir 
+.$(BINARY_PREFIX)binutils-configure:
+       $(MAKE) $(BINARY_PREFIX)binutils-builddir
        if [ "$(CONFIG)" = "native" ]; then \
                $(MAKE) native-binutils-configure; \
        else \
@@ -370,7 +377,7 @@ $(BINARY_PREFIX)gcc-stage1-builddir: gcc-$(GCC_VERSION)
        rm -rf $@
        mkdir -p $@
 
-.$(BINARY_PREFIX)gcc-stage1-configure: 
+.$(BINARY_PREFIX)gcc-stage1-configure:
        $(MAKE) $(BINARY_PREFIX)gcc-stage1-builddir
        cd $(BINARY_PREFIX)gcc-stage1-builddir; \
        CFLAGS="-O2 -g -pipe" \
@@ -418,7 +425,7 @@ $(BINARY_PREFIX)gcc-stage2-builddir: gcc-$(GCC_VERSION)
        rm -rf $@
        mkdir -p $@
 
-.$(BINARY_PREFIX)gcc-stage2-configure: 
+.$(BINARY_PREFIX)gcc-stage2-configure:
        $(MAKE) $(BINARY_PREFIX)gcc-stage2-builddir
        cd $(BINARY_PREFIX)gcc-stage2-builddir; \
        CFLAGS="-O2 -g -pipe" \
@@ -515,7 +522,7 @@ $(BINARY_PREFIX)glibc-stage1-builddir: glibc-$(GLIBC_VERSION)
        rm -rf $@
        mkdir -p $@
 
-.$(BINARY_PREFIX)glibc-stage1-configure: 
+.$(BINARY_PREFIX)glibc-stage1-configure:
        $(MAKE) $(BINARY_PREFIX)glibc-stage1-builddir;
        cd $(BINARY_PREFIX)glibc-stage1-builddir; \
        CFLAGS="$(ARCH_CFLAGS) -U_FORTIFY_SOURCE -g -O2 -pipe" \
@@ -567,7 +574,7 @@ $(BINARY_PREFIX)glibc-stage2-builddir: glibc-$(GLIBC_VERSION)
        rm -rf $@
        mkdir -p $@
 
-.$(BINARY_PREFIX)glibc-stage2-configure: 
+.$(BINARY_PREFIX)glibc-stage2-configure:
        $(MAKE) $(BINARY_PREFIX)glibc-stage2-builddir
        cd $(BINARY_PREFIX)glibc-stage2-builddir; \
        CFLAGS="$(ARCH_CFLAGS) -U_FORTIFY_SOURCE -g -O2 -pipe" \