scdoc2mdoc

A fork of scdoc to output mdoc(7)
git clone git://git.sgregoratto.me/scdoc2mdoc
Log | Files | Refs | README | LICENSE

commit 478ac5bb835982d5e867805da50f06e9d27e3180
parent a7921cae1814bdf9df117c1250814434b6a97bce
Author: Stephen Gregoratto <dev@sgregoratto.me>
Date:   Sat, 15 Jun 2019 17:53:58 +1000

simplify Makefile

- Move all flags & install directories into a user editable config.mk
  file
- Remove unneeded gmakeisms (?=, .PHONY)
- Set the header dependancies for each source file. Done by using the
  builtin .o make rule.
- Use DESTDIR when installing files
- Add a rule to generate a version tarball using `git archive`

Diffstat:
MMakefile | 55+++++++++++++++++++++++++++----------------------------
Aconfig.mk | 4++++
2 files changed, 31 insertions(+), 28 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,47 +1,46 @@ +include config.mk VERSION=1.9.4 -CFLAGS+=-g -DVERSION='"$(VERSION)"' -Wall -Wextra -Werror -Wno-unused-parameter -LDFLAGS+=-static -INCLUDE+=-Iinclude -PREFIX?=/usr/local -_INSTDIR=$(DESTDIR)$(PREFIX) -BINDIR?=$(_INSTDIR)/bin -MANDIR?=$(_INSTDIR)/share/man -PCDIR?=$(_INSTDIR)/lib/pkgconfig -HOST_SCDOC=./scdoc -.DEFAULT_GOAL=all OBJS = main.o string.o utf8.o util.o -main.o: str.h utf8.h util.h -string.o: str.h utf8.h -utf8.o: utf8.h -util.o: utf8.h util.h +all: scdoc scdoc.1 scdoc.5 scdoc.pc scdoc: $(OBJS) - $(CC) $(LDFLAGS) -o $@ $(OBJS) + $(CC) -g -o $@ $(OBJS) -scdoc.1: scdoc.1.scd $(HOST_SCDOC) - $(HOST_SCDOC) < $< > $@ +scdoc.1: scdoc.1.scd scdoc + ./scdoc < scdoc.1.scd > $@ -scdoc.5: scdoc.5.scd $(HOST_SCDOC) - $(HOST_SCDOC) < $< > $@ +scdoc.5: scdoc.5.scd scdoc + ./scdoc < scdoc.5.scd > $@ scdoc.pc: scdoc.pc.in - sed -e 's:@prefix@:$(PREFIX):g' -e 's:@version@:$(VERSION):g' < $< > $@ + sed -e 's:@prefix@:$(PREFIX):g' \ + -e 's:@version@:$(VERSION):g' < scdoc.pc.in > $@ -all: scdoc scdoc.1 scdoc.5 scdoc.pc +main.o: str.h utf8.h util.h +string.o: str.h utf8.h +utf8.o: utf8.h +util.o: utf8.h util.h clean: rm -rf $(OBJS) scdoc scdoc.1 scdoc.5 scdoc.pc install: all - mkdir -p $(BINDIR) $(MANDIR)/man1 $(MANDIR)/man5 $(PCDIR) - install -m755 scdoc $(BINDIR)/scdoc - install -m644 scdoc.1 $(MANDIR)/man1/scdoc.1 - install -m644 scdoc.5 $(MANDIR)/man5/scdoc.5 - install -m644 scdoc.pc $(PCDIR)/scdoc.pc + mkdir -p $(DESTDIR)$(PREFIX)/bin + mkdir -p $(DESTDIR)$(PREFIX)/man/man1 + mkdir -p $(DESTDIR)$(PREFIX)/man/man5 + mkdir -p $(DESTDIR)$(PCDIR) + install -m 0755 scdoc $(DESTDIR)$(PREFIX)/bin/scdoc + install -m 0644 scdoc.1 $(DESTDIR)$(MANDIR)/man1/scdoc.1 + install -m 0644 scdoc.5 $(DESTDIR)$(MANDIR)/man1/scdoc.5 + install -m 0644 scdoc.pc $(DESTDIR)$(PCDIR)/scdoc.pc + +dist: scdoc-$(VERSION).tgz + +scdoc-$(VERSION).tgz: + git archive --prefix "scdoc-$(VERSION)/" $(VERSION) | + gzip > $@ check: scdoc scdoc.1 scdoc.5 @find test -perm -111 -exec '{}' \; - -.PHONY: all clean install check diff --git a/config.mk b/config.mk @@ -0,0 +1,4 @@ +CFLAGS = -g -std=c99 -Wall -Wextra -Werror -Wno-unused-parameter +PREFIX = /usr/local +MANDIR = $(PREFIX)/man +PCDIR = $(PREFIX)/lib/pkgconfig