Thomas Renninger | ee3db6f | 2011-04-21 17:50:26 +0200 | [diff] [blame] | 1 | # Makefile for cpupower |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 2 | # |
| 3 | # Copyright (C) 2005,2006 Dominik Brodowski <linux@dominikbrodowski.net> |
| 4 | # |
| 5 | # Based largely on the Makefile for udev by: |
| 6 | # |
| 7 | # Copyright (C) 2003,2004 Greg Kroah-Hartman <greg@kroah.com> |
| 8 | # |
| 9 | # This program is free software; you can redistribute it and/or modify |
| 10 | # it under the terms of the GNU General Public License as published by |
| 11 | # the Free Software Foundation; version 2 of the License. |
| 12 | # |
| 13 | # This program is distributed in the hope that it will be useful, |
| 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | # General Public License for more details. |
| 17 | # |
| 18 | # You should have received a copy of the GNU General Public License |
| 19 | # along with this program; if not, write to the Free Software |
| 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 21 | # |
Franck Bui-Huu | 68bb2c3 | 2012-02-01 12:08:20 +0100 | [diff] [blame] | 22 | OUTPUT=./ |
| 23 | ifeq ("$(origin O)", "command line") |
| 24 | OUTPUT := $(O)/ |
| 25 | endif |
| 26 | |
| 27 | ifneq ($(OUTPUT),) |
| 28 | # check that the output directory actually exists |
| 29 | OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd) |
| 30 | $(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist)) |
| 31 | endif |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 32 | |
| 33 | # --- CONFIGURATION BEGIN --- |
| 34 | |
| 35 | # Set the following to `true' to make a unstripped, unoptimized |
| 36 | # binary. Leave this set to `false' for production use. |
Thomas Renninger | 2dfc818 | 2011-08-12 01:11:35 +0200 | [diff] [blame] | 37 | DEBUG ?= true |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 38 | |
| 39 | # make the build silent. Set this to something else to make it noisy again. |
| 40 | V ?= false |
| 41 | |
| 42 | # Internationalization support (output in different languages). |
| 43 | # Requires gettext. |
| 44 | NLS ?= true |
| 45 | |
| 46 | # Set the following to 'true' to build/install the |
| 47 | # cpufreq-bench benchmarking tool |
Dave Jones | 63b37de | 2011-08-16 15:36:21 -0400 | [diff] [blame] | 48 | CPUFREQ_BENCH ?= true |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 49 | |
| 50 | # Prefix to the directories we're installing to |
Dominik Brodowski | 02af3cb | 2011-04-19 19:20:12 +0200 | [diff] [blame] | 51 | DESTDIR ?= |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 52 | |
| 53 | # --- CONFIGURATION END --- |
| 54 | |
| 55 | |
| 56 | |
| 57 | # Package-related definitions. Distributions can modify the version |
| 58 | # and _should_ modify the PACKAGE_BUGREPORT definition |
| 59 | |
Dominik Brodowski | af594f0 | 2011-04-20 20:01:39 +0200 | [diff] [blame] | 60 | VERSION= $(shell ./utils/version-gen.sh) |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 61 | LIB_MAJ= 0.0.0 |
| 62 | LIB_MIN= 0 |
| 63 | |
Thomas Renninger | ee3db6f | 2011-04-21 17:50:26 +0200 | [diff] [blame] | 64 | PACKAGE = cpupower |
Viresh Kumar | dec102a | 2014-04-22 10:42:05 +0530 | [diff] [blame] | 65 | PACKAGE_BUGREPORT = linux-pm@vger.kernel.org |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 66 | LANGUAGES = de fr it cs pt |
| 67 | |
| 68 | |
| 69 | # Directory definitions. These are default and most probably |
| 70 | # do not need to be changed. Please note that DESTDIR is |
| 71 | # added in front of any of them |
| 72 | |
| 73 | bindir ?= /usr/bin |
| 74 | sbindir ?= /usr/sbin |
| 75 | mandir ?= /usr/man |
| 76 | includedir ?= /usr/include |
| 77 | libdir ?= /usr/lib |
| 78 | localedir ?= /usr/share/locale |
Thomas Renninger | ee3db6f | 2011-04-21 17:50:26 +0200 | [diff] [blame] | 79 | docdir ?= /usr/share/doc/packages/cpupower |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 80 | confdir ?= /etc/ |
| 81 | |
| 82 | # Toolchain: what tools do we use, and what options do they need: |
| 83 | |
| 84 | CP = cp -fpR |
| 85 | INSTALL = /usr/bin/install -c |
| 86 | INSTALL_PROGRAM = ${INSTALL} |
| 87 | INSTALL_DATA = ${INSTALL} -m 644 |
| 88 | INSTALL_SCRIPT = ${INSTALL_PROGRAM} |
| 89 | |
| 90 | # If you are running a cross compiler, you may want to set this |
| 91 | # to something more interesting, like "arm-linux-". If you want |
| 92 | # to compile vs uClibc, that can be done here as well. |
| 93 | CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc- |
| 94 | CC = $(CROSS)gcc |
| 95 | LD = $(CROSS)gcc |
| 96 | AR = $(CROSS)ar |
| 97 | STRIP = $(CROSS)strip |
| 98 | RANLIB = $(CROSS)ranlib |
| 99 | HOSTCC = gcc |
Franck Bui-Huu | 68bb2c3 | 2012-02-01 12:08:20 +0100 | [diff] [blame] | 100 | MKDIR = mkdir |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 101 | |
| 102 | |
| 103 | # Now we set up the build system |
| 104 | # |
| 105 | |
| 106 | # set up PWD so that older versions of make will work with our build. |
| 107 | PWD = $(shell pwd) |
| 108 | |
Franck Bui-Huu | 68bb2c3 | 2012-02-01 12:08:20 +0100 | [diff] [blame] | 109 | GMO_FILES = ${shell for HLANG in ${LANGUAGES}; do echo $(OUTPUT)po/$$HLANG.gmo; done;} |
Dominik Brodowski | f5ac064 | 2011-04-19 18:52:44 +0200 | [diff] [blame] | 110 | |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 111 | export CROSS CC AR STRIP RANLIB CFLAGS LDFLAGS LIB_OBJS |
| 112 | |
| 113 | # check if compiler option is supported |
Jean Delvare | b1e0d8b | 2012-10-02 16:42:36 +0200 | [diff] [blame] | 114 | cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -x c /dev/null > /dev/null 2>&1; then echo "$(1)"; fi;} |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 115 | |
| 116 | # use '-Os' optimization if available, else use -O2 |
| 117 | OPTIMIZATION := $(call cc-supports,-Os,-O2) |
| 118 | |
| 119 | WARNINGS := -Wall -Wchar-subscripts -Wpointer-arith -Wsign-compare |
| 120 | WARNINGS += $(call cc-supports,-Wno-pointer-sign) |
| 121 | WARNINGS += $(call cc-supports,-Wdeclaration-after-statement) |
| 122 | WARNINGS += -Wshadow |
| 123 | |
Dominik Brodowski | af594f0 | 2011-04-20 20:01:39 +0200 | [diff] [blame] | 124 | CFLAGS += -DVERSION=\"$(VERSION)\" -DPACKAGE=\"$(PACKAGE)\" \ |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 125 | -DPACKAGE_BUGREPORT=\"$(PACKAGE_BUGREPORT)\" -D_GNU_SOURCE |
| 126 | |
| 127 | UTIL_OBJS = utils/helpers/amd.o utils/helpers/topology.o utils/helpers/msr.o \ |
| 128 | utils/helpers/sysfs.o utils/helpers/misc.o utils/helpers/cpuid.o \ |
| 129 | utils/helpers/pci.o utils/helpers/bitmask.o \ |
| 130 | utils/idle_monitor/nhm_idle.o utils/idle_monitor/snb_idle.o \ |
Thomas Renninger | 7ee767b | 2013-06-28 15:34:33 +0200 | [diff] [blame] | 131 | utils/idle_monitor/hsw_ext_idle.o \ |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 132 | utils/idle_monitor/amd_fam14h_idle.o utils/idle_monitor/cpuidle_sysfs.o \ |
| 133 | utils/idle_monitor/mperf_monitor.o utils/idle_monitor/cpupower-monitor.o \ |
| 134 | utils/cpupower.o utils/cpufreq-info.o utils/cpufreq-set.o \ |
Thomas Renninger | c4f3610 | 2013-06-28 15:34:31 +0200 | [diff] [blame] | 135 | utils/cpupower-set.o utils/cpupower-info.o utils/cpuidle-info.o \ |
| 136 | utils/cpuidle-set.o |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 137 | |
Franck Bui-Huu | 68bb2c3 | 2012-02-01 12:08:20 +0100 | [diff] [blame] | 138 | UTIL_SRC := $(UTIL_OBJS:.o=.c) |
| 139 | |
| 140 | UTIL_OBJS := $(addprefix $(OUTPUT),$(UTIL_OBJS)) |
| 141 | |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 142 | UTIL_HEADERS = utils/helpers/helpers.h utils/idle_monitor/cpupower-monitor.h \ |
| 143 | utils/helpers/bitmask.h \ |
| 144 | utils/idle_monitor/idle_monitors.h utils/idle_monitor/idle_monitors.def |
| 145 | |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 146 | LIB_HEADERS = lib/cpufreq.h lib/sysfs.h |
| 147 | LIB_SRC = lib/cpufreq.c lib/sysfs.c |
| 148 | LIB_OBJS = lib/cpufreq.o lib/sysfs.o |
Franck Bui-Huu | 68bb2c3 | 2012-02-01 12:08:20 +0100 | [diff] [blame] | 149 | LIB_OBJS := $(addprefix $(OUTPUT),$(LIB_OBJS)) |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 150 | |
| 151 | CFLAGS += -pipe |
| 152 | |
| 153 | ifeq ($(strip $(NLS)),true) |
| 154 | INSTALL_NLS += install-gmo |
Dominik Brodowski | f5ac064 | 2011-04-19 18:52:44 +0200 | [diff] [blame] | 155 | COMPILE_NLS += create-gmo |
Dominik Brodowski | 47c3363 | 2011-08-19 17:00:02 +0200 | [diff] [blame] | 156 | CFLAGS += -DNLS |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 157 | endif |
| 158 | |
Dave Jones | 63b37de | 2011-08-16 15:36:21 -0400 | [diff] [blame] | 159 | ifeq ($(strip $(CPUFREQ_BENCH)),true) |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 160 | INSTALL_BENCH += install-bench |
| 161 | COMPILE_BENCH += compile-bench |
| 162 | endif |
| 163 | |
| 164 | CFLAGS += $(WARNINGS) |
| 165 | |
| 166 | ifeq ($(strip $(V)),false) |
Dominik Brodowski | 7443af9 | 2011-04-19 09:03:52 +0200 | [diff] [blame] | 167 | QUIET=@ |
| 168 | ECHO=@echo |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 169 | else |
| 170 | QUIET= |
Dominik Brodowski | 7443af9 | 2011-04-19 09:03:52 +0200 | [diff] [blame] | 171 | ECHO=@\# |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 172 | endif |
Dominik Brodowski | 7443af9 | 2011-04-19 09:03:52 +0200 | [diff] [blame] | 173 | export QUIET ECHO |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 174 | |
| 175 | # if DEBUG is enabled, then we do not strip or optimize |
| 176 | ifeq ($(strip $(DEBUG)),true) |
Dominik Brodowski | af594f0 | 2011-04-20 20:01:39 +0200 | [diff] [blame] | 177 | CFLAGS += -O1 -g -DDEBUG |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 178 | STRIPCMD = /bin/true -Since_we_are_debugging |
| 179 | else |
| 180 | CFLAGS += $(OPTIMIZATION) -fomit-frame-pointer |
| 181 | STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment |
| 182 | endif |
| 183 | |
| 184 | |
| 185 | # the actual make rules |
| 186 | |
Franck Bui-Huu | 68bb2c3 | 2012-02-01 12:08:20 +0100 | [diff] [blame] | 187 | all: libcpupower $(OUTPUT)cpupower $(COMPILE_NLS) $(COMPILE_BENCH) |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 188 | |
Franck Bui-Huu | 68bb2c3 | 2012-02-01 12:08:20 +0100 | [diff] [blame] | 189 | $(OUTPUT)lib/%.o: $(LIB_SRC) $(LIB_HEADERS) |
Dominik Brodowski | 7443af9 | 2011-04-19 09:03:52 +0200 | [diff] [blame] | 190 | $(ECHO) " CC " $@ |
Dominik Brodowski | af594f0 | 2011-04-20 20:01:39 +0200 | [diff] [blame] | 191 | $(QUIET) $(CC) $(CFLAGS) -fPIC -o $@ -c lib/$*.c |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 192 | |
Franck Bui-Huu | 68bb2c3 | 2012-02-01 12:08:20 +0100 | [diff] [blame] | 193 | $(OUTPUT)libcpupower.so.$(LIB_MAJ): $(LIB_OBJS) |
Dominik Brodowski | 7443af9 | 2011-04-19 09:03:52 +0200 | [diff] [blame] | 194 | $(ECHO) " LD " $@ |
Dominik Brodowski | af594f0 | 2011-04-20 20:01:39 +0200 | [diff] [blame] | 195 | $(QUIET) $(CC) -shared $(CFLAGS) $(LDFLAGS) -o $@ \ |
Thomas Renninger | 4c22337 | 2011-04-21 17:50:25 +0200 | [diff] [blame] | 196 | -Wl,-soname,libcpupower.so.$(LIB_MIN) $(LIB_OBJS) |
Franck Bui-Huu | 68bb2c3 | 2012-02-01 12:08:20 +0100 | [diff] [blame] | 197 | @ln -sf $(@F) $(OUTPUT)libcpupower.so |
| 198 | @ln -sf $(@F) $(OUTPUT)libcpupower.so.$(LIB_MIN) |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 199 | |
Franck Bui-Huu | 68bb2c3 | 2012-02-01 12:08:20 +0100 | [diff] [blame] | 200 | libcpupower: $(OUTPUT)libcpupower.so.$(LIB_MAJ) |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 201 | |
| 202 | # Let all .o files depend on its .c file and all headers |
| 203 | # Might be worth to put this into utils/Makefile at some point of time |
| 204 | $(UTIL_OBJS): $(UTIL_HEADERS) |
| 205 | |
Franck Bui-Huu | 68bb2c3 | 2012-02-01 12:08:20 +0100 | [diff] [blame] | 206 | $(OUTPUT)%.o: %.c |
Dominik Brodowski | 7443af9 | 2011-04-19 09:03:52 +0200 | [diff] [blame] | 207 | $(ECHO) " CC " $@ |
Dominik Brodowski | af594f0 | 2011-04-20 20:01:39 +0200 | [diff] [blame] | 208 | $(QUIET) $(CC) $(CFLAGS) -I./lib -I ./utils -o $@ -c $*.c |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 209 | |
Franck Bui-Huu | 68bb2c3 | 2012-02-01 12:08:20 +0100 | [diff] [blame] | 210 | $(OUTPUT)cpupower: $(UTIL_OBJS) $(OUTPUT)libcpupower.so.$(LIB_MAJ) |
Dominik Brodowski | 7443af9 | 2011-04-19 09:03:52 +0200 | [diff] [blame] | 211 | $(ECHO) " CC " $@ |
Franck Bui-Huu | 68bb2c3 | 2012-02-01 12:08:20 +0100 | [diff] [blame] | 212 | $(QUIET) $(CC) $(CFLAGS) $(LDFLAGS) $(UTIL_OBJS) -lcpupower -lrt -lpci -L$(OUTPUT) -o $@ |
Dominik Brodowski | 7443af9 | 2011-04-19 09:03:52 +0200 | [diff] [blame] | 213 | $(QUIET) $(STRIPCMD) $@ |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 214 | |
Franck Bui-Huu | 68bb2c3 | 2012-02-01 12:08:20 +0100 | [diff] [blame] | 215 | $(OUTPUT)po/$(PACKAGE).pot: $(UTIL_SRC) |
Dominik Brodowski | f5ac064 | 2011-04-19 18:52:44 +0200 | [diff] [blame] | 216 | $(ECHO) " GETTEXT " $@ |
| 217 | $(QUIET) xgettext --default-domain=$(PACKAGE) --add-comments \ |
Franck Bui-Huu | 3827150 | 2012-02-01 12:08:19 +0100 | [diff] [blame] | 218 | --keyword=_ --keyword=N_ $(UTIL_SRC) -p $(@D) -o $(@F) |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 219 | |
Franck Bui-Huu | 68bb2c3 | 2012-02-01 12:08:20 +0100 | [diff] [blame] | 220 | $(OUTPUT)po/%.gmo: po/%.po |
Dominik Brodowski | f5ac064 | 2011-04-19 18:52:44 +0200 | [diff] [blame] | 221 | $(ECHO) " MSGFMT " $@ |
| 222 | $(QUIET) msgfmt -o $@ po/$*.po |
| 223 | |
| 224 | create-gmo: ${GMO_FILES} |
| 225 | |
Franck Bui-Huu | 68bb2c3 | 2012-02-01 12:08:20 +0100 | [diff] [blame] | 226 | update-po: $(OUTPUT)po/$(PACKAGE).pot |
Dominik Brodowski | f5ac064 | 2011-04-19 18:52:44 +0200 | [diff] [blame] | 227 | $(ECHO) " MSGMRG " $@ |
| 228 | $(QUIET) @for HLANG in $(LANGUAGES); do \ |
| 229 | echo -n "Updating $$HLANG "; \ |
Franck Bui-Huu | 68bb2c3 | 2012-02-01 12:08:20 +0100 | [diff] [blame] | 230 | if msgmerge po/$$HLANG.po $< -o \ |
| 231 | $(OUTPUT)po/$$HLANG.new.po; then \ |
| 232 | mv -f $(OUTPUT)po/$$HLANG.new.po $(OUTPUT)po/$$HLANG.po; \ |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 233 | else \ |
| 234 | echo "msgmerge for $$HLANG failed!"; \ |
Franck Bui-Huu | 68bb2c3 | 2012-02-01 12:08:20 +0100 | [diff] [blame] | 235 | rm -f $(OUTPUT)po/$$HLANG.new.po; \ |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 236 | fi; \ |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 237 | done; |
| 238 | |
Franck Bui-Huu | 68bb2c3 | 2012-02-01 12:08:20 +0100 | [diff] [blame] | 239 | compile-bench: $(OUTPUT)libcpupower.so.$(LIB_MAJ) |
| 240 | @V=$(V) confdir=$(confdir) $(MAKE) -C bench O=$(OUTPUT) |
| 241 | |
| 242 | # we compile into subdirectories. if the target directory is not the |
| 243 | # source directory, they might not exists. So we depend the various |
| 244 | # files onto their directories. |
| 245 | DIRECTORY_DEPS = $(LIB_OBJS) $(UTIL_OBJS) $(GMO_FILES) |
| 246 | $(DIRECTORY_DEPS): | $(sort $(dir $(DIRECTORY_DEPS))) |
| 247 | |
| 248 | # In the second step, we make a rule to actually create these directories |
| 249 | $(sort $(dir $(DIRECTORY_DEPS))): |
| 250 | $(ECHO) " MKDIR " $@ |
| 251 | $(QUIET) $(MKDIR) -p $@ 2>/dev/null |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 252 | |
| 253 | clean: |
Franck Bui-Huu | 68bb2c3 | 2012-02-01 12:08:20 +0100 | [diff] [blame] | 254 | -find $(OUTPUT) \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 255 | | xargs rm -f |
Franck Bui-Huu | 68bb2c3 | 2012-02-01 12:08:20 +0100 | [diff] [blame] | 256 | -rm -f $(OUTPUT)cpupower |
| 257 | -rm -f $(OUTPUT)libcpupower.so* |
Palmer Cox | 8c00bdf | 2012-11-27 13:17:42 +0100 | [diff] [blame] | 258 | -rm -rf $(OUTPUT)po/*.gmo |
| 259 | -rm -rf $(OUTPUT)po/*.pot |
Franck Bui-Huu | 68bb2c3 | 2012-02-01 12:08:20 +0100 | [diff] [blame] | 260 | $(MAKE) -C bench O=$(OUTPUT) clean |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 261 | |
| 262 | |
| 263 | install-lib: |
| 264 | $(INSTALL) -d $(DESTDIR)${libdir} |
Franck Bui-Huu | 68bb2c3 | 2012-02-01 12:08:20 +0100 | [diff] [blame] | 265 | $(CP) $(OUTPUT)libcpupower.so* $(DESTDIR)${libdir}/ |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 266 | $(INSTALL) -d $(DESTDIR)${includedir} |
| 267 | $(INSTALL_DATA) lib/cpufreq.h $(DESTDIR)${includedir}/cpufreq.h |
| 268 | |
| 269 | install-tools: |
| 270 | $(INSTALL) -d $(DESTDIR)${bindir} |
Franck Bui-Huu | 68bb2c3 | 2012-02-01 12:08:20 +0100 | [diff] [blame] | 271 | $(INSTALL_PROGRAM) $(OUTPUT)cpupower $(DESTDIR)${bindir} |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 272 | |
| 273 | install-man: |
| 274 | $(INSTALL_DATA) -D man/cpupower.1 $(DESTDIR)${mandir}/man1/cpupower.1 |
| 275 | $(INSTALL_DATA) -D man/cpupower-frequency-set.1 $(DESTDIR)${mandir}/man1/cpupower-frequency-set.1 |
| 276 | $(INSTALL_DATA) -D man/cpupower-frequency-info.1 $(DESTDIR)${mandir}/man1/cpupower-frequency-info.1 |
Thomas Renninger | 84baab9 | 2014-05-13 12:41:42 +0200 | [diff] [blame] | 277 | $(INSTALL_DATA) -D man/cpupower-idle-set.1 $(DESTDIR)${mandir}/man1/cpupower-idle-set.1 |
| 278 | $(INSTALL_DATA) -D man/cpupower-idle-info.1 $(DESTDIR)${mandir}/man1/cpupower-idle-info.1 |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 279 | $(INSTALL_DATA) -D man/cpupower-set.1 $(DESTDIR)${mandir}/man1/cpupower-set.1 |
| 280 | $(INSTALL_DATA) -D man/cpupower-info.1 $(DESTDIR)${mandir}/man1/cpupower-info.1 |
| 281 | $(INSTALL_DATA) -D man/cpupower-monitor.1 $(DESTDIR)${mandir}/man1/cpupower-monitor.1 |
| 282 | |
| 283 | install-gmo: |
| 284 | $(INSTALL) -d $(DESTDIR)${localedir} |
| 285 | for HLANG in $(LANGUAGES); do \ |
Franck Bui-Huu | 68bb2c3 | 2012-02-01 12:08:20 +0100 | [diff] [blame] | 286 | echo '$(INSTALL_DATA) -D $(OUTPUT)po/$$HLANG.gmo $(DESTDIR)${localedir}/$$HLANG/LC_MESSAGES/cpupower.mo'; \ |
| 287 | $(INSTALL_DATA) -D $(OUTPUT)po/$$HLANG.gmo $(DESTDIR)${localedir}/$$HLANG/LC_MESSAGES/cpupower.mo; \ |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 288 | done; |
| 289 | |
| 290 | install-bench: |
| 291 | @#DESTDIR must be set from outside to survive |
Franck Bui-Huu | 68bb2c3 | 2012-02-01 12:08:20 +0100 | [diff] [blame] | 292 | @sbindir=$(sbindir) bindir=$(bindir) docdir=$(docdir) confdir=$(confdir) $(MAKE) -C bench O=$(OUTPUT) install |
Dominik Brodowski | 7443af9 | 2011-04-19 09:03:52 +0200 | [diff] [blame] | 293 | |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 294 | install: all install-lib install-tools install-man $(INSTALL_NLS) $(INSTALL_BENCH) |
| 295 | |
| 296 | uninstall: |
Thomas Renninger | 4c22337 | 2011-04-21 17:50:25 +0200 | [diff] [blame] | 297 | - rm -f $(DESTDIR)${libdir}/libcpupower.* |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 298 | - rm -f $(DESTDIR)${includedir}/cpufreq.h |
| 299 | - rm -f $(DESTDIR)${bindir}/utils/cpupower |
Ramkumar Ramachandra | 706f4c1 | 2014-05-13 12:41:40 +0200 | [diff] [blame] | 300 | - rm -f $(DESTDIR)${mandir}/man1/cpupower.1 |
| 301 | - rm -f $(DESTDIR)${mandir}/man1/cpupower-frequency-set.1 |
| 302 | - rm -f $(DESTDIR)${mandir}/man1/cpupower-frequency-info.1 |
| 303 | - rm -f $(DESTDIR)${mandir}/man1/cpupower-set.1 |
| 304 | - rm -f $(DESTDIR)${mandir}/man1/cpupower-info.1 |
| 305 | - rm -f $(DESTDIR)${mandir}/man1/cpupower-monitor.1 |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 306 | - for HLANG in $(LANGUAGES); do \ |
Thomas Renninger | ee3db6f | 2011-04-21 17:50:26 +0200 | [diff] [blame] | 307 | rm -f $(DESTDIR)${localedir}/$$HLANG/LC_MESSAGES/cpupower.mo; \ |
Dominik Brodowski | 7fe2f63 | 2011-03-30 16:30:11 +0200 | [diff] [blame] | 308 | done; |
| 309 | |
Thomas Renninger | 4c22337 | 2011-04-21 17:50:25 +0200 | [diff] [blame] | 310 | .PHONY: all utils libcpupower update-po create-gmo install-lib install-tools install-man install-gmo install uninstall clean |