1 # SPDX-License-Identifier: GPL-2.0-only 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 3 ifeq ($(srctree),) 3 ifeq ($(srctree),) 4 srctree := $(patsubst %/,%,$(dir $(CUR 4 srctree := $(patsubst %/,%,$(dir $(CURDIR))) 5 srctree := $(patsubst %/,%,$(dir $(src 5 srctree := $(patsubst %/,%,$(dir $(srctree))) 6 srctree := $(patsubst %/,%,$(dir $(src 6 srctree := $(patsubst %/,%,$(dir $(srctree))) 7 endif 7 endif 8 8 9 include $(srctree)/tools/scripts/Makefile.incl 9 include $(srctree)/tools/scripts/Makefile.include 10 10 11 # O is an alias for OUTPUT 11 # O is an alias for OUTPUT 12 OUTPUT := $(O) 12 OUTPUT := $(O) 13 13 14 ifeq ($(OUTPUT),) 14 ifeq ($(OUTPUT),) 15 OUTPUT := $(CURDIR) 15 OUTPUT := $(CURDIR) 16 else 16 else 17 # subdir is used by the ../Makefile in $(cal 17 # subdir is used by the ../Makefile in $(call descend,) 18 ifneq ($(subdir),) 18 ifneq ($(subdir),) 19 OUTPUT := $(OUTPUT)/$(subdir) 19 OUTPUT := $(OUTPUT)/$(subdir) 20 endif 20 endif 21 endif 21 endif 22 22 23 ifneq ($(patsubst %/,,$(lastword $(OUTPUT))),) 23 ifneq ($(patsubst %/,,$(lastword $(OUTPUT))),) 24 OUTPUT := $(OUTPUT)/ 24 OUTPUT := $(OUTPUT)/ 25 endif 25 endif 26 26 27 LATENCY-COLLECTOR := $(OUTPUT)latency-co 27 LATENCY-COLLECTOR := $(OUTPUT)latency-collector 28 LATENCY-COLLECTOR_IN := $(LATENCY-COLLECTOR 28 LATENCY-COLLECTOR_IN := $(LATENCY-COLLECTOR)-in.o 29 29 30 export CC := gcc 30 export CC := gcc 31 export LD := ld 31 export LD := ld 32 export AR := ar 32 export AR := ar 33 export PKG_CONFIG := pkg-config 33 export PKG_CONFIG := pkg-config 34 34 35 FEATURE_TESTS := libtraceevent 35 FEATURE_TESTS := libtraceevent 36 FEATURE_TESTS += libtracefs 36 FEATURE_TESTS += libtracefs 37 FEATURE_DISPLAY := libtraceevent 37 FEATURE_DISPLAY := libtraceevent 38 FEATURE_DISPLAY += libtracefs 38 FEATURE_DISPLAY += libtracefs 39 39 40 ifeq ($(V),1) 40 ifeq ($(V),1) 41 Q = 41 Q = 42 else 42 else 43 Q = @ 43 Q = @ 44 endif 44 endif 45 45 46 all: $(LATENCY-COLLECTOR) 46 all: $(LATENCY-COLLECTOR) 47 47 48 include $(srctree)/tools/build/Makefile.includ 48 include $(srctree)/tools/build/Makefile.include 49 49 50 # check for dependencies only on required targ 50 # check for dependencies only on required targets 51 NON_CONFIG_TARGETS := clean install 51 NON_CONFIG_TARGETS := clean install 52 52 53 config := 1 53 config := 1 54 ifdef MAKECMDGOALS 54 ifdef MAKECMDGOALS 55 ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAK 55 ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),) 56 config := 0 56 config := 0 57 endif 57 endif 58 endif 58 endif 59 59 60 ifeq ($(config),1) 60 ifeq ($(config),1) 61 include $(srctree)/tools/build/Makefile.feat 61 include $(srctree)/tools/build/Makefile.feature 62 include Makefile.config 62 include Makefile.config 63 endif 63 endif 64 64 65 CFLAGS += $(INCLUDES) $(LIB_INCLUDES) 65 CFLAGS += $(INCLUDES) $(LIB_INCLUDES) 66 66 67 export CFLAGS OUTPUT srctree 67 export CFLAGS OUTPUT srctree 68 68 69 $(LATENCY-COLLECTOR): $(LATENCY-COLLECTOR_IN) 69 $(LATENCY-COLLECTOR): $(LATENCY-COLLECTOR_IN) 70 $(QUIET_LINK)$(CC) $(LDFLAGS) -o $(LAT 70 $(QUIET_LINK)$(CC) $(LDFLAGS) -o $(LATENCY-COLLECTOR) $(LATENCY-COLLECTOR_IN) $(EXTLIBS) 71 71 72 latency-collector.%: fixdep FORCE 72 latency-collector.%: fixdep FORCE 73 make -f $(srctree)/tools/build/Makefil 73 make -f $(srctree)/tools/build/Makefile.build dir=. $@ 74 74 75 $(LATENCY-COLLECTOR_IN): fixdep FORCE 75 $(LATENCY-COLLECTOR_IN): fixdep FORCE 76 make $(build)=latency-collector 76 make $(build)=latency-collector 77 77 78 INSTALL := install 78 INSTALL := install 79 MKDIR := mkdir 79 MKDIR := mkdir 80 STRIP := strip 80 STRIP := strip 81 BINDIR := /usr/bin 81 BINDIR := /usr/bin 82 82 83 install: 83 install: 84 @$(MKDIR) -p $(DESTDIR)$(BINDIR) 84 @$(MKDIR) -p $(DESTDIR)$(BINDIR) 85 $(call QUIET_INSTALL,latency-collector 85 $(call QUIET_INSTALL,latency-collector)$(INSTALL) $(LATENCY-COLLECTOR) -m 755 $(DESTDIR)$(BINDIR) 86 @$(STRIP) $(DESTDIR)$(BINDIR)/latency- 86 @$(STRIP) $(DESTDIR)$(BINDIR)/latency-collector 87 87 88 clean: 88 clean: 89 $(call QUIET_CLEAN, latency-collector) 89 $(call QUIET_CLEAN, latency-collector) 90 $(Q)find . -name '*.o' -delete -o -nam 90 $(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete 91 $(Q)@rm -f latency-collector fixdep FE 91 $(Q)@rm -f latency-collector fixdep FEATURE-DUMP 92 $(Q)rm -rf feature 92 $(Q)rm -rf feature 93 .PHONY: FORCE clean install 93 .PHONY: FORCE clean install
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.