代码拉取完成,页面将自动刷新
CFLAGS := -std=c99 -Wall -O2 -D_REENTRANT
LIBS := -lpthread -lm -lcrypto -lssl
TARGET := $(shell uname -s | tr '[A-Z]' '[a-z]' 2>/dev/null || echo unknown)
ifeq ($(TARGET), sunos)
CFLAGS += -D_PTHREADS -D_POSIX_C_SOURCE=200112L
LIBS += -lsocket
else ifeq ($(TARGET), darwin)
# Per https://luajit.org/install.html: If MACOSX_DEPLOYMENT_TARGET
# is not set then it's forced to 10.4, which breaks compile on Mojave.
export MACOSX_DEPLOYMENT_TARGET = $(shell sw_vers -productVersion)
LDFLAGS += -pagezero_size 10000 -image_base 100000000
LIBS += -L/usr/local/opt/openssl/lib
CFLAGS += -I/usr/local/include -I/usr/local/opt/openssl/include
else ifeq ($(TARGET), linux)
CFLAGS += -D_POSIX_C_SOURCE=200809L -D_BSD_SOURCE
LIBS += -ldl
LDFLAGS += -Wl,-E
else ifeq ($(TARGET), freebsd)
CFLAGS += -D_DECLARE_C99_LDBL_MATH
LDFLAGS += -Wl,-E
endif
SRC := wrk.c net.c ssl.c aprintf.c stats.c script.c units.c \
ae.c zmalloc.c http_parser.c tinymt64.c hdr_histogram.c
BIN := wrk
ODIR := obj
OBJ := $(patsubst %.c,$(ODIR)/%.o,$(SRC)) $(ODIR)/bytecode.o
LDIR = deps/luajit/src
LIBS := -lluajit $(LIBS)
CFLAGS += -I$(LDIR)
LDFLAGS += -L$(LDIR)
all: $(BIN)
clean:
$(RM) $(BIN) obj/*
@$(MAKE) -C deps/luajit clean
$(BIN): $(OBJ)
@echo LINK $(BIN)
@$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
$(OBJ): config.h Makefile $(LDIR)/libluajit.a | $(ODIR)
$(ODIR):
@mkdir -p $@
$(ODIR)/bytecode.o: src/wrk.lua
@echo LUAJIT $<
@$(SHELL) -c 'cd $(LDIR) && ./luajit -b $(CURDIR)/$< $(CURDIR)/$@'
$(ODIR)/%.o : %.c
@echo CC $<
@$(CC) $(CFLAGS) -c -o $@ $<
$(LDIR)/libluajit.a:
@echo Building LuaJIT...
@$(MAKE) -C $(LDIR) BUILDMODE=static
.PHONY: all clean
.SUFFIXES:
.SUFFIXES: .c .o .lua
vpath %.c src
vpath %.h src
vpath %.lua scripts
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。