-.PHONY: all doc install uninstall clean mrpropre mrpropre love debug
+NAME=nsub
-all: bin/nsub
+.PHONY: all build rebuild install uninstall clean mrpropre mrpropre love debug \
+ doc man
+
+all: build
+
+build: bin/nsub
+ @echo Build successful.
+
+rebuild: clean build
doc:
doxygen
-bin/nsub: bin/utils.o
- $(MAKE) -C src -f nsub.d
-
-bin/utils.o:
- $(MAKE) -C src -f utils.d
+man: VERSION README*.md
+ $(MAKE) -f man.d NAME=$(NAME)
love:
@echo " ...not war."
debug:
$(MAKE) DEBUG=1
-clean:
- $(MAKE) -C src -f utils.d clean
- $(MAKE) -C src -f nsub.d clean
-
mrproper: mrpropre
mrpropre: clean
$(MAKE) -C src -f utils.d mrpropre
$(MAKE) -C src -f nsub.d mrpropre
+ rm -f man/man1/*.1 man/*/man1/*.1
+ rmdir man/*/man1 man/* man || true
+ rm -rf doc/html doc/latex doc/man
+ rmdir doc || true
+
+clean:
+ $(MAKE) -C src -f utils.d clean
+ $(MAKE) -C src -f nsub.d clean
install:
$(MAKE) -C src -f nsub.d install
+ @if [ -e "man/man1/$(NAME).1" ]; then \
+ cp -r man/ "$(PREFIX)"/share/; \
+ else \
+ echo "No manual has been built (see \`make man')"; \
+ fi
uninstall:
$(MAKE) -C src -f nsub.d uninstall
+bin/nsub: bin/utils.o
+ $(MAKE) -C src -f nsub.d DEBUG=$(DEBUG)
+
+bin/utils.o:
+ $(MAKE) -C src -f utils.d DEBUG=$(DEBUG)
+
--- /dev/null
+[English](README.md) Français
+
+# NSub
+
+Converti entre les formats Subtitle/Lyrics (webvtt/srt/lrc).
+
+## Synopsis
+
+- `nsub --help`
+- `nsub` (`--from FMT`) (`--to FMT`) (`--apply-offset`) (`IN` (`OUT`))
+- `nsub` (`-f FMT`) (`-t FMT`) (`-o`) (`IN` (`OUT`))
+
+## Description
+
+Ce programme est extrêmement simple.
+Il converti simplement entre les différents formats subtitle/lyrics.
+
+Il ne nécessite pas de librairies externes.
+
+(Bref, j'avais besoin de convertir quelques fichiers et j'ai été surpris de voir que `apt-get install` ne semblait pas connaître ça.)
+
+### Formats supportés
+
+- `LRC` fichiers lyrics : ils accompagnent en général de la musique
+- `SRT` fichiers sous-titres SubRip, ils accompagnent en général des films
+- `WebVTT` Web Video Text Tracks, un nouveau standard W3C
+
+Note : ce programme ne peut pas encore ouvrir des fichiers WebVTT ni SRT (il supporte toutefois les 3 formats en écriture)
+
+## Options
+
+- **--help** (or **-h**) : information sur la syntaxe du programme
+- **--from** (or **-f**) **FMT** : choisi le format d'entrée
+- **--to** (or **-t**) **FMT** : choisi le format de sortie
+- **--apply-offset** (or **-o**) : applique l'offset interne au fichier dans les calcul de temps des paroles
+- **IN** : le fichier source ou '-' pour stdin (défaut)
+- **OUT** : le fichier destination ou '-' pour stdout (défaut)
+
+Note : les formats in/out seront devinés en fonction de l'extension si nécessaire/possible
+Note : pour spécifier un fichier appelé tiret (-), préfixez-le avec un chemin (ex : './-')
+
+### Formats supportés
+
+- **lrc** : fichiers lyrics files
+- **srt** : fichiers sous-titres SubRip
+- **vtt** (ou **webvtt**) : Web Video Text Tracks
+
+## Compilation
+
+Lancez simplement `make`.
+
+Vous pouvez aussi utiliser ces options make :
+
+- `make install PREFIX=/usr/local` : installe le programme dans PREFIX (par défaut, /usr/local)
+- `make uninstall` : désinstalle le programme de PREFIX
+- `make clear` : efface les fichiers temporaires
+- `make mrpropre` : efface les fichiers temporaires mais aussi l'exécutable principal et la documentation
+- `make doc` : génère la documentation Doxygen (`doxygen` est requis)
+- `make man` : génère le manuel (`pandoc` est requis)
+
+## Auteur
+
+NSub a été écrit par Niki Roo <niki@nikiroo.be>
+
-# NSub: Subtitle/Lyrics conversion program (webvtt/srt/lrc)
+English [Français](README-fr.md)
+
+# NSub
+
+Converts between Subtitle/Lyrics formats (webvtt/srt/lrc).
+
+## Synopsis
+
+- `nsub --help`
+- `nsub` (`--from FMT`) (`--to FMT`) (`--apply-offset`) (`IN` (`OUT`))
+- `nsub` (`-f FMT`) (`-t FMT`) (`-o`) (`IN` (`OUT`))
+
+## Description
This program is a very simple thing.
It just converts between different subtitle/lyrics formats.
(I.E., I needed to convert some files and was surprised to see that it was not available via `apt-get install`.)
-Supported formats:
-* `LRC` lyrics files: usually distributed with music
-* `SRT` SubRip subtitle files, usually distributed with films
-* `WebVTT` Web Video Text Tracks, a new W3C standard
+### Supported formats
-Note: this program can not yet open WebVTT nor SRT files (it supports all 3 formats as output, though).
+- `LRC` lyrics files: usually distributed with music
+- `SRT` SubRip subtitle files, usually distributed with films
+- `WebVTT` Web Video Text Tracks, a new W3C standard
-## Compile
+Note: this program can not yet open WebVTT nor SRT files (it supports all 3 formats as output, though)
-Just run `make`.
-You can also use those make targets:
-* `make install`
-* `make uninstall`
-* `make clear`
-* `make mrpropre`
+## Options
-## Syntax
-
-`bin/nsub` (`--from FMT`) (`--to FMT`) (`--apply-offset`) (`IN_FILE` (`OUT_FILE`))
-* **--help** (or **-h**): this help message
-* **--from** (or **-f**) **FMT**: select the input format FMT
-* **--to** (or **-t**) **FMT**: select the output format FMT
-* **--apply-offset** (or **-o**): apply the offset tag value to the lyrics
-* **IN_FILE**: the input file or '-' for stdin (which is the default)
-* **OUT_FILE**: the output file or '-' for stdout (which is the default)
+- **--help** (or **-h**): information about the syntax
+- **--from** (or **-f**) **FMT**: select the input format FMT
+- **--to** (or **-t**) **FMT**: select the output format FMT
+- **--apply-offset** (or **-o**): apply the offset tag value to the lyrics
+- **IN**: the input file or '-' for stdin (which is the default)
+- **OUT**: the output file or '-' for stdout (which is the default)
Note: the in/out formats will be guessed from the extension if needed/possible
Note: to specify a file named dash (-), prefix it with a path (e.g., './-')
-Supported formats:
-* **lrc**: lyrics files
-* **srt**: SubRip subtitles files
-* **vtt** (or **webvtt**): Web Video Text Tracks
+### Supported formats
+
+- **lrc**: lyrics files
+- **srt**: SubRip subtitles files
+- **vtt** (or **webvtt**): Web Video Text Tracks
+
+## Compilation
+
+Just run `make`.
+
+You can also use those make targets:
+
+- `make install PREFIX=/usr/local`: install the program into PREFIX (default is `/usr/local`)
+- `make uninstall`: uninstall the program from the given PREFIX
+- `make clear`: clear the temporary files
+- `make mrpropre`: clear everything, including the main executable and the documentation
+- `make doc`: build the Doxygen documentation (`doxygen` required)
+- `make man`: build the man page (`pandoc` required)
+
+## Author
+
+NSub was written by Niki Roo <niki@nikiroo.be>
--- /dev/null
+# Requires variable: NAME
+
+.PHONY: man
+
+man: README*.md
+ @echo Checking for possible manual pages...
+ @if [ -e README.md ]; then \
+ echo Sources found for man pages; \
+ if pandoc -v >/dev/null 2>&1; then \
+ ls README*.md 2>/dev/null \
+ | grep 'README\(-..\|\)\.md' \
+ | while read man; do \
+ echo " Processing page $$lang..."; \
+ lang="`echo "$$man" \
+ | sed 's:README\.md:en:' \
+ | sed 's:README-\(.*\)\.md:\1:'`"; \
+ mkdir -p man/"$$lang"/man1; \
+ ( \
+ echo ".TH \"${NAME}\" 1 `\
+ date +%Y-%m-%d\
+ ` \"version `cat VERSION`\""; \
+ echo; \
+ UNAME="`echo "${NAME}" \
+ | sed 's:\(.*\):\U\1:g'`"; \
+ ( \
+ cat "$$man" | head -n1 \
+ | sed 's:.*(README\(-fr\|\)\.md).*::g'; \
+ cat "$$man" | tail -n+2; \
+ ) | sed 's:^#\(#.*\):\1:g' \
+ | sed 's:^\(#.*\):\U\1:g;s:# *'"$$UNAME"':# NAME\n'"${NAME}"' \\- :g' \
+ | sed 's:--:——:g' \
+ | pandoc -f markdown -t man | sed 's:——:--:g' ; \
+ ) > man/"$$lang"/man1/"${NAME}.1"; \
+ done; \
+ mkdir -p "man/man1"; \
+ cp man/en/man1/"${NAME}".1 man/man1/; \
+ else \
+ echo "man pages generation: pandoc required" >&2; \
+ false; \
+ fi; \
+ fi;
+
+
CXXFLAGS += -ggdb -O0
endif
-.PHONY: all install uninstall clean mrpropre mrpropre debug
+.PHONY: all install uninstall clean mrpropre mrpropre
all: ../bin/nsub
../bin/nsub: $(SOURCES) $(HEADERS) ../bin/libutils.o
$(CC) $(CFLAGS) $^ -o $@
-debug:
- $(MAKE) -f nsub.d DEBUG=1
-
clean:
rm -f nsub/*.o
mrpropre: clean
rm -f ../bin/nsub
+ rmdir ../bin || true
install:
@echo "installing nsub to $(PREFIX)..."
mkdir -p "$(PREFIX)/bin" \
- && cp ../bin/nsub "$(PREFIX)/bin/" \
+ && cp ../bin/nsub "$(PREFIX)/bin/"
uninstall:
@echo "uninstalling nsub from $(PREFIX)..."
CXXFLAGS += -ggdb -O0
endif
-.PHONY: all install uninstall clean mrpropre mrpropre debug
+.PHONY: all install uninstall clean mrpropre mrpropre
all: ../bin/libutils.o
mkdir -p ../bin
$(LD) --relocatable $(OBJECTS) -o $@
-debug:
- $(MAKE) -f utils.d DEBUG=1
-
clean:
rm -f utils/*.o