• Home
  • Raw
  • Download

Lines Matching +full:- +full:- +full:quiet

2 # Use of this source code is governed by a BSD-style license that can be
10 # https://chromium.googlesource.com/chromiumos/platform2/+/master/common-mk
22 # 2. In your top-level Makefile, place "include common.mk" at the top
32 # - cc_binary, cxx_binary provide standard compilation steps for binaries
33 # - cxx_library, cc_library provide standard compilation steps for
36 # - update_archive creates/updates a given .a target
39 # - CXX_BINARY, CC_BINARY, CC_STATIC_BINARY, CXX_STATIC_BINARY
40 # - CXX_LIBRARY, CC_LIBRARY, CC_STATIC_LIBRARY, CXX_STATIC_LIBRARY
41 # - E.g., CXX_BINARY(mahbinary): foo.o
42 # - object.depends targets may be used when a prerequisite is required for an
46 # - TEST(binary) or TEST(CXX_BINARY(binary)) may be used as a prerequisite
48 # - CLEAN(file_or_dir) dependency can be added to 'clean'.
53 # - For C source files
55 # - For C++ source files
59 # - all - Your desired targets should be given
60 # - tests - Any TEST(test_binary) targets should be given
61 # - FORCE - force the given target to run regardless of changes
65 # - COLOR=[0|1] to set ANSI color output (default: 1)
66 # - VERBOSE=[0|1] to hide/show commands (default: 0)
67 # - MODE=[opt|dbg|profiling] (default: opt)
68 # opt - Enable optimizations for release builds
69 # dbg - Turn down optimization for debugging
70 # profiling - Turn off optimization and turn on profiling/coverage
72 # - ARCH=[x86|arm|supported qemu name] (default: from portage or uname -m)
73 # - SPLITDEBUG=[0|1] splits debug info in target.debug (default: 0)
75 # - NOSTRIP=[0|1] determines if binaries are stripped. (default: 1)
76 # NOSTRIP=0 and MODE=opt will also drop -g from the CFLAGS.
77 # - VALGRIND=[0|1] runs tests under valgrind (default: 0)
78 # - OUT=/path/to/builddir puts all output in given path (default: $PWD)
79 # - VALGRIND_ARGS="" supplies extra memcheck arguments
81 # Per-target(-ish) variable:
82 # - NEEDS_ROOT=[0|1] allows a TEST() target to run with root.
84 # - NEEDS_MOUNTS=[0|1] allows a TEST() target running on QEmu to get
88 # - Directories or files with spaces in them DO NOT get along with GNU Make.
91 # - External CXXFLAGS and CFLAGS should be passed via the environment since
93 # - Our version of GNU Make doesn't seem to support the 'private' variable
104 ARCH ?= $(shell uname -m)
108 # make -C $SRCDIR # will create ./build-$(MODE)
110 # make -C $SRCDIR OUT=$PWD
111 # This variable is extended on subdir calls and doesn't need to be re-called.
115 $(shell mkdir -p "$(OUT)")
118 # Ensure a command-line supplied OUT has a slash
125 # Re-start in the $(OUT) directory if we're not there.
126 # We may be invoked using -C or bare and we need to ensure behavior
149 QUIET = @
151 QUIET=
166 $(MAKE) -r -I "$(SRC)" -f "$(CURDIR)/Makefile" \
169 pass-to-subcall := 1
172 ifeq ($(pass-to-subcall),)
175 MODULES_LIST := $(filter-out Makefile %.d,$(MAKEFILE_LIST))
176 ifeq ($(words $(filter-out Makefile common.mk %.d $(SRC)/Makefile \
179 # All the top-level defines outside of module.mk.
187 $(if $(wildcard $(dir $1)),$2,$(QUIET)mkdir -p "$(dir $1)")
194 $(QUIET)# Create the archive in one step to avoid parallel use accessing it
195 $(QUIET)# before all the symbols are present.
198 -> $(subst $(SRC)/,,$(TARGET_OR_MEMBER))"
199 $(QUIET)$(AR) rcs $(TARGET_OR_MEMBER) \
203 # Default compile from objects using pre-requisites but filters out
213 # Default compile from objects using pre-requisites but filters out
226 $(QUIET)($(ECHO) -n '$(COLOR_RED)CLEANFILE$(COLOR_RESET) ' && \
233 $(QUIET)# $(1) not empty [$(wildcard $(1)/*)]. Not deleting.,
234 $(QUIET)($(ECHO) -n '$(COLOR_RED)CLEANDIR$(COLOR_RESET) ' && \
254 $(eval $(call override_var,PKG_CONFIG,pkg-config))
259 ECHO = /bin/echo -e
278 $($(2)) $($(4)) -x $(3) $(LDFLAGS) $(5) - $(6) -o /dev/null > /dev/null 2>&1 \
302 SSP_CFLAGS := $(call check_cc,-fstack-protector-strong)
304 SSP_CFLAGS := $(call check_cc,-fstack-protector-all)
308 # CXXFLAGS += -mahflag # Append to the list
309 # CXXFLAGS := -mahflag $(CXXFLAGS) # Prepend to the list
310 # CXXFLAGS := $(filter-out badflag,$(CXXFLAGS)) # Filter out a value
312 COMMON_CFLAGS-gcc := -fvisibility=internal -ggdb3 -Wa,--noexecstack
313 COMMON_CFLAGS-clang := -fvisibility=hidden -ggdb
314 COMMON_CFLAGS := -Wall -Werror -fno-strict-aliasing $(SSP_CFLAGS) -O1 -Wformat=2
315 CXXFLAGS += $(COMMON_CFLAGS) $(COMMON_CFLAGS-$(CXXDRIVER))
316 CFLAGS += $(COMMON_CFLAGS) $(COMMON_CFLAGS-$(CDRIVER))
317 CPPFLAGS += -D_FORTIFY_SOURCE=2
321 CXXFLAGS := $(CXXFLAGS) -fno-exceptions -fno-unwind-tables \
322 -fno-asynchronous-unwind-tables
327 CFLAGS := $(filter-out -O1,$(CFLAGS)) -O2
328 CXXFLAGS := $(filter-out -O1,$(CXXFLAGS)) -O2
329 # Only drop -g* if symbols aren't desired.
331 # TODO: do we want -fomit-frame-pointer on x86?
332 CFLAGS := $(filter-out -ggdb3,$(CFLAGS))
333 CXXFLAGS := $(filter-out -ggdb3,$(CXXFLAGS))
338 CFLAGS := $(CFLAGS) -O0 -g --coverage
339 CXXFLAGS := $(CXXFLAGS) -O0 -g --coverage
340 LDFLAGS := $(LDFLAGS) --coverage
343 LDFLAGS := $(LDFLAGS) -Wl,-z,relro -Wl,-z,noexecstack -Wl,-z,now
354 QUIET = @
356 QUIET=
363 # Useful for dealing with pie-broken toolchains.
365 OBJ_PIE_FLAG = -fPIE
366 COMPILE_PIE_FLAG = -pie
378 # Default compile from objects using pre-requisites but filters out
379 # all non-.o files.
383 $(QUIET)$($(1)) $(COMPILE_PIE_FLAGS) -o $(TARGET_OR_MEMBER) \
386 $(foreach so,$(filter %.so,$^),-L$(dir $(so)) \
387 -l$(patsubst lib%,%,$(basename $(notdir $(so))))) \
390 @$(ECHO) -n "BIN "
392 @$(ECHO) " $(COLOR_YELLOW)-----$(COLOR_RESET)"
399 # Then add -Wl,-soname,$@.$(PV) ?
401 # Default compile from objects using pre-requisites but filters out
402 # all non-.o values. (Remember to add -L$(OUT) -llib)
407 $(QUIET)$($(1)) -shared -Wl,-E -o $(TARGET_OR_MEMBER) \
409 $(if $(filter %.a,$^),-Wl$(COMMA)--whole-archive,) \
411 $(foreach a,$(filter %.a,$^),-L$(dir $(a)) \
412 -l$(patsubst lib%,%,$(basename $(notdir $(a))))) \
413 $(foreach so,$(filter %.so,$^),-L$(dir $(so)) \
414 -l$(patsubst lib%,%,$(basename $(notdir $(so))))) \
417 @$(ECHO) -n "LIB $(COLOR_GREEN)"
419 @$(ECHO) " $(COLOR_YELLOW)-----$(COLOR_RESET)"
428 $(if $(filter 1,$(SPLITDEBUG)), @$(ECHO) -n "DEBUG "; \
432 $(QUIET)$(OBJCOPY) --only-keep-debug "$(TARGET_OR_MEMBER)" \
434 $(if $(filter-out dbg,$(MODE)),$(QUIET)$(STRIP) --strip-unneeded \
451 $(if $(shell find $^ -cnewer "$%" 2>/dev/null),$(1))
472 $(call old_or_no_timestamp,$(call cxx_binary,-static))
477 $(call old_or_no_timestamp,$(call cc_binary,-static))
525 $(QUIET)# CLEAN($%) meta-target called
526 $(if $(filter-out $(PWD)/,$(dir $(abspath $(TARGET_OR_MEMBER)))), \
528 $(QUIET)# Not deleting $(dir $(abspath $(TARGET_OR_MEMBER))) yet.)
532 # Top-level objects and pattern rules
542 # Note, the catch-all pattern rules don't work in subdirectories because
543 # we're building from the $(OUT) directory. At the top-level (here) they will
551 # not match without further magic on a per-subdirectory basis.
568 $$(basename $$@),$$($(4)) $$(CPPFLAGS) -fPIC)
573 $$(QUIET)touch "$$@"
577 $$(QUIET)touch "$$@"
581 @$(ECHO) "$(1) $(subst $(SRC)/,,$<) -> $(2).o"
583 $(QUIET)$($(1)) -c -MD -MF $(2).d $(3) -o $(2).o $<
584 $(QUIET)# Wrap all the deps in $$(wildcard) so a missing header
585 $(QUIET)# won't cause weirdness. First we remove newlines and \,
586 $(QUIET)# then wrap it.
587 $(QUIET)sed -i -e :j -e '$$!N;s|\\\s*\n| |;tj' \
588 -e 's|^\(.*\s*:\s*\)\(.*\)$$|\1 $$\(wildcard \2\)|' $(2).d
596 # These may already be handled by '-r', but let's keep it to be safe.
612 HOST_ARCH ?= $(shell uname -m)
616 # if uname -m runs and you get x86_64, then this subst
619 QEMU_ARCH := $(subst x86,i386,$(ARCH)) # x86 -> i386
621 QEMU_ARCH := $(subst amd64,x86_64,$(ARCH)) # amd64 -> x86_64
627 # If we're cross-compiling, try to use qemu for running the tests.
630 $(info SYSROOT not defined. qemu-based testing disabled)
635 # Allow 64-bit hosts to run 32-bit without qemu.
655 # Default to / when all the empty-sysroot logic is done.
659 QEMU_NAME = qemu-$(QEMU_ARCH)
666 …f\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/build/bin/qemu-arm:"
676 $(info - OUT=$(OUT))
677 $(info - SRC=$(SRC))
678 $(info - MODE=$(MODE))
679 $(info - SPLITDEBUG=$(SPLITDEBUG))
680 $(info - NOSTRIP=$(NOSTRIP))
681 $(info - VALGRIND=$(VALGRIND))
682 $(info - COLOR=$(COLOR))
683 $(info - CXXEXCEPTIONS=$(CXXEXCEPTIONS))
684 $(info - ARCH=$(ARCH))
685 $(info - QEMU_ARCH=$(QEMU_ARCH))
686 $(info - USE_QEMU=$(USE_QEMU))
687 $(info - NEEDS_ROOT=$(NEEDS_ROOT))
688 $(info - NEEDS_MOUNTS=$(NEEDS_MOUNTS))
689 $(info - SYSROOT=$(SYSROOT))
699 $(QUIET)(test -z "$^" && \
701 $(QUIET)test -n "$^"
709 $(QUIET)FILES=""; \
710 for GCNO in `find . -name "*.gcno"`; do \
712 if [ -e $${GCDA} ]; then \
716 if [ -n "$${FILES}" ]; then \
717 gcov -l $${FILES}; \
718 lcov --capture --directory . \
719 --output-file=lcov-coverage.info; \
720 genhtml lcov-coverage.info \
721 --output-directory lcov-html; \
729 $(QUIET)$(ECHO) "QEMU Preparing $(QEMU_NAME)"
735 $(QUIET)if [[ ! -e $(QEMU_SYSROOT_PATH) || \
736 `stat -c %i $(QEMU_SRC_PATH)` != `stat -c %i $(QEMU_SYSROOT_PATH)` \
738 $(ROOT_CMD) ln -Tf $(QEMU_SRC_PATH) $(QEMU_SYSROOT_PATH).$$$$; \
739 $(ROOT_CMD) mv -Tf $(QEMU_SYSROOT_PATH).$$$$ $(QEMU_SYSROOT_PATH); \
744 @# There may still be some race conditions here where one script de-registers
745 @# and another script starts executing before it gets re-registered, however
747 -$(QUIET)[[ -e $(QEMU_REGISTER_PATH) ]] || \
748 $(ROOT_CMD) mount binfmt_misc -t binfmt_misc \
751 -$(QUIET)if [[ -e $(QEMU_BINFMT_PATH) && \
754 echo -1 | $(ROOT_CMD) tee $(QEMU_BINFMT_PATH) >/dev/null; \
757 -$(if $(QEMU_MAGIC_$(ARCH)),$(QUIET)[[ -e $(QEMU_BINFMT_PATH) ]] || \
763 # TODO(wad) Move to -L $(SYSROOT) and fakechroot when qemu-user
778 -drop-ld-preload \
779 -E LD_LIBRARY_PATH="$(QEMU_LDPATH):$(patsubst $(OUT),,$(LD_DIRS))" \
780 -E HOME="$(HOME)" -E SRC="$(SRC)" --
795 VALGRIND_CMD = /usr/bin/valgrind --tool=memcheck $(VALGRIND_ARGS) --
799 $(QUIET)$(call TEST_setup)
800 $(QUIET)$(call TEST_run)
801 $(QUIET)$(call TEST_teardown)
802 $(QUIET)exit $$(cat $(OUT)$(TARGET_OR_MEMBER).status.test)
806 @$(ECHO) -n "TEST $(TARGET_OR_MEMBER) "
808 $(QUIET)# Setup a target-specific results file
809 $(QUIET)(echo > $(OUT)$(TARGET_OR_MEMBER).setup.test)
810 $(QUIET)(echo 1 > $(OUT)$(TARGET_OR_MEMBER).status.test)
811 $(QUIET)(echo > $(OUT)$(TARGET_OR_MEMBER).cleanup.test)
812 $(QUIET)# No setup if we are not using QEMU
813 $(QUIET)# TODO(wad) this is racy until we use a vfs namespace
815 $(QUIET)(echo "mkdir -p '$(SYSROOT)/proc' '$(SYSROOT)/dev' \
819 $(QUIET)(echo "$(MOUNT_CMD) --bind /mnt/host/source \
823 $(QUIET)(echo "$(MOUNT_CMD) --bind /proc '$(SYSROOT)/proc'" \
826 $(QUIET)(echo "$(MOUNT_CMD) --bind /dev '$(SYSROOT)/dev'" \
831 @$(ECHO) -n "TEST $(TARGET_OR_MEMBER) "
833 $(call if_qemu, $(QUIET)$(SHELL) "$(OUT)$(TARGET_OR_MEMBER).cleanup.test")
841 @$(ECHO) -n "TEST $(TARGET_OR_MEMBER) "
843 $(QUIET)(echo 1 > "$(OUT)$(TARGET_OR_MEMBER).status.test")
844 $(QUIET)(echo $(ROOT_CMD) SRC="$(SRC)" $(QEMU_CMD) $(VALGRIND_CMD) \
846 $(if $(filter-out 0,$(words $(GTEST_ARGS.real))),$(GTEST_ARGS.real),\
848 -$(QUIET)$(call if_qemu,$(SUDO_CMD) $(UNSHARE_CMD) -m) $(SHELL) \
862 clean: CLEAN($(OUT)lcov-coverage.info) CLEAN($(OUT)lcov-html)
865 $(QUIET)# Always delete the containing directory last.
891 $(dir $(lastword $(filter-out %common.mk,$(MAKEFILE_LIST)))))
907 clean: CLEAN($(OUT)$(MODULE)/*.gcov) CLEAN($(OUT)lcov-coverage.info)
908 clean: CLEAN($(OUT)lcov-html)
931 endif ## pass-to-subcall wrapper for relocating the call directory