summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorOtto Kekäläinen <otto@debian.org>2024-01-17 21:10:48 -0800
committerOtto Kekäläinen <otto@debian.org>2024-03-03 15:37:35 -0800
commited68589af16dde7e7c4e1e01f01b0969d2eb0565 (patch)
treec33211d1132b787aec3f38aa63a89ce34cc0998c /Makefile
parentc6fbfd1e27c27cfe89b2e272c0419e57193ea8c5 (diff)
Create man page for btop in Markdown
Create a man page in Markdown format so that it can be read online on GitHub etc and it can be edited much more easily than a raw troff/groff file. Compile it to proper man page format at build-time using 'lowdown' if it is available on the system, otherwise just issue a warning in yellow. Tested to work both with: export VERBOSE=1 make make install make uninstall cmake -B build cmake --build build --verbose While Lowdown is easy to manually install in all modern Linux distros and also Homebrew for Mac, this commit does not add 'lowdown' in any build dependencies or in the CI, that needs to be done separately.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile31
1 files changed, 23 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 03aea89..e489164 100644
--- a/Makefile
+++ b/Makefile
@@ -228,7 +228,7 @@ endif
#? Default Make
.ONESHELL:
-all: | info rocm_smi info-quiet directories config.h btop
+all: | info rocm_smi info-quiet directories btop.1 config.h btop
ifneq ($(QUIET),true)
info:
@@ -249,7 +249,6 @@ info:
@true
endif
-
info-quiet: | info rocm_smi
@printf "\n\033[1;92mBuilding btop++ \033[91m(\033[97mv$(BTOP_VERSION)\033[91m) \033[93m$(PLATFORM) \033[96m$(ARCH)\033[0m\n"
@@ -280,6 +279,15 @@ $(BUILDDIR)/config.h: $(SRCDIR)/config.h.in | directories
@$(VERBOSE) || printf 'sed -e "s|@GIT_COMMIT@|$(GIT_COMMIT)|" -e "s|@CONFIGURE_COMMAND@|$(CONFIGURE_COMMAND)|" -e "s|@COMPILER@|$(CXX)|" -e "s|@COMPILER_VERSION@|$(CXX_VERSION)|" $< | tee $@ > /dev/null\n'
@sed -e "s|@GIT_COMMIT@|$(GIT_COMMIT)|" -e "s|@CONFIGURE_COMMAND@|$(CONFIGURE_COMMAND)|" -e "s|@COMPILER@|$(CXX)|" -e "s|@COMPILER_VERSION@|$(CXX_VERSION)|" $< | tee $@ > /dev/null
+#? Man page
+btop.1: manpage.md | directories
+ifeq ($(shell command -v lowdown >/dev/null; echo $$?),0)
+ @printf "\n\033[1;92mGenerating man page $@\033[37m...\033[0m\n"
+ lowdown -s -Tman -o $@ $<
+else
+ @printf "\n\033[1;93mCommand 'lowdown' not found: skipping generating man page $@\033[0m\n"
+endif
+
#? Clean only Objects
clean:
@printf "\033[1;91mRemoving: \033[1;97mbuilt objects...\033[0m\n"
@@ -311,7 +319,11 @@ install:
@printf "\033[1;92mInstalling SVG icon to: \033[1;97m$(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/btop.svg\n"
@mkdir -p $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps
@cp -p Img/icon.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/btop.svg
-
+ifneq ($(wildcard btop.1),)
+ @printf "\033[1;92mInstalling man page to: \033[1;97m$(DESTDIR)$(PREFIX)/share/man/man1/btop.1\n"
+ @mkdir -p $(DESTDIR)$(PREFIX)/share/man/man1
+ @cp -p btop.1 $(DESTDIR)$(PREFIX)/share/man/man1/btop.1
+endif
#? Set SUID bit for btop as $SU_USER in $SU_GROUP
setuid:
@@ -321,17 +333,20 @@ setuid:
@printf "\033[1;92mSetting SUID bit\033[0m\n"
@chmod u+s $(DESTDIR)$(PREFIX)/bin/btop
+# With 'rm -v' user will see what files (if any) got removed
uninstall:
@printf "\033[1;91mRemoving: \033[1;97m$(DESTDIR)$(PREFIX)/bin/btop\033[0m\n"
- @rm -rf $(DESTDIR)$(PREFIX)/bin/btop
+ @rm -rfv $(DESTDIR)$(PREFIX)/bin/btop
@printf "\033[1;91mRemoving: \033[1;97m$(DESTDIR)$(PREFIX)/share/btop\033[0m\n"
- @rm -rf $(DESTDIR)$(PREFIX)/share/btop
+ @rm -rfv $(DESTDIR)$(PREFIX)/share/btop
@printf "\033[1;91mRemoving: \033[1;97m$(DESTDIR)$(PREFIX)/share/applications/btop.desktop\033[0m\n"
- @rm -rf $(DESTDIR)$(PREFIX)/share/applications/btop.desktop
+ @rm -rfv $(DESTDIR)$(PREFIX)/share/applications/btop.desktop
@printf "\033[1;91mRemoving: \033[1;97m$(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/btop.png\033[0m\n"
- @rm -rf $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/btop.png
+ @rm -rfv $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/btop.png
@printf "\033[1;91mRemoving: \033[1;97m$(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/btop.svg\033[0m\n"
- @rm -rf $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/btop.svg
+ @rm -rfv $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/btop.svg
+ @printf "\033[1;91mRemoving: \033[1;97m$(DESTDIR)$(PREFIX)/share/man/man1/btop.1\033[0m\n"
+ @rm -rfv $(DESTDIR)$(PREFIX)/share/man/man1/btop.1
#? Pull in dependency info for *existing* .o files
-include $(OBJECTS:.$(OBJEXT)=.$(DEPEXT))