Lv Zheng | 391fc23 | 2015-07-28 13:25:25 +0800 | [diff] [blame] | 1 | # tools/power/acpi/Makefile.config - ACPI tool Makefile |
| 2 | # |
| 3 | # Copyright (c) 2015, Intel Corporation |
| 4 | # Author: Lv Zheng <lv.zheng@intel.com> |
| 5 | # |
| 6 | # This program is free software; you can redistribute it and/or |
| 7 | # modify it under the terms of the GNU General Public License |
| 8 | # as published by the Free Software Foundation; version 2 |
| 9 | # of the License. |
| 10 | |
Lv Zheng | d5a4b1a | 2016-11-16 17:27:34 +0800 | [diff] [blame] | 11 | ifeq ($(srctree),) |
| 12 | srctree := $(patsubst %/,%,$(dir $(shell pwd))) |
| 13 | srctree := $(patsubst %/,%,$(dir $(srctree))) |
| 14 | #$(info Determined 'srctree' to be $(srctree)) |
| 15 | endif |
Lv Zheng | 391fc23 | 2015-07-28 13:25:25 +0800 | [diff] [blame] | 16 | |
Lv Zheng | d5a4b1a | 2016-11-16 17:27:34 +0800 | [diff] [blame] | 17 | include $(srctree)/../../scripts/Makefile.include |
| 18 | |
| 19 | OUTPUT=$(srctree)/ |
Lv Zheng | 391fc23 | 2015-07-28 13:25:25 +0800 | [diff] [blame] | 20 | ifeq ("$(origin O)", "command line") |
Lv Zheng | d5a4b1a | 2016-11-16 17:27:34 +0800 | [diff] [blame] | 21 | OUTPUT := $(O)/power/acpi/ |
Lv Zheng | 391fc23 | 2015-07-28 13:25:25 +0800 | [diff] [blame] | 22 | endif |
Lv Zheng | d5a4b1a | 2016-11-16 17:27:34 +0800 | [diff] [blame] | 23 | #$(info Determined 'OUTPUT' to be $(OUTPUT)) |
Lv Zheng | 391fc23 | 2015-07-28 13:25:25 +0800 | [diff] [blame] | 24 | |
| 25 | # --- CONFIGURATION BEGIN --- |
| 26 | |
| 27 | # Set the following to `true' to make a unstripped, unoptimized |
| 28 | # binary. Leave this set to `false' for production use. |
| 29 | DEBUG ?= true |
| 30 | |
| 31 | # make the build silent. Set this to something else to make it noisy again. |
| 32 | V ?= false |
| 33 | |
| 34 | # Prefix to the directories we're installing to |
| 35 | DESTDIR ?= |
| 36 | |
| 37 | # --- CONFIGURATION END --- |
| 38 | |
| 39 | # Directory definitions. These are default and most probably |
| 40 | # do not need to be changed. Please note that DESTDIR is |
| 41 | # added in front of any of them |
| 42 | |
| 43 | bindir ?= /usr/bin |
| 44 | sbindir ?= /usr/sbin |
| 45 | mandir ?= /usr/man |
| 46 | |
| 47 | # Toolchain: what tools do we use, and what options do they need: |
| 48 | |
| 49 | INSTALL = /usr/bin/install -c |
| 50 | INSTALL_PROGRAM = ${INSTALL} |
| 51 | INSTALL_DATA = ${INSTALL} -m 644 |
| 52 | INSTALL_SCRIPT = ${INSTALL_PROGRAM} |
| 53 | |
| 54 | # If you are running a cross compiler, you may want to set this |
| 55 | # to something more interesting, like "arm-linux-". If you want |
| 56 | # to compile vs uClibc, that can be done here as well. |
| 57 | CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc- |
Andy Shevchenko | a3bcf2d | 2016-06-17 16:01:08 +0300 | [diff] [blame] | 58 | CROSS_COMPILE ?= $(CROSS) |
| 59 | CC = $(CROSS_COMPILE)gcc |
| 60 | LD = $(CROSS_COMPILE)gcc |
| 61 | STRIP = $(CROSS_COMPILE)strip |
Lv Zheng | 391fc23 | 2015-07-28 13:25:25 +0800 | [diff] [blame] | 62 | HOSTCC = gcc |
| 63 | |
| 64 | # check if compiler option is supported |
| 65 | cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -x c /dev/null > /dev/null 2>&1; then echo "$(1)"; fi;} |
| 66 | |
| 67 | # use '-Os' optimization if available, else use -O2 |
| 68 | OPTIMIZATION := $(call cc-supports,-Os,-O2) |
| 69 | |
| 70 | WARNINGS := -Wall |
| 71 | WARNINGS += $(call cc-supports,-Wstrict-prototypes) |
| 72 | WARNINGS += $(call cc-supports,-Wdeclaration-after-statement) |
| 73 | |
Lv Zheng | d5a4b1a | 2016-11-16 17:27:34 +0800 | [diff] [blame] | 74 | KERNEL_INCLUDE := $(OUTPUT)include |
| 75 | ACPICA_INCLUDE := $(srctree)/../../../drivers/acpi/acpica |
Lv Zheng | 391fc23 | 2015-07-28 13:25:25 +0800 | [diff] [blame] | 76 | CFLAGS += -D_LINUX -I$(KERNEL_INCLUDE) -I$(ACPICA_INCLUDE) |
| 77 | CFLAGS += $(WARNINGS) |
| 78 | |
| 79 | ifeq ($(strip $(V)),false) |
| 80 | QUIET=@ |
| 81 | ECHO=@echo |
| 82 | else |
| 83 | QUIET= |
| 84 | ECHO=@\# |
| 85 | endif |
| 86 | |
| 87 | # if DEBUG is enabled, then we do not strip or optimize |
| 88 | ifeq ($(strip $(DEBUG)),true) |
| 89 | CFLAGS += -O1 -g -DDEBUG |
| 90 | STRIPCMD = /bin/true -Since_we_are_debugging |
| 91 | else |
| 92 | CFLAGS += $(OPTIMIZATION) -fomit-frame-pointer |
| 93 | STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment |
| 94 | endif |