Commit ec17b76d authored by Konstantin Khlebnikov's avatar Konstantin Khlebnikov Committed by GitHub

Merge pull request #32 from kolyshkin/makefile

Makefile and man page nitpicks
parents f468aafc 2b4920d5
......@@ -14,11 +14,16 @@ DOCS=README.md LICENSE changelog
SPEC=ioping.spec
PACKAGE=ioping
EXTRA_VERSION:=$(shell test -d .git && git describe --tags --dirty=+ | sed 's/^v[^-]*//;s/-/./g')
VERSION:=$(shell sed -ne 's/\# define VERSION \"\(.*\)\"/\1/p' ioping.c)${EXTRA_VERSION}
GIT_VER:=$(shell test -d .git && git describe --tags --match 'v[0-9]*' \
--abbrev=0 | sed 's/v//')
SRC_VER:=$(shell sed -ne 's/\# define VERSION \"\(.*\)\"/\1/p' ioping.c)
EXTRA_VERSION:=$(shell test -d .git && git describe --tags --match 'v[0-9]*' \
--dirty=+ | sed 's/^v[^-]*//;s/-/./g')
VERSION:=$(SRC_VER)$(EXTRA_VERSION)
DISTDIR=$(PACKAGE)-$(VERSION)
DISTFILES=$(SRCS) $(MANS) $(DOCS) $(SPEC) Makefile
PACKFILES=$(BINARY) $(MANS) $(MANS_F) $(DOCS)
CPPFLAGS+=-DEXTRA_VERSION=\"${EXTRA_VERSION}\"
STRIP=strip
TARGET=$(shell ${CC} -dumpmachine)
......@@ -35,11 +40,18 @@ BINARY:=$(BINARY:=.exe)
LIBS=-lm
endif
all: $(BINARY)
all: checkver $(BINARY)
version:
version: checkver
@echo ${VERSION}
checkver:
@if test -n "$(GIT_VER)" -a "$(GIT_VER)" != "$(SRC_VER)"; then \
echo "ERROR: Version mismatch between git and source"; \
echo git: $(GIT_VER), src: $(SRC_VER); \
exit 1; \
fi
clean:
$(RM) -f $(OBJS) $(BINARY) $(MANS_F) ioping.tmp
......@@ -59,7 +71,7 @@ install: $(BINARY) $(MANS)
install -m 644 $(MANS) $(DESTDIR)$(MAN1DIR)
%.o: %.c
$(CC) $(CFLAGS) $(CPPFLAGS) -DEXTRA_VERSION=\"${EXTRA_VERSION}\" -c -o $@ $<
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
%.ps: %.1
man -t ./$< > $@
......@@ -73,17 +85,17 @@ install: $(BINARY) $(MANS)
$(BINARY): $(OBJS)
$(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS) $(LIBS)
dist: $(DISTFILES)
dist: checkver $(DISTFILES)
tar -cz --transform='s,^,$(DISTDIR)/,S' $^ -f $(DISTDIR).tar.gz
binary-tgz: $(PACKFILES)
binary-tgz: checkver $(PACKFILES)
${STRIP} ${BINARY}
tar -cz --transform='s,^,$(DISTDIR)/,S' -f ${PACKAGE}-${VERSION}-${TARGET}.tgz $^
binary-zip: $(PACKFILES)
binary-zip: checkver $(PACKFILES)
${STRIP} ${BINARY}
ln -s . $(DISTDIR)
zip ${PACKAGE}-${VERSION}-${TARGET}.zip $(addprefix $(DISTDIR)/,$^)
rm $(DISTDIR)
.PHONY: all clean install dist version
.PHONY: all version checkver clean strip test install dist binary-tgz binary-zip
......@@ -63,7 +63,7 @@ Print raw statistics for every \fIperiod\fR requests (see format below).
Print raw statistics for every \fIperiod\fR in time.
.TP
.B \-A
Use asynchronous I/O (syscalls \fBio_submit\fR(2), \fBio_submit\fR(2), etc).
Use asynchronous I/O (\fBio_setup\fR(2), \fBio_submit\fR(2) etc syscalls).
.TP
.B \-B
Batch mode. Be quiet and print final statistics in raw format.
......
......@@ -19,7 +19,7 @@
*/
#ifndef VERSION
# define VERSION "0.9"
# define VERSION "1.0"
#endif
#ifndef EXTRA_VERSION
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment