1
0
mirror of https://github.com/wg/wrk synced 2025-01-09 16:23:04 +08:00
wrk/Makefile

64 lines
1.3 KiB
Makefile
Raw Normal View History

CFLAGS := -std=c99 -Wall -O2 -D_REENTRANT
2013-06-22 14:48:48 +08:00
LIBS := -lpthread -lm -lcrypto -lssl
2013-01-12 15:21:02 +08:00
TARGET := $(shell uname -s | tr [A-Z] [a-z] 2>/dev/null || echo unknown)
ifeq ($(TARGET), sunos)
2013-04-07 13:37:24 +08:00
CFLAGS += -D_PTHREADS -D_POSIX_C_SOURCE=200112L
LIBS += -lsocket
2013-08-18 12:38:06 +08:00
else ifeq ($(TARGET), darwin)
LDFLAGS += -pagezero_size 10000 -image_base 100000000
2013-08-18 19:37:21 +08:00
else ifeq ($(TARGET), linux)
LIBS += -ldl
LDFLAGS += -Wl,-E
else ifeq ($(TARGET), freebsd)
CFLAGS += -D_DECLARE_C99_LDBL_MATH
2013-08-18 12:38:06 +08:00
LDFLAGS += -Wl,-E
2013-01-12 15:21:02 +08:00
endif
2012-03-18 14:16:09 +08:00
2013-08-18 12:38:06 +08:00
SRC := wrk.c net.c ssl.c aprintf.c stats.c script.c units.c \
ae.c zmalloc.c http_parser.c tinymt64.c
2012-03-18 14:16:09 +08:00
BIN := wrk
ODIR := obj
OBJ := $(patsubst %.c,$(ODIR)/%.o,$(SRC))
2013-08-18 12:38:06 +08:00
LDIR = deps/luajit/src
2013-08-18 19:37:21 +08:00
LIBS := -lluajit $(LIBS)
2013-08-18 12:38:06 +08:00
CFLAGS += -I $(LDIR)
2013-08-18 19:37:21 +08:00
LDFLAGS += -L $(LDIR)
2013-08-18 12:38:06 +08:00
2012-03-18 14:16:09 +08:00
all: $(BIN)
clean:
$(RM) $(BIN) obj/*
2013-08-18 12:38:06 +08:00
$(BIN): $(OBJ) $(ODIR)/bytecode.o
@echo LINK $(BIN)
@$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
2012-03-18 14:16:09 +08:00
$(OBJ): config.h Makefile | $(ODIR)
2013-08-18 12:38:06 +08:00
$(ODIR): $(LDIR)/libluajit.a
@mkdir -p $@
$(ODIR)/bytecode.o: scripts/wrk.lua
@echo LUAJIT $<
2013-08-18 19:37:21 +08:00
@$(SHELL) -c 'cd $(LDIR) && ./luajit -b $(PWD)/$< $(PWD)/$@'
2012-03-18 14:16:09 +08:00
$(ODIR)/%.o : %.c
2013-08-18 12:38:06 +08:00
@echo CC $<
@$(CC) $(CFLAGS) -c -o $@ $<
$(LDIR)/libluajit.a:
@echo Building LuaJit...
@$(MAKE) -C $(LDIR) BUILDMODE=static
2012-03-18 14:16:09 +08:00
.PHONY: all clean
.SUFFIXES:
2013-08-18 12:38:06 +08:00
.SUFFIXES: .c .o .lua
2012-03-18 14:16:09 +08:00
2013-08-18 12:38:06 +08:00
vpath %.c src
vpath %.h src
vpath %.lua scripts