Debian Codegraph @

tools/tracing/rtla/Makefile.rtla

raw
1 # SPDX-License-Identifier: GPL-2.0-only
2
3 define allow-override
4 $(if $(or $(findstring environment,$(origin $(1))),\
5 $(findstring command line,$(origin $(1)))),,\
6 $(eval $(1) = $(2)))
7 endef
8
9 # Allow setting CC and AR, or setting CROSS_COMPILE as a prefix.
10 $(call allow-override,CC,$(CROSS_COMPILE)gcc)
11 $(call allow-override,AR,$(CROSS_COMPILE)ar)
12 $(call allow-override,STRIP,$(CROSS_COMPILE)strip)
13 $(call allow-override,PKG_CONFIG,pkg-config)
14 $(call allow-override,LD_SO_CONF_PATH,/etc/ld.so.conf.d/)
15 $(call allow-override,LDCONFIG,ldconfig)
16 export CC AR STRIP PKG_CONFIG LD_SO_CONF_PATH LDCONFIG
17
18 FOPTS := -flto=auto -ffat-lto-objects -fexceptions -fstack-protector-strong \
19 -fasynchronous-unwind-tables -fstack-clash-protection
20 WOPTS := -O -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 \
21 -Wp,-D_GLIBCXX_ASSERTIONS
22
23 ifeq ($(CC),clang)
24 FOPTS := $(filter-out -flto=auto -ffat-lto-objects, $(FOPTS))
25 WOPTS := $(filter-out -Wno-maybe-uninitialized, $(WOPTS))
26 endif
27
28 CFLAGS := -g -DVERSION=\"$(VERSION)\" $(FOPTS) $(WOPTS) $(CFLAGS)
29 LDFLAGS := -ggdb $(LDFLAGS)
30
31 RM := rm -rf
32 LN := ln -s
33 INSTALL := install
34 MKDIR := mkdir
35 STRIP := strip
36 BINDIR := /usr/bin
37 CTAGS := ctags
38 ETAGS := ctags -e
39
40 .PHONY: install
41 install: doc_install
42 @$(MKDIR) -p $(DESTDIR)$(BINDIR)
43 $(call QUIET_INSTALL,rtla)$(INSTALL) $(RTLA) -m 755 $(DESTDIR)$(BINDIR)
44 @$(STRIP) $(DESTDIR)$(BINDIR)/rtla
45 @test ! -f $(DESTDIR)$(BINDIR)/osnoise || $(RM) $(DESTDIR)$(BINDIR)/osnoise
46 @$(LN) rtla $(DESTDIR)$(BINDIR)/osnoise
47 @test ! -f $(DESTDIR)$(BINDIR)/hwnoise || $(RM) $(DESTDIR)$(BINDIR)/hwnoise
48 @$(LN) -s rtla $(DESTDIR)$(BINDIR)/hwnoise
49 @test ! -f $(DESTDIR)$(BINDIR)/timerlat || $(RM) $(DESTDIR)$(BINDIR)/timerlat
50 @$(LN) -s rtla $(DESTDIR)$(BINDIR)/timerlat
51
52 .PHONY: tags
53 tags:
54 $(CTAGS) -R --extras=+f --c-kinds=+p src
55
56 .PHONY: TAGS
57 TAGS:
58 $(ETAGS) -R --extras=+f --c-kinds=+p src
59
60 .PHONY: tags_clean
61 tags_clean:
62 $(RM) tags TAGS
63
64 .PHONY: doc doc_clean doc_install
65 doc:
66 $(MAKE) -C $(DOCSRC)
67
68 doc_clean:
69 $(MAKE) -C $(DOCSRC) clean
70
71 doc_install:
72 $(MAKE) -C $(DOCSRC) install
73
74 # This section is necessary to make the rtla tarball
75 NAME := rtla
76 DIRS := src
77 FILES := Makefile README.txt
78 CEXT := bz2
79 TARBALL := $(NAME)-$(VERSION).tar.$(CEXT)
80 TAROPTS := -cvjf $(TARBALL)
81 SRCTREE := $(or $(BUILD_SRC),$(CURDIR))
82
83 tarball: clean
84 $(RM) $(NAME)-$(VERSION) && $(MKDIR) $(NAME)-$(VERSION)
85 echo $(VERSION) > $(NAME)-$(VERSION)/VERSION
86 cp -r $(DIRS) $(FILES) $(NAME)-$(VERSION)
87 $(MKDIR) $(NAME)-$(VERSION)/Documentation/
88 cp -rp $(SRCTREE)/../../../Documentation/tools/$(NAME)/* $(NAME)-$(VERSION)/Documentation/
89 cp Makefile.standalone $(NAME)-$(VERSION)/Makefile
90 cp Makefile.$(NAME) $(NAME)-$(VERSION)/
91 tar $(TAROPTS) --exclude='*~' $(NAME)-$(VERSION)
92 $(RM) $(NAME)-$(VERSION)
93 .PHONY: tarball