Skip to content

Commit

Permalink
Improve release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ropery committed Aug 11, 2014
1 parent 1fb649a commit 1aeb619
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 39 deletions.
1 change: 1 addition & 0 deletions .gitattributes
@@ -0,0 +1 @@
.git* export-ignore
6 changes: 6 additions & 0 deletions .gitignore
@@ -1 +1,7 @@
/release/
/TODO
/ffcast
/ffcast.1
/xrectsel
*.o
*~
67 changes: 33 additions & 34 deletions Makefile
@@ -1,51 +1,50 @@
OUT = xrectsel
VERSION = $(shell git describe)
PACKAGE = ffcast
VERSION = 1.0

SRC = ${wildcard *.c}
OBJ = ${SRC:.c=.o}
DISTFILES = Makefile README.asciidoc ffcast.1.pod ffcast.bash xrectsel.c
OUT = xrectsel
SRC = $(wildcard *.c)
OBJ = $(SRC:.c=.o)

PREFIX ?= /usr
MANPREFIX ?= ${PREFIX}/share/man
PREFIX ?= /usr/local
MANPREFIX ?= $(PREFIX)/share/man

CPPFLAGS := -DVERSION=\"${VERSION}\" ${CPPFLAGS}
CFLAGS := --std=c99 -g -pedantic -Wall -Wextra -Wno-variadic-macros ${CFLAGS}
LDFLAGS := -lX11 ${LDFLAGS}
CFLAGS := --std=c99 -g -pedantic -Wall -Wextra -Wno-variadic-macros $(CFLAGS)
CPPFLAGS := -DVERSION=\"$(VERSION)\" $(CPPFLAGS)
LDFLAGS := -lX11 $(LDFLAGS)

all: ${OUT} doc
all: $(OUT) doc ffcast

${OUT}: ${OBJ}
${CC} -o $@ ${OBJ} ${LDFLAGS}
$(OUT): $(OBJ)
$(CC) -o $@ $(OBJ) $(LDFLAGS)

%: %.bash
sed 's/@VERSION@/$(VERSION)/g' <$@.bash >$@ && chmod go-w,+x $@

doc: ffcast.1

ffcast.1: ffcast.1.pod
pod2man --center="FFcast Manual" --name="FFCAST" --release="ffcast ${VERSION}" --section=1 $< > $@
pod2man --center="FFcast Manual" --name="FFCAST" --release="$(PACKAGE) $(VERSION)" --section=1 $< > $@

strip: ${OUT}
strip --strip-all ${OUT}
strip: $(OUT)
strip --strip-all $(OUT)

install: ffcast.1 ffcast.bash xrectsel
install -D -m755 xrectsel ${DESTDIR}${PREFIX}/bin/xrectsel
install -D -m755 ffcast.bash ${DESTDIR}${PREFIX}/bin/ffcast
install -D -m755 ffcast.1 ${DESTDIR}${MANPREFIX}/man1/ffcast.1
install: ffcast ffcast.1 xrectsel
install -D -m755 xrectsel $(DESTDIR)$(PREFIX)/bin/xrectsel
install -D -m755 ffcast $(DESTDIR)$(PREFIX)/bin/ffcast
install -D -m755 ffcast.1 $(DESTDIR)$(MANPREFIX)/man1/ffcast.1

uninstall:
@echo removing executable file from ${DESTDIR}${PREFIX}/bin
rm -f ${DESTDIR}${PREFIX}/bin/xrectsel
rm -f ${DESTDIR}${PREFIX}/bin/ffcast
@echo removing man page from ${DESTDIR}${MANPREFIX}/man1/ffcast.1
rm -f ${DESTDIR}${MANPREFIX}/man1/ffcast.1

dist: clean
mkdir ffcast-${VERSION}
cp ${DISTFILES} ffcast-${VERSION}
sed "s/\(^VERSION *\)= .*/\1= ${VERSION}/" < Makefile > ffcast-${VERSION}/Makefile
sed "s/@VERSION[@]/${VERSION}/g" < ffcast.bash > ffcast-${VERSION}/ffcast.bash
tar czf ffcast-${VERSION}.tar.gz ffcast-${VERSION}
rm -rf ffcast-${VERSION}
@echo removing executable file from $(DESTDIR)$(PREFIX)/bin
rm -f $(DESTDIR)$(PREFIX)/bin/xrectsel
rm -f $(DESTDIR)$(PREFIX)/bin/ffcast
@echo removing man page from $(DESTDIR)$(MANPREFIX)/man1/ffcast.1
rm -f $(DESTDIR)$(MANPREFIX)/man1/ffcast.1

dist:
install -d release
git archive --prefix=$(PACKAGE)-$(VERSION)/ -o release/$(PACKAGE)-$(VERSION).tar.gz $(VERSION)

clean:
${RM} ${OUT} ${OBJ} ffcast.1
$(RM) $(OUT) $(OBJ) ffcast ffcast.1

.PHONY: clean dist doc install uninstall
5 changes: 0 additions & 5 deletions TODO

This file was deleted.

Empty file modified ffcast.bash 100755 → 100644
Empty file.

0 comments on commit 1aeb619

Please sign in to comment.