162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only
262306a36Sopenharmony_ci# tools/power/acpi/Makefile.config - ACPI tool Makefile
362306a36Sopenharmony_ci#
462306a36Sopenharmony_ci# Copyright (c) 2015, Intel Corporation
562306a36Sopenharmony_ci#   Author: Lv Zheng <lv.zheng@intel.com>
662306a36Sopenharmony_ci#
762306a36Sopenharmony_ci
862306a36Sopenharmony_ciifeq ($(srctree),)
962306a36Sopenharmony_cisrctree := $(patsubst %/,%,$(dir $(shell pwd)))
1062306a36Sopenharmony_cisrctree := $(patsubst %/,%,$(dir $(srctree)))
1162306a36Sopenharmony_ci#$(info Determined 'srctree' to be $(srctree))
1262306a36Sopenharmony_ciendif
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ciinclude $(srctree)/../../scripts/Makefile.include
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ciOUTPUT=$(srctree)/
1762306a36Sopenharmony_ciifeq ("$(origin O)", "command line")
1862306a36Sopenharmony_ci	OUTPUT := $(O)/tools/power/acpi/
1962306a36Sopenharmony_ciendif
2062306a36Sopenharmony_ci#$(info Determined 'OUTPUT' to be $(OUTPUT))
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci# --- CONFIGURATION BEGIN ---
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci# Set the following to `true' to make a unstripped, unoptimized
2562306a36Sopenharmony_ci# binary. Leave this set to `false' for production use.
2662306a36Sopenharmony_ciDEBUG ?=	true
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci# make the build silent. Set this to something else to make it noisy again.
2962306a36Sopenharmony_ciV ?=		false
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci# Prefix to the directories we're installing to
3262306a36Sopenharmony_ciDESTDIR ?=
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci# --- CONFIGURATION END ---
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci# Directory definitions. These are default and most probably
3762306a36Sopenharmony_ci# do not need to be changed. Please note that DESTDIR is
3862306a36Sopenharmony_ci# added in front of any of them
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_cibindir ?=	/usr/bin
4162306a36Sopenharmony_cisbindir ?=	/usr/sbin
4262306a36Sopenharmony_cimandir ?=	/usr/man
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci# Toolchain: what tools do we use, and what options do they need:
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ciINSTALL = /usr/bin/install -c
4762306a36Sopenharmony_ciINSTALL_PROGRAM = ${INSTALL}
4862306a36Sopenharmony_ciINSTALL_DATA  = ${INSTALL} -m 644
4962306a36Sopenharmony_ciINSTALL_SCRIPT = ${INSTALL_PROGRAM}
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci# If you are running a cross compiler, you may want to set this
5262306a36Sopenharmony_ci# to something more interesting, like "arm-linux-".  If you want
5362306a36Sopenharmony_ci# to compile vs uClibc, that can be done here as well.
5462306a36Sopenharmony_ciCROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc-
5562306a36Sopenharmony_ciCROSS_COMPILE ?= $(CROSS)
5662306a36Sopenharmony_ciLD = $(CC)
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci# check if compiler option is supported
5962306a36Sopenharmony_cicc-supports = ${shell if $(CC) ${1} -S -o /dev/null -x c /dev/null > /dev/null 2>&1; then echo "$(1)"; fi;}
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci# use '-Os' optimization if available, else use -O2
6262306a36Sopenharmony_ciOPTIMIZATION := $(call cc-supports,-Os,-O2)
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ciWARNINGS := -Wall
6562306a36Sopenharmony_ciWARNINGS += $(call cc-supports,-Wstrict-prototypes)
6662306a36Sopenharmony_ciWARNINGS += $(call cc-supports,-Wdeclaration-after-statement)
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ciKERNEL_INCLUDE := $(OUTPUT)include
6962306a36Sopenharmony_ciACPICA_INCLUDE := $(srctree)/../../../drivers/acpi/acpica
7062306a36Sopenharmony_ciCFLAGS += -D_LINUX -I$(KERNEL_INCLUDE) -I$(ACPICA_INCLUDE)
7162306a36Sopenharmony_ciCFLAGS += $(WARNINGS)
7262306a36Sopenharmony_ciMKDIR = mkdir
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ciifeq ($(strip $(V)),false)
7562306a36Sopenharmony_ci	QUIET=@
7662306a36Sopenharmony_ci	ECHO=@echo
7762306a36Sopenharmony_cielse
7862306a36Sopenharmony_ci	QUIET=
7962306a36Sopenharmony_ci	ECHO=@\#
8062306a36Sopenharmony_ciendif
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci# if DEBUG is enabled, then we do not strip or optimize
8362306a36Sopenharmony_ciifeq ($(strip $(DEBUG)),true)
8462306a36Sopenharmony_ci	CFLAGS += -O1 -g -DDEBUG
8562306a36Sopenharmony_ci	STRIPCMD = /bin/true -Since_we_are_debugging
8662306a36Sopenharmony_cielse
8762306a36Sopenharmony_ci	CFLAGS += $(OPTIMIZATION) -fomit-frame-pointer
8862306a36Sopenharmony_ci	STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment
8962306a36Sopenharmony_ciendif
90