1ifeq ("$(origin O)", "command line")
2	OUTPUT := $(O)/
3	COMMAND_O := O=$(O)
4endif
5
6ifneq ($(OUTPUT),)
7# check that the output directory actually exists
8OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd)
9$(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist))
10endif
11
12#
13# Include saner warnings here, which can catch bugs:
14#
15EXTRA_WARNINGS := -Wbad-function-cast
16EXTRA_WARNINGS += -Wdeclaration-after-statement
17EXTRA_WARNINGS += -Wformat-security
18EXTRA_WARNINGS += -Wformat-y2k
19EXTRA_WARNINGS += -Winit-self
20EXTRA_WARNINGS += -Wmissing-declarations
21EXTRA_WARNINGS += -Wmissing-prototypes
22EXTRA_WARNINGS += -Wnested-externs
23EXTRA_WARNINGS += -Wno-system-headers
24EXTRA_WARNINGS += -Wold-style-definition
25EXTRA_WARNINGS += -Wpacked
26EXTRA_WARNINGS += -Wredundant-decls
27EXTRA_WARNINGS += -Wshadow
28EXTRA_WARNINGS += -Wstrict-aliasing=3
29EXTRA_WARNINGS += -Wstrict-prototypes
30EXTRA_WARNINGS += -Wswitch-default
31EXTRA_WARNINGS += -Wswitch-enum
32EXTRA_WARNINGS += -Wundef
33EXTRA_WARNINGS += -Wwrite-strings
34EXTRA_WARNINGS += -Wformat
35
36ifneq ($(findstring $(MAKEFLAGS), w),w)
37PRINT_DIR = --no-print-directory
38else
39NO_SUBDIR = :
40endif
41
42QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir
43QUIET_SUBDIR1  =
44
45ifneq ($(findstring $(MAKEFLAGS),s),s)
46ifndef V
47	QUIET_CC       = @echo '   ' CC $@;
48	QUIET_AR       = @echo '   ' AR $@;
49	QUIET_LINK     = @echo '   ' LINK $@;
50	QUIET_MKDIR    = @echo '   ' MKDIR $@;
51	QUIET_GEN      = @echo '   ' GEN $@;
52	QUIET_SUBDIR0  = +@subdir=
53	QUIET_SUBDIR1  = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
54			 $(MAKE) $(PRINT_DIR) -C $$subdir
55	QUIET_FLEX     = @echo '   ' FLEX $@;
56	QUIET_BISON    = @echo '   ' BISON $@;
57endif
58endif
59