xref: /linux/tools/power/x86/x86_energy_perf_policy/Makefile (revision 976e3645923bdd2fe7893aae33fd7a21098bfb28)
1# SPDX-License-Identifier: GPL-2.0
2CC		= $(CROSS_COMPILE)gcc
3BUILD_OUTPUT    := $(CURDIR)
4PREFIX		:= /usr
5DESTDIR		:=
6
7ifeq ("$(origin O)", "command line")
8	BUILD_OUTPUT := $(O)
9endif
10
11x86_energy_perf_policy : x86_energy_perf_policy.c
12override CFLAGS +=	-O2 -Wall -I../../../include
13override CFLAGS +=	-DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"'
14override CFLAGS +=	-D_FORTIFY_SOURCE=2
15
16%: %.c
17	@mkdir -p $(BUILD_OUTPUT)
18	$(CC) $(CFLAGS) $< -o $(BUILD_OUTPUT)/$@ $(LDFLAGS)
19
20.PHONY : clean
21clean :
22	@rm -f $(BUILD_OUTPUT)/x86_energy_perf_policy
23
24install : x86_energy_perf_policy
25	install -d  $(DESTDIR)$(PREFIX)/bin
26	install $(BUILD_OUTPUT)/x86_energy_perf_policy $(DESTDIR)$(PREFIX)/bin/x86_energy_perf_policy
27	install -d  $(DESTDIR)$(PREFIX)/share/man/man8
28	install -m 644 x86_energy_perf_policy.8 $(DESTDIR)$(PREFIX)/share/man/man8
29
30