generate man page during installation

This commit is contained in:
yecheng 2017-11-04 08:52:50 +08:00
parent 8329cdf5b3
commit 034918fbaa
2 changed files with 16 additions and 3 deletions

View File

@ -3,6 +3,7 @@ TARGET=$(shell uname|tr '[A-Z]' '[a-z]')$(shell getconf LONG_BIT)
INCLUDE= INCLUDE=
LIBDIRS= LIBDIRS=
LIBS= LIBS=
MANPAGE=mediaextract.1.gz
PLATFORM=posix PLATFORM=posix
BUILDDIR=build-$(TARGET) BUILDDIR=build-$(TARGET)
OBJ=\ OBJ=\
@ -67,7 +68,7 @@ endif
.PHONY: all clean install uninstall builddir .PHONY: all clean install uninstall builddir
all: $(BIN) all: $(BIN) $(BUILDDIR)/$(MANPAGE)
builddir: $(BUILDDIR) builddir: $(BUILDDIR)
@ -173,7 +174,15 @@ $(BUILDDIR)/text.o: src/text.c src/mediaextract.h src/text.h
$(CC) $(CFLAGS) $< -o $@ -c $(LIBS) $(CC) $(CFLAGS) $< -o $@ -c $(LIBS)
ifeq ($(PLATFORM),posix) ifeq ($(PLATFORM),posix)
install: $(PREFIX)/bin/$(APPNAME) install: $(PREFIX)/bin/$(APPNAME) $(PREFIX)/share/man/man1/$(MANPAGE)
$(BUILDDIR)/$(MANPAGE):src/ManPageIncludeFile
help2man $(BIN) --no-discard-stderr --no-info -n "extracts media files that are embedded within other files" -S "Mathias Panzenböck" -i src/ManPageIncludeFile|sed '/the default set of formats/s/^/.TP\n/'|sed '/the default set of formats/{N;s/.TP//}'|sed -r '/([)]|files)$ /a .TP' >$(BUILDDIR)/$(APPNAME).1
gzip -kf $(BUILDDIR)/$(APPNAME).1
$(PREFIX)/share/man/man1/$(MANPAGE):$(BUILDDIR)/$(APPNAME).1
mkdir -p "$(PREFIX)/share/man/man1/"
install $(BUILDDIR)/$(MANPAGE) "$@"
$(PREFIX)/bin/$(APPNAME): $(BIN) $(PREFIX)/bin/$(APPNAME): $(BIN)
mkdir -p "$(PREFIX)/bin" mkdir -p "$(PREFIX)/bin"
@ -189,4 +198,4 @@ $(BUILDDIR)/recode: src/text.c src/text.h
$(CC) $(CFLAGS) $< -o $@ -DMEDIAEXTRACT_RECODE_BIN $(CC) $(CFLAGS) $< -o $@ -DMEDIAEXTRACT_RECODE_BIN
clean: clean:
rm -f $(BIN) $(OBJ) rm -f $(BUILDDIR)/*

4
src/ManPageIncludeFile Normal file
View File

@ -0,0 +1,4 @@
[REPORTING BUGS]
If you find bugs in mediaextract (or in the man page), please feel free to file a bug report or a pull request: https://github.com/panzi/mediaextract
[AUTHOR]
Mathias Panzenböck