18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci# tools/power/acpi/Makefile.config - ACPI tool Makefile
38c2ecf20Sopenharmony_ci#
48c2ecf20Sopenharmony_ci# Copyright (c) 2015, Intel Corporation
58c2ecf20Sopenharmony_ci#   Author: Lv Zheng <lv.zheng@intel.com>
68c2ecf20Sopenharmony_ci#
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ciifeq ($(srctree),)
98c2ecf20Sopenharmony_cisrctree := $(patsubst %/,%,$(dir $(shell pwd)))
108c2ecf20Sopenharmony_cisrctree := $(patsubst %/,%,$(dir $(srctree)))
118c2ecf20Sopenharmony_ci#$(info Determined 'srctree' to be $(srctree))
128c2ecf20Sopenharmony_ciendif
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ciinclude $(srctree)/../../scripts/Makefile.include
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ciOUTPUT=$(srctree)/
178c2ecf20Sopenharmony_ciifeq ("$(origin O)", "command line")
188c2ecf20Sopenharmony_ci	OUTPUT := $(O)/tools/power/acpi/
198c2ecf20Sopenharmony_ciendif
208c2ecf20Sopenharmony_ci#$(info Determined 'OUTPUT' to be $(OUTPUT))
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci# --- CONFIGURATION BEGIN ---
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci# Set the following to `true' to make a unstripped, unoptimized
258c2ecf20Sopenharmony_ci# binary. Leave this set to `false' for production use.
268c2ecf20Sopenharmony_ciDEBUG ?=	true
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci# make the build silent. Set this to something else to make it noisy again.
298c2ecf20Sopenharmony_ciV ?=		false
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci# Prefix to the directories we're installing to
328c2ecf20Sopenharmony_ciDESTDIR ?=
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci# --- CONFIGURATION END ---
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci# Directory definitions. These are default and most probably
378c2ecf20Sopenharmony_ci# do not need to be changed. Please note that DESTDIR is
388c2ecf20Sopenharmony_ci# added in front of any of them
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_cibindir ?=	/usr/bin
418c2ecf20Sopenharmony_cisbindir ?=	/usr/sbin
428c2ecf20Sopenharmony_cimandir ?=	/usr/man
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci# Toolchain: what tools do we use, and what options do they need:
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ciINSTALL = /usr/bin/install -c
478c2ecf20Sopenharmony_ciINSTALL_PROGRAM = ${INSTALL}
488c2ecf20Sopenharmony_ciINSTALL_DATA  = ${INSTALL} -m 644
498c2ecf20Sopenharmony_ciINSTALL_SCRIPT = ${INSTALL_PROGRAM}
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci# If you are running a cross compiler, you may want to set this
528c2ecf20Sopenharmony_ci# to something more interesting, like "arm-linux-".  If you want
538c2ecf20Sopenharmony_ci# to compile vs uClibc, that can be done here as well.
548c2ecf20Sopenharmony_ciCROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc-
558c2ecf20Sopenharmony_ciCROSS_COMPILE ?= $(CROSS)
568c2ecf20Sopenharmony_ciLD = $(CC)
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci# check if compiler option is supported
598c2ecf20Sopenharmony_cicc-supports = ${shell if $(CC) ${1} -S -o /dev/null -x c /dev/null > /dev/null 2>&1; then echo "$(1)"; fi;}
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci# use '-Os' optimization if available, else use -O2
628c2ecf20Sopenharmony_ciOPTIMIZATION := $(call cc-supports,-Os,-O2)
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ciWARNINGS := -Wall
658c2ecf20Sopenharmony_ciWARNINGS += $(call cc-supports,-Wstrict-prototypes)
668c2ecf20Sopenharmony_ciWARNINGS += $(call cc-supports,-Wdeclaration-after-statement)
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ciKERNEL_INCLUDE := $(OUTPUT)include
698c2ecf20Sopenharmony_ciACPICA_INCLUDE := $(srctree)/../../../drivers/acpi/acpica
708c2ecf20Sopenharmony_ciCFLAGS += -D_LINUX -I$(KERNEL_INCLUDE) -I$(ACPICA_INCLUDE)
718c2ecf20Sopenharmony_ciCFLAGS += $(WARNINGS)
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ciifeq ($(strip $(V)),false)
748c2ecf20Sopenharmony_ci	QUIET=@
758c2ecf20Sopenharmony_ci	ECHO=@echo
768c2ecf20Sopenharmony_cielse
778c2ecf20Sopenharmony_ci	QUIET=
788c2ecf20Sopenharmony_ci	ECHO=@\#
798c2ecf20Sopenharmony_ciendif
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci# if DEBUG is enabled, then we do not strip or optimize
828c2ecf20Sopenharmony_ciifeq ($(strip $(DEBUG)),true)
838c2ecf20Sopenharmony_ci	CFLAGS += -O1 -g -DDEBUG
848c2ecf20Sopenharmony_ci	STRIPCMD = /bin/true -Since_we_are_debugging
858c2ecf20Sopenharmony_cielse
868c2ecf20Sopenharmony_ci	CFLAGS += $(OPTIMIZATION) -fomit-frame-pointer
878c2ecf20Sopenharmony_ci	STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment
888c2ecf20Sopenharmony_ciendif
89