Skip to content
Browse files

Automatic version-number generation from git describe

  • Loading branch information...
1 parent 709dc6b commit 15e41365a12a12486407384a938306b9a13c2e42 Sound and Fury committed Jul 27, 2010
Showing with 22 additions and 4 deletions.
  1. +1 −0 .gitignore
  2. +2 −0 Makefile
  3. +19 −0 gitversion
  4. +0 −4 version.h
View
1 .gitignore
@@ -2,3 +2,4 @@
quirc
*.o
.quirc-shadow
+version.h
View
2 Makefile
@@ -6,6 +6,7 @@ CFLAGS ?= -Wall
all: quirc
quirc: quirc.c ttyraw.o ttyraw.h ttyesc.o ttyesc.h irc.o irc.h bits.o bits.h numeric.h version.h
+ ./gitversion
$(CC) $(CFLAGS) -o quirc quirc.c ttyraw.o ttyesc.o irc.o bits.o
ttyraw.o: ttyraw.c ttyraw.h
@@ -20,3 +21,4 @@ irc.o: irc.c irc.h
bits.o: bits.c bits.h
$(CC) $(CFLAGS) -o bits.o -c bits.c
+
View
19 gitversion
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+VERSION=$(git describe --tags)
+read MAJOR MINOR REVS GIT <<< ${VERSION//[-.]/ }
+
+cat >version.h <<_EOM
+/*
+ quIRC - simple terminal-based IRC client
+ Copyright (C) 2010 Edward Cree
+
+ See quirc.c for license information
+ version.h: contains version number (generated from git describe)
+*/
+#pragma once
+#define VERSION_MAJ $MAJOR // Major version
+#define VERSION_MIN $MINOR // Minor version
+#define VERSION_REV $REVS // Revision number
+#define VERSION_TXT "$GIT" // Rest of git describe
+_EOM
View
4 version.h
@@ -1,4 +0,0 @@
-#define VERSION_MAJ 0
-#define VERSION_MIN 1
-#define VERSION_REV 0
-#define VERSION_TXT ""

0 comments on commit 15e4136

Please sign in to comment.
Something went wrong with that request. Please try again.