From 924e8e08605e4a1542cd612c2b25bf4a760d82e9 Mon Sep 17 00:00:00 2001 From: Ansa89 Date: Mon, 25 Aug 2014 12:54:44 +0200 Subject: [PATCH 1/3] Reworked manpage build system --- README.md | 6 +++--- build/Makefile | 17 ++--------------- cfg/checks/av.mk | 4 ++-- cfg/checks/check_features.mk | 6 +++--- cfg/checks/desktop_notifications.mk | 4 ++-- cfg/checks/sound_notifications.mk | 4 ++-- cfg/global_vars.mk | 23 +++++++++++++++++++++++ cfg/targets/doc.mk | 10 ++++++++++ cfg/targets/help.mk | 2 +- cfg/targets/install.mk | 8 +------- doc/Makefile | 12 ------------ 11 files changed, 49 insertions(+), 47 deletions(-) create mode 100644 cfg/global_vars.mk create mode 100644 cfg/targets/doc.mk delete mode 100644 doc/Makefile diff --git a/README.md b/README.md index a741c97..509b2b1 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,9 @@ Toxic is a [Tox](https://tox.im)-based instant messenging client which formerly * [libnotify](https://developer.gnome.org/libnotify) (for Debian based systems, 'libnotify-dev') ##### Documentation -* [Asciidoc](http://asciidoc.org/index.html) Only required for regenerating manpages. -* Run `make` in the doc directory after editing the asciidoc to regenerate the manpages. -* Asciidoc files and generated manpages will need to be commited together. +* [Asciidoc](http://asciidoc.org/index.html) (only required for regenerating manpages) +Run `make doc` after editing the asciidoc files to regenerate the manpages. +**NOTE FOR DEVELOPERS**: asciidoc files and generated manpages will need to be commited together. ### Compiling 1. `cd build/` diff --git a/build/Makefile b/build/Makefile index 3e2de83..7400400 100644 --- a/build/Makefile +++ b/build/Makefile @@ -1,17 +1,7 @@ -TOXIC_VERSION = 0.4.7 -REV = $(shell git rev-list HEAD --count) -VERSION = $(TOXIC_VERSION)_r$(REV) - BASE_DIR = $(shell cd .. && pwd -P) CFG_DIR = $(BASE_DIR)/cfg -DOC_DIR = $(BASE_DIR)/doc -SRC_DIR = $(BASE_DIR)/src -PREFIX = /usr/local -BINDIR = $(PREFIX)/bin -DATADIR = $(PREFIX)/share/toxic -MANDIR = $(PREFIX)/share/man -MANFILES = toxic.1 toxic.conf.5 +-include $(CFG_DIR)/global_vars.mk LIBS = libtoxcore ncursesw libconfig @@ -67,14 +57,11 @@ toxic: $(OBJ) @$(CC) $(CFLAGS) -o $*.o -c $(SRC_DIR)/$*.c @$(CC) -MM $(CFLAGS) $(SRC_DIR)/$*.c > $*.d -doc: $(MANFILES:%=$(DOC_DIR)/%) - clean: rm -rf *.d *.o toxic - rm -rf $(MANFILES) -include $(OBJ:.o=.d) -include $(CFG_DIR)/targets/*.mk -.PHONY: clean all doc +.PHONY: clean all diff --git a/cfg/checks/av.mk b/cfg/checks/av.mk index be18bd2..6de1ce9 100644 --- a/cfg/checks/av.mk +++ b/cfg/checks/av.mk @@ -8,14 +8,14 @@ else endif # Check if we can build audio support -CHECK_AUDIO_LIBS = $(shell pkg-config $(AUDIO_LIBS) || echo -n "error") +CHECK_AUDIO_LIBS = $(shell pkg-config --exists $(AUDIO_LIBS) || echo -n "error") ifneq ($(CHECK_AUDIO_LIBS), error) LIBS += $(AUDIO_LIBS) CFLAGS += $(AUDIO_CFLAGS) OBJ += $(AUDIO_OBJ) else ifneq ($(MAKECMDGOALS), clean) -MISSING_AUDIO_LIBS = $(shell for lib in $(AUDIO_LIBS) ; do if ! pkg-config $$lib ; then echo $$lib ; fi ; done) +MISSING_AUDIO_LIBS = $(shell for lib in $(AUDIO_LIBS) ; do if ! pkg-config --exists $$lib ; then echo $$lib ; fi ; done) $(warning WARNING -- Toxic will be compiled without audio support) $(warning WARNING -- You need these libraries for audio support) $(warning WARNING -- $(MISSING_AUDIO_LIBS)) diff --git a/cfg/checks/check_features.mk b/cfg/checks/check_features.mk index fd1c549..3a5dd50 100644 --- a/cfg/checks/check_features.mk +++ b/cfg/checks/check_features.mk @@ -1,7 +1,7 @@ CHECKS_DIR = $(CFG_DIR)/checks # Check if we can use X11 -CHECK_X11_LIBS = $(shell pkg-config x11 || echo -n "error") +CHECK_X11_LIBS = $(shell pkg-config --exists x11 || echo -n "error") ifneq ($(CHECK_X11_LIBS), error) LIBS += x11 CFLAGS += -D_X11 @@ -26,13 +26,13 @@ ifneq ($(DESK_NOTIFY), disabled) endif # Check if we can build Toxic -CHECK_LIBS = $(shell pkg-config $(LIBS) || echo -n "error") +CHECK_LIBS = $(shell pkg-config --exists $(LIBS) || echo -n "error") ifneq ($(CHECK_LIBS), error) CFLAGS += $(shell pkg-config --cflags $(LIBS)) LDFLAGS += $(shell pkg-config --libs $(LIBS)) else ifneq ($(MAKECMDGOALS), clean) -MISSING_LIBS = $(shell for lib in $(LIBS) ; do if ! pkg-config $$lib ; then echo $$lib ; fi ; done) +MISSING_LIBS = $(shell for lib in $(LIBS) ; do if ! pkg-config --exists $$lib ; then echo $$lib ; fi ; done) $(warning ERROR -- Cannot compile Toxic) $(warning ERROR -- You need these libraries) $(warning ERROR -- $(MISSING_LIBS)) diff --git a/cfg/checks/desktop_notifications.mk b/cfg/checks/desktop_notifications.mk index a3dd0b2..4c805bd 100644 --- a/cfg/checks/desktop_notifications.mk +++ b/cfg/checks/desktop_notifications.mk @@ -3,13 +3,13 @@ DESK_NOTIFY_LIBS = libnotify DESK_NOTIFY_CFLAGS = -D_BOX_NOTIFY # Check if we can build desktop notifications support -CHECK_DESK_NOTIFY_LIBS = $(shell pkg-config $(DESK_NOTIFY_LIBS) || echo -n "error") +CHECK_DESK_NOTIFY_LIBS = $(shell pkg-config --exists $(DESK_NOTIFY_LIBS) || echo -n "error") ifneq ($(CHECK_DESK_NOTIFY_LIBS), error) LIBS += $(DESK_NOTIFY_LIBS) CFLAGS += $(DESK_NOTIFY_CFLAGS) else ifneq ($(MAKECMDGOALS), clean) -MISSING_DESK_NOTIFY_LIBS = $(shell for lib in $(DESK_NOTIFY_LIBS) ; do if ! pkg-config $$lib ; then echo $$lib ; fi ; done) +MISSING_DESK_NOTIFY_LIBS = $(shell for lib in $(DESK_NOTIFY_LIBS) ; do if ! pkg-config --exists $$lib ; then echo $$lib ; fi ; done) $(warning WARNING -- Toxic will be compiled without desktop notifications support) $(warning WARNING -- You need these libraries for desktop notifications support) $(warning WARNING -- $(MISSING_DESK_NOTIFY_LIBS)) diff --git a/cfg/checks/sound_notifications.mk b/cfg/checks/sound_notifications.mk index bb39edd..2db026b 100644 --- a/cfg/checks/sound_notifications.mk +++ b/cfg/checks/sound_notifications.mk @@ -8,14 +8,14 @@ else endif # Check if we can build sound notifications support -CHECK_SND_NOTIFY_LIBS = $(shell pkg-config $(SND_NOTIFY_LIBS) || echo -n "error") +CHECK_SND_NOTIFY_LIBS = $(shell pkg-config --exists $(SND_NOTIFY_LIBS) || echo -n "error") ifneq ($(CHECK_SND_NOTIFY_LIBS), error) LIBS += $(SND_NOTIFY_LIBS) CFLAGS += $(SND_NOTIFY_CFLAGS) OBJ += $(SND_NOTIFY_OBJ) else ifneq ($(MAKECMDGOALS), clean) -MISSING_SND_NOTIFY_LIBS = $(shell for lib in $(SND_NOTIFY_LIBS) ; do if ! pkg-config $$lib ; then echo $$lib ; fi ; done) +MISSING_SND_NOTIFY_LIBS = $(shell for lib in $(SND_NOTIFY_LIBS) ; do if ! pkg-config --exists $$lib ; then echo $$lib ; fi ; done) $(warning WARNING -- Toxic will be compiled without sound notifications support) $(warning WARNING -- You need these libraries for sound notifications support) $(warning WARNING -- $(MISSING_SND_NOTIFY_LIBS)) diff --git a/cfg/global_vars.mk b/cfg/global_vars.mk new file mode 100644 index 0000000..9a7d459 --- /dev/null +++ b/cfg/global_vars.mk @@ -0,0 +1,23 @@ +# Version +TOXIC_VERSION = 0.4.7 +REV = $(shell git rev-list HEAD --count) +VERSION = $(TOXIC_VERSION)_r$(REV) + +# Project directories +DOC_DIR = $(BASE_DIR)/doc +SRC_DIR = $(BASE_DIR)/src +SND_DIR = $(BASE_DIR)/sounds +MISC_DIR = $(BASE_DIR)/misc + +# Project files +MANFILES = toxic.1 toxic.conf.5 +DATAFILES = DHTnodes DNSservers toxic.conf.example +SNDFILES = ContactLogsIn.wav ContactLogsOut.wav Error.wav IncomingCall.wav +SNDFILES += LogIn.wav LogOut.wav NewMessage.wav OutgoingCall.wav +SNDFILES += TransferComplete.wav TransferPending.wav + +# Install directories +PREFIX = /usr/local +BINDIR = $(PREFIX)/bin +DATADIR = $(PREFIX)/share/toxic +MANDIR = $(PREFIX)/share/man diff --git a/cfg/targets/doc.mk b/cfg/targets/doc.mk new file mode 100644 index 0000000..2940009 --- /dev/null +++ b/cfg/targets/doc.mk @@ -0,0 +1,10 @@ +# Doc target +doc: $(MANFILES:%=$(DOC_DIR)/%) + +$(DOC_DIR)/%: $(DOC_DIR)/%.asc + @echo " MAN $(@F)" + @a2x -f manpage -a revdate=$(shell git log -1 --date=short --format="%ad" $<) \ + -a manmanual="toxic manual" -a mansource=toxic \ + -a manversion=__VERSION__ -a datadir=__DATADIR__ $< + +.PHONY: doc diff --git a/cfg/targets/help.mk b/cfg/targets/help.mk index 0eba1b9..518674f 100644 --- a/cfg/targets/help.mk +++ b/cfg/targets/help.mk @@ -1,7 +1,7 @@ # Help target help: @echo "-- Targets --" - @echo " all: Build toxic [DEFAULT]" + @echo " all: Build toxic and documentation [DEFAULT]" @echo " toxic: Build toxic" @echo " doc: Build documentation" @echo " install: Build toxic and install it in PREFIX (default PREFIX is \"$(abspath $(PREFIX))\")" diff --git a/cfg/targets/install.mk b/cfg/targets/install.mk index 6acd0a8..c011cb0 100644 --- a/cfg/targets/install.mk +++ b/cfg/targets/install.mk @@ -1,10 +1,4 @@ -MISC_DIR = $(BASE_DIR)/misc -SND_DIR = $(BASE_DIR)/sounds -DATAFILES = DHTnodes DNSservers toxic.conf.example -SNDFILES = ContactLogsIn.wav ContactLogsOut.wav Error.wav IncomingCall.wav -SNDFILES += LogIn.wav LogOut.wav NewMessage.wav OutgoingCall.wav -SNDFILES += TransferComplete.wav TransferPending.wav - +# Install target install: toxic doc mkdir -p $(abspath $(DESTDIR)/$(BINDIR)) mkdir -p $(abspath $(DESTDIR)/$(DATADIR)) diff --git a/doc/Makefile b/doc/Makefile deleted file mode 100644 index 2d313d2..0000000 --- a/doc/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -MANFILES = toxic.1 toxic.conf.5 - -# Targets -doc: $(MANFILES) - -%: %.asc - @echo " Generating man page $(@F)" - @a2x -f manpage -a revdate=$(shell git log -1 --date=short --format="%ad" $<) \ - -a manmanual="toxic manual" -a mansource=toxic \ - -a manversion=__VERSION__ -a datadir=__DATADIR__ $< - -.PHONY: doc From d6d4476e857b0fb21337b82232acbeaaace3e729 Mon Sep 17 00:00:00 2001 From: Ansa89 Date: Mon, 25 Aug 2014 12:56:14 +0200 Subject: [PATCH 2/3] README.md: better look --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 509b2b1..425132a 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,9 @@ Toxic is a [Tox](https://tox.im)-based instant messenging client which formerly ##### Documentation * [Asciidoc](http://asciidoc.org/index.html) (only required for regenerating manpages) + Run `make doc` after editing the asciidoc files to regenerate the manpages. + **NOTE FOR DEVELOPERS**: asciidoc files and generated manpages will need to be commited together. ### Compiling From 691f94c75c725d65cf46729063b599e19e527ab8 Mon Sep 17 00:00:00 2001 From: Ansa89 Date: Mon, 25 Aug 2014 12:59:34 +0200 Subject: [PATCH 3/3] README.md: second try --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 425132a..8a37688 100644 --- a/README.md +++ b/README.md @@ -24,10 +24,8 @@ Toxic is a [Tox](https://tox.im)-based instant messenging client which formerly ##### Documentation * [Asciidoc](http://asciidoc.org/index.html) (only required for regenerating manpages) - -Run `make doc` after editing the asciidoc files to regenerate the manpages. - -**NOTE FOR DEVELOPERS**: asciidoc files and generated manpages will need to be commited together. + * Run `make doc` after editing the asciidoc files to regenerate the manpages. + * **NOTE FOR DEVELOPERS**: asciidoc files and generated manpages will need to be commited together. ### Compiling 1. `cd build/`