Skip to content

Commit

Permalink
generate version from git describe
Browse files Browse the repository at this point in the history
  • Loading branch information
wg committed Mar 20, 2016
1 parent bc6f679 commit 040db59
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ endif
SRC := wrk.c net.c ssl.c aprintf.c stats.c script.c units.c \
ae.c zmalloc.c http_parser.c
BIN := wrk
VER ?= $(shell git describe --tags --always --dirty)

ODIR := obj
OBJ := $(patsubst %.c,$(ODIR)/%.o,$(SRC)) $(ODIR)/bytecode.o
OBJ := $(patsubst %.c,$(ODIR)/%.o,$(SRC)) $(ODIR)/bytecode.o $(ODIR)/version.o
LIBS := -lluajit-5.1 $(LIBS)

DEPS :=
Expand Down Expand Up @@ -61,6 +62,9 @@ $(ODIR)/bytecode.o: src/wrk.lua
@echo LUAJIT $<
@$(SHELL) -c 'PATH=obj/bin:$(PATH) luajit -b $(CURDIR)/$< $(CURDIR)/$@'

$(ODIR)/version.o:
@echo 'const char *VERSION="$(VER)";' | $(CC) -xc -c -o $@ -

$(ODIR)/%.o : %.c
@echo CC $<
@$(CC) $(CFLAGS) -c -o $@ $<
Expand Down Expand Up @@ -94,6 +98,8 @@ endif
# ------------

.PHONY: all clean
.PHONY: $(ODIR)/version.o

.SUFFIXES:
.SUFFIXES: .c .o .lua

Expand Down
3 changes: 2 additions & 1 deletion src/wrk.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
#include "ae.h"
#include "http_parser.h"

#define VERSION "4.0.0"
#define RECVBUF 8192

#define MAX_THREAD_RATE_S 10000000
#define SOCKET_TIMEOUT_MS 2000
#define RECORD_INTERVAL_MS 100

extern const char *VERSION;

typedef struct {
pthread_t thread;
aeEventLoop *loop;
Expand Down

0 comments on commit 040db59

Please sign in to comment.