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