-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.in
113 lines (86 loc) · 2.55 KB
/
Makefile.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
ifeq ($(prefix),)
prefix := @prefix@
endif
ifeq ($(V),1)
override V=
else
override V=@
endif
CFLAGS := $(CFLAGS) -std=c99 -Wall -O2 -D_REENTRANT @CFLAGS@
LIBS := $(LIBS) -lpthread -lm -lcrypto -lssl @QUICLIBS@ @TLSLIBS@
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
ifeq (@HAVE_QUIC@,1)
SRC := ${SRC} quic.c
endif
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) @LDFLAGS@
all: $(BIN)
srcdir=.
$(srcdir)/configure: configure.ac
cd '$(srcdir)' && autoconf
# autoheader might not change config.h.in, so touch a stamp file.
$(srcdir)/config.h.in: stamp-h.in
$(srcdir)/stamp-h.in: configure.ac
cd '$(srcdir)' && autoheader
echo timestamp > '$(srcdir)/stamp-h.in'
src/config.h: stamp-h
stamp-h: config.h.in config.status
./config.status
Makefile: Makefile.in config.status
./config.status
config.status: configure
./config.status --recheck
install: wrk
install -d $(DESTDIR)$(prefix)/bin
install -m 755 $< $(DESTDIR)$(prefix)/bin/wrk
uninstall:
rm -f $(DESTDIR)$(prefix)/bin/mygame
clean:
$(RM) $(BIN) obj/*
@$(MAKE) -C deps/luajit clean
$(BIN): $(OBJ)
@echo LINK $(BIN)
$(V)$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
$(OBJ): src/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 $<
$(V)$(CC) $(CFLAGS) -c -o $@ $<
$(LDIR)/libluajit.a:
@echo Building LuaJIT...
@$(MAKE) -C $(LDIR) BUILDMODE=static
.PHONY: all clean uninstall
.SUFFIXES:
.SUFFIXES: .c .o .lua
vpath %.c src
vpath %.h src
vpath %.lua scripts