1
0
mirror of https://github.com/wg/wrk synced 2025-02-09 11:32:52 +08:00

generate version from git describe

This commit is contained in:
Will 2016-03-20 17:03:36 +09:00
parent bc6f6797c4
commit 040db59768
2 changed files with 9 additions and 2 deletions

View File

@ -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 :=
@ -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 $@ $<
@ -94,6 +98,8 @@ endif
# ------------
.PHONY: all clean
.PHONY: $(ODIR)/version.o
.SUFFIXES:
.SUFFIXES: .c .o .lua

View File

@ -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;