Merge tag 'kbuild-v5.18-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiro...
[linux-2.6-microblaze.git] / tools / tracing / rtla / Makefile
index 2d52ff0..11fb417 100644 (file)
@@ -1,5 +1,6 @@
 NAME   :=      rtla
-VERSION        :=      0.5
+# Follow the kernel version
+VERSION :=     $(shell cat VERSION 2> /dev/null || make -sC ../../.. kernelversion)
 
 # From libtracefs:
 # Makefiles suck: This macro sets a default value of $(2) for the
@@ -45,7 +46,7 @@ DATADIR       :=      /usr/share
 DOCDIR :=      $(DATADIR)/doc
 MANDIR :=      $(DATADIR)/man
 LICDIR :=      $(DATADIR)/licenses
-SRCTREE        :=      $(if $(BUILD_SRC),$(BUILD_SRC),$(CURDIR))
+SRCTREE        :=      $(or $(BUILD_SRC),$(CURDIR))
 
 # If running from the tarball, man pages are stored in the Documentation
 # dir. If running from the kernel source, man pages are stored in
@@ -59,7 +60,7 @@ endif
 .PHONY:        all
 all:   rtla
 
-rtla: $(OBJ) doc
+rtla: $(OBJ)
        $(CC) -o rtla $(LDFLAGS) $(OBJ) $(LIBS)
 
 static: $(OBJ)
@@ -85,6 +86,7 @@ clean: doc_clean
 
 tarball: clean
        rm -rf $(NAME)-$(VERSION) && mkdir $(NAME)-$(VERSION)
+       echo $(VERSION) > $(NAME)-$(VERSION)/VERSION
        cp -r $(DIRS) $(FILES) $(NAME)-$(VERSION)
        mkdir $(NAME)-$(VERSION)/Documentation/
        cp -rp $(SRCTREE)/../../../Documentation/tools/rtla/* $(NAME)-$(VERSION)/Documentation/