diff --git a/Makefile b/Makefile index cde7fdb..3451e73 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ PREFIX?=/usr/local _INSTDIR=$(DESTDIR)$(PREFIX) BINDIR?=$(_INSTDIR)/bin MANDIR?=$(_INSTDIR)/share/man +PCDIR?=$(_INSTDIR)/lib/pkgconfig OUTDIR=.build HOST_SCDOC=./scdoc .DEFAULT_GOAL=all @@ -43,6 +44,7 @@ install: all install -Dm755 scdoc $(BINDIR)/scdoc install -Dm644 scdoc.1 $(MANDIR)/man1/scdoc.1 install -Dm644 scdoc.5 $(MANDIR)/man5/scdoc.5 + install -Dm644 scdoc.pc $(PCDIR)/scdoc.pc check: scdoc scdoc.1 scdoc.5 @find test -perm -111 -exec '{}' \; diff --git a/include/string.h b/include/str.h similarity index 100% rename from include/string.h rename to include/str.h diff --git a/scdoc.pc b/scdoc.pc new file mode 100644 index 0000000..28312a2 --- /dev/null +++ b/scdoc.pc @@ -0,0 +1,7 @@ +prefix=/usr +exec_prefix=${prefix} +scdoc=${exec_prefix}/bin/scdoc + +Name: scdoc +Description: Man page generator +Version: 1.8.1 diff --git a/src/main.c b/src/main.c index a8f0ea8..a012e3b 100644 --- a/src/main.c +++ b/src/main.c @@ -6,9 +6,10 @@ #include #include #include +#include #include #include -#include "string.h" +#include "str.h" #include "unicode.h" #include "util.h" @@ -686,7 +687,10 @@ static void output_scdoc_preamble(struct parser *p) { } int main(int argc, char **argv) { - if (argc > 1) { + if (argc == 2 && strcmp(argv[1], "-v") == 0) { + printf("scdoc " VERSION "\n"); + return 0; + } else if (argc > 1) { fprintf(stderr, "Usage: scdoc < input.scd > output.roff\n"); return 1; } diff --git a/src/string.c b/src/string.c index ac55394..98bc039 100644 --- a/src/string.c +++ b/src/string.c @@ -1,6 +1,6 @@ #include #include -#include "string.h" +#include "str.h" #include "unicode.h" static int ensure_capacity(str_t *str, size_t len) {