summaryrefslogtreecommitdiff
blob: 595c69ac1572517cf68716136976e70cdda85a31 (plain)
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
diff --git i/Makefile w/Makefile
index d956c6b..48be677 100644
--- i/Makefile
+++ w/Makefile
@@ -1,4 +1,4 @@
-CFLAGS  := -std=c99 -Wall -O2 -D_REENTRANT
+CFLAGS  += -std=c99 -Wall -D_REENTRANT
 LIBS    := -lpthread -lm -lcrypto -lssl
 
 TARGET  := $(shell uname -s | tr '[A-Z]' '[a-z]' 2>/dev/null || echo unknown)
@@ -23,38 +23,31 @@ 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)
+LIBS    := $(shell pkg-config --libs luajit) $(LIBS)
+CFLAGS  += $(shell pkg-config --cflags luajit)
 
 all: $(BIN)
 
 clean:
 	$(RM) $(BIN) obj/*
-	@$(MAKE) -C deps/luajit clean
 
 $(BIN): $(OBJ)
 	@echo LINK $(BIN)
-	@$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
+	@$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
 
-$(OBJ): config.h Makefile $(LDIR)/libluajit.a | $(ODIR)
+$(OBJ): config.h Makefile | $(ODIR)
 
 $(ODIR):
 	@mkdir -p $@
 
 $(ODIR)/bytecode.o: src/wrk.lua
 	@echo LUAJIT $<
-	@$(SHELL) -c 'cd $(LDIR) && ./luajit -b $(CURDIR)/$< $(CURDIR)/$@'
+	@$(SHELL) -c '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