Skip to content

Commit

Permalink
Fixes to makefiles while building (netdata#242)
Browse files Browse the repository at this point in the history
* makefile: dont fail if `rm` cant find any output.

* make tools/complement.sh script executable

* makefile: use KERNELSOURCE and not /usr/src/linux

/usr/src/linux is not always the correct location; it is modifiable by
KERNELSOURCE.
  • Loading branch information
UmanShahzad authored Jul 16, 2021
1 parent c995f8e commit d41e8dd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ $(KERNEL_PROGRAM):
cd $(KERNEL_DIR) && $(MAKE) all;

clean:
rm *.o;
rm -f *.o;
cd $(KERNEL_DIR) && $(MAKE) clean;
rm artifacts/*
rm -f artifacts/*

install:
cp *netdata_ebpf_process.$(VER_MAJOR).$(VER_MINOR).o /usr/libexec/netdata/plugins.d/
8 changes: 4 additions & 4 deletions kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ CLANG_VERSION := $(shell clang --version | grep -o -E 'clang version [0-9]+\.[0-
LLVM_INCLUDES = $(shell [ -d /usr/lib/clang ] && echo "-I/usr/lib/clang/$(CLANG_VERSION)/include" || echo "-I/usr/lib64/clang/$(CLANG_VERSION)/include")
LLVM_INCLUDES += -I/opt/rh/llvm-toolset-7.0/root/usr/lib64/clang/$(CLANG_VERSION)/include

#KERNEL_VERSION="$(shell basename $(realpath /usr/src/linux) | cut -f 2 -d '-')"
KERNEL_VERSION="$(shell cat /usr/src/linux/include/config/kernel.release)"
#KERNEL_VERSION="$(shell basename $(realpath $(KERNELSOURCE)) | cut -f 2 -d '-')"
KERNEL_VERSION="$(shell cat $(KERNELSOURCE)/include/config/kernel.release)"

VER_MAJOR=$(shell echo $(KERNEL_VERSION) | cut -d. -f1)
VER_MINOR=$(shell echo $(KERNEL_VERSION) | cut -d. -f2)
Expand Down Expand Up @@ -54,7 +54,7 @@ NETDATA_APPS= cachestat \
all: $(NETDATA_APPS)

%_kern.o: %_kern.c
if [ -w /usr/src/linux/include/generated/autoconf.h ]; then if [ "$(CURRENT_KERNEL)" -ge 328448 ]; then sed -i -e 's/\(#define CONFIG_CC_HAS_ASM_INLINE 1\)/\/\/\1/' /usr/src/linux/include/generated/autoconf.h; fi ; fi
if [ -w $(KERNELSOURCE)/include/generated/autoconf.h ]; then if [ "$(CURRENT_KERNEL)" -ge 328448 ]; then sed -i -e 's/\(#define CONFIG_CC_HAS_ASM_INLINE 1\)/\/\/\1/' $(KERNELSOURCE)/include/generated/autoconf.h; fi ; fi
$(CLANG) $(EXTRA_CFLAGS) -S -nostdinc $(LINUXINCLUDE) $(LLVM_INCLUDES) \
-D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign \
-Wno-compare-distinct-pointer-types \
Expand Down Expand Up @@ -90,4 +90,4 @@ all: $(NETDATA_APPS)
$(NETDATA_APPS): %: %_kern.o

clean:
rm *.o *.ll
rm -f *.o *.ll
Empty file modified tools/complement.sh
100644 → 100755
Empty file.

0 comments on commit d41e8dd

Please sign in to comment.