Skip to content

Commit b15943c

Browse files
Patryk Wlazlynlenb
authored andcommitted
tools/power turbostat: Add local build_bug.h header for snapshot target
Fixes compilation errors for Makefile snapshot target described in: commit 231ce08 ("tools/power turbostat: Add "snapshot:" Makefile target") Signed-off-by: Patryk Wlazlyn <[email protected]> Signed-off-by: Len Brown <[email protected]>
1 parent c5120a3 commit b15943c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

tools/power/x86/turbostat/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ turbostat : turbostat.c
1414
override CFLAGS += -O2 -Wall -Wextra -I../../../include
1515
override CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"'
1616
override CFLAGS += -DINTEL_FAMILY_HEADER='"../../../../arch/x86/include/asm/intel-family.h"'
17+
override CFLAGS += -DBUILD_BUG_HEADER='"../../../../include/linux/build_bug.h"'
1718
override CFLAGS += -D_FILE_OFFSET_BITS=64
1819
override CFLAGS += -D_FORTIFY_SOURCE=2
1920

@@ -44,10 +45,13 @@ snapshot: turbostat
4445
@echo "#define GENMASK(h, l) (((~0UL) << (l)) & (~0UL >> (sizeof(long) * 8 - 1 - (h))))" >> $(SNAPSHOT)/bits.h
4546
@echo "#define GENMASK_ULL(h, l) (((~0ULL) << (l)) & (~0ULL >> (sizeof(long long) * 8 - 1 - (h))))" >> $(SNAPSHOT)/bits.h
4647

48+
@echo '#define BUILD_BUG_ON(cond) do { enum { compile_time_check ## __COUNTER__ = 1/(!(cond)) }; } while (0)' > $(SNAPSHOT)/build_bug.h
49+
4750
@echo PWD=. > $(SNAPSHOT)/Makefile
4851
@echo "CFLAGS += -DMSRHEADER='\"msr-index.h\"'" >> $(SNAPSHOT)/Makefile
4952
@echo "CFLAGS += -DINTEL_FAMILY_HEADER='\"intel-family.h\"'" >> $(SNAPSHOT)/Makefile
50-
@sed -e's/.*MSRHEADER.*//' -e's/.*INTEL_FAMILY_HEADER.*//' Makefile >> $(SNAPSHOT)/Makefile
53+
@echo "CFLAGS += -DBUILD_BUG_HEADER='\"build_bug.h\"'" >> $(SNAPSHOT)/Makefile
54+
@sed -e's/.*MSRHEADER.*//' -e's/.*INTEL_FAMILY_HEADER.*//' -e's/.*BUILD_BUG_HEADER.*//' Makefile >> $(SNAPSHOT)/Makefile
5155

5256
@rm -f $(SNAPSHOT).tar.gz
5357
tar cvzf $(SNAPSHOT).tar.gz $(SNAPSHOT)

tools/power/x86/turbostat/turbostat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#define _GNU_SOURCE
1111
#include MSRHEADER
1212
#include INTEL_FAMILY_HEADER
13+
#include BUILD_BUG_HEADER
1314
#include <stdarg.h>
1415
#include <stdio.h>
1516
#include <err.h>
@@ -38,7 +39,6 @@
3839
#include <stdbool.h>
3940
#include <assert.h>
4041
#include <linux/kernel.h>
41-
#include <linux/build_bug.h>
4242

4343
#define UNUSED(x) (void)(x)
4444

0 commit comments

Comments
 (0)