# SPDX-License-Identifier: GPL-2.0-only
# Makefile for cpupower
#
# Copyright (C) 2005,2006 Dominik Brodowski <linux@dominikbrodowski.net>
# Copyright (C) 2025 Francesco Poli <invernomuto@paranoici.org>
#
# Based largely on the Makefile for udev by:
#
# Copyright (C) 2003,2004 Greg Kroah-Hartman <greg@kroah.com>
#
OUTPUT=./
ifeq ("$(origin O)", "command line")
OUTPUT := $(O)/
endif
ifneq ($(OUTPUT),)
# check that the output directory actually exists
OUTDIR := $(shell cd $(OUTPUT) && pwd)
$(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist))
endif
# --- CONFIGURATION BEGIN ---
# Set the following to `true' to make a unstripped, unoptimized
# binary. Leave this set to `false' for production use.
DEBUG ?= true
# make the build silent. Set this to something else to make it noisy again.
V ?= false
# Internationalization support (output in different languages).
# Requires gettext.
NLS ?= true
# Set the following to 'true' to build/install the
# cpufreq-bench benchmarking tool
CPUFREQ_BENCH ?= true
# Do not build libraries, but build the code in statically
# Libraries are still built, otherwise the Makefile code would
# be rather ugly.
export STATIC ?= false
# Prefix to the directories we're installing to
DESTDIR ?=
# --- CONFIGURATION END ---
# Package-related definitions. Distributions can modify the version
# and _should_ modify the PACKAGE_BUGREPORT definition
# Toolchain: what tools do we use, and what options do they need:
CP = cp -fpR
INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = ${INSTALL}
INSTALL_DATA = ${INSTALL} -m 644
SETPERM_DATA = chmod 644
#bash completion scripts get sourced and so they should be rw only.
INSTALL_SCRIPT = ${INSTALL} -m 644
# If you are running a cross compiler, you may want to set this
# to something more interesting, like "arm-linux-". If you want
# to compile vs uClibc, that can be done here as well.
CROSS ?= #/usr/i386-linux-uclibc/usr/bin/i386-uclibc-
ifneq ($(CROSS), )
CC = $(CROSS)gcc
LD = $(CROSS)gcc
AR = $(CROSS)ar
STRIP = $(CROSS)strip
RANLIB = $(CROSS)ranlib else
CC ?= $(CROSS)gcc
LD ?= $(CROSS)gcc
AR ?= $(CROSS)ar
STRIP ?= $(CROSS)strip
RANLIB ?= $(CROSS)ranlib
endif
HOSTCC = gcc
MKDIR = mkdir
# Now we set up the build system
#
GMO_FILES = ${shell for HLANG in ${LANGUAGES}; do echo $(OUTPUT)po/$$HLANG.gmo; done;}
export CROSS CC AR STRIP RANLIB CFLAGS LDFLAGS LIB_OBJS
# check if compiler option is supported
cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -x c /dev/null > /dev/null 2>&1; then echo "$(1)"; fi;}
# use '-Os' optimization if available, else use -O2
OPTIMIZATION := $(call cc-supports,-Os,-O2)
# Let all .o files depend on its .c file and all headers
# Might be worth to put this into utils/Makefile at some point of time
$(UTIL_OBJS): $(UTIL_HEADERS)
# we compile into subdirectories. if the target directory is not the
# source directory, they might not exists. So we depend the various
# files onto their directories.
DIRECTORY_DEPS = $(LIB_OBJS) $(UTIL_OBJS) $(GMO_FILES)
$(DIRECTORY_DEPS): | $(sort $(dir $(DIRECTORY_DEPS)))
# In the second step, we make a rule to actually create these directories
$(sort $(dir $(DIRECTORY_DEPS))):
$(ECHO) " MKDIR " $@
$(QUIET) $(MKDIR) -p $@ 2>/dev/null
install-gmo: create-gmo $(INSTALL) -d $(DESTDIR)${localedir} for HLANG in $(LANGUAGES); do \ echo '$(INSTALL_DATA) -D $(OUTPUT)po/$$HLANG.gmo $(DESTDIR)${localedir}/$$HLANG/LC_MESSAGES/cpupower.mo'; \ $(INSTALL_DATA) -D $(OUTPUT)po/$$HLANG.gmo $(DESTDIR)${localedir}/$$HLANG/LC_MESSAGES/cpupower.mo; \ done;
install-bench: compile-bench @#DESTDIR must be set from outside to survive @sbindir=$(sbindir) bindir=$(bindir) docdir=$(docdir) confdir=$(confdir) $(MAKE) -C bench O=$(OUTPUT) install
ifeq ($(strip $(STATIC)),true) install: all install-tools install-man $(INSTALL_NLS) $(INSTALL_BENCH) else install: all install-lib install-tools install-man $(INSTALL_NLS) $(INSTALL_BENCH) endif
help: @echo 'Building targets:' @echo ' all - Default target. Could be omitted. Put build artifacts' @echo ' to "O" cmdline option dir (default: current dir)' @echo ' install - Install previously built project files from the output' @echo ' dir defined by "O" cmdline option (default: current dir)' @echo ' to the install dir defined by "DESTDIR" cmdline or' @echo ' Makefile config block option (default: "")' @echo ' install-lib - Install previously built library binary from the output' @echo ' dir defined by "O" cmdline option (default: current dir)' @echo ' and library headers from "lib/" for userspace to the install' @echo ' dir defined by "DESTDIR" cmdline (default: "")' @echo ' install-tools - Install previously built "cpupower" util from the output' @echo ' dir defined by "O" cmdline option (default: current dir) and' @echo ' "cpupower-completion.sh" script from the src dir to the' @echo ' install dir defined by "DESTDIR" cmdline or Makefile' @echo ' config block option (default: "")' @echo ' install-man - Install man pages from the "man" src subdir to the' @echo ' install dir defined by "DESTDIR" cmdline or Makefile' @echo ' config block option (default: "")' @echo ' install-gmo - Install previously built language files from the output' @echo ' dir defined by "O" cmdline option (default: current dir)' @echo ' to the install dir defined by "DESTDIR" cmdline or Makefile' @echo ' config block option (default: "")' @echo ' install-bench - Install previously built "cpufreq-bench" util files from the' @echo ' output dir defined by "O" cmdline option (default: current dir)' @echo ' to the install dir defined by "DESTDIR" cmdline or Makefile' @echo ' config block option (default: "")' @echo '' @echo 'Cleaning targets:' @echo ' clean - Clean build artifacts from the dir defined by "O" cmdline' @echo ' option (default: current dir)' @echo ' uninstall - Remove previously installed files from the dir defined by "DESTDIR"' @echo ' cmdline or Makefile config block option (default: "")'
.PHONY: all utils libcpupower update-po create-gmo install-lib install-tools install-man install-gmo install uninstall clean help
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.