Skip to content

Commit

Permalink
refactor dependencies & bundle openssl
Browse files Browse the repository at this point in the history
  • Loading branch information
wg committed Mar 20, 2016
1 parent 03dc368 commit 29b1848
Show file tree
Hide file tree
Showing 199 changed files with 39 additions and 114,300 deletions.
16 changes: 1 addition & 15 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,2 @@
*.o
*.a
obj/
wrk

deps/luajit/src/host/buildvm
deps/luajit/src/host/buildvm_arch.h
deps/luajit/src/host/minilua
deps/luajit/src/jit/vmdef.lua
deps/luajit/src/lj_bcdef.h
deps/luajit/src/lj_ffdef.h
deps/luajit/src/lj_folddef.h
deps/luajit/src/lj_libdef.h
deps/luajit/src/lj_recdef.h
deps/luajit/src/lj_vm.s
deps/luajit/src/lua/
deps/luajit/src/luajit
45 changes: 34 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CFLAGS := -std=c99 -Wall -O2 -D_REENTRANT
LIBS := -lpthread -lm -lcrypto -lssl
LIBS := -lpthread -lm -lssl -lcrypto

TARGET := $(shell uname -s | tr '[A-Z]' '[a-z]' 2>/dev/null || echo unknown)

Expand All @@ -24,37 +24,60 @@ 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 := -lluajit-5.1 $(LIBS)
CFLAGS += -I$(ODIR)/include
LDFLAGS += -L$(ODIR)/lib
DEPS := $(ODIR)/lib/libluajit-5.1.a $(ODIR)/lib/libssl.a

all: $(BIN)

clean:
$(RM) $(BIN) obj/*
@$(MAKE) -C deps/luajit clean
$(RM) -rf $(BIN) obj/*

$(BIN): $(OBJ)
@echo LINK $(BIN)
@$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)

$(OBJ): config.h Makefile $(LDIR)/libluajit.a | $(ODIR)
$(OBJ): config.h Makefile $(DEPS) | $(ODIR)

$(ODIR):
@mkdir -p $@

$(ODIR)/bytecode.o: src/wrk.lua
@echo LUAJIT $<
@$(SHELL) -c 'cd $(LDIR) && ./luajit -b $(CURDIR)/$< $(CURDIR)/$@'
@$(SHELL) -c 'obj/bin/luajit -b $(CURDIR)/$< $(CURDIR)/$@'

$(ODIR)/%.o : %.c
@echo CC $<
@$(CC) $(CFLAGS) -c -o $@ $<

$(LDIR)/libluajit.a:
# Dependencies

LUAJIT := $(notdir $(patsubst %.tar.gz,%,$(wildcard deps/LuaJIT*.tar.gz)))
OPENSSL := $(notdir $(patsubst %.tar.gz,%,$(wildcard deps/openssl*.tar.gz)))

OPENSSL_OPTS = no-shared no-ssl2 no-psk no-srp no-dtls no-idea --prefix=$(abspath $(ODIR))

$(ODIR)/$(LUAJIT): deps/$(LUAJIT).tar.gz | $(ODIR)
@tar -C $(ODIR) -xf $<

$(ODIR)/$(OPENSSL): deps/$(OPENSSL).tar.gz | $(ODIR)
@tar -C $(ODIR) -xf $<

$(ODIR)/lib/libluajit-5.1.a: $(ODIR)/$(LUAJIT)
@echo Building LuaJIT...
@$(MAKE) -C $(LDIR) BUILDMODE=static
@$(MAKE) -C $< PREFIX=$(abspath $(ODIR)) BUILDMODE=static install

$(ODIR)/lib/libssl.a: $(ODIR)/$(OPENSSL)
@echo Building OpenSSL...
ifeq ($(TARGET), darwin)
@$(SHELL) -c "cd $< && ./Configure $(OPENSSL_OPTS) darwin64-x86_64-cc"
else
@$(SHELL) -c "cd $< && ./config $(OPENSSL_OPTS)"
endif
@$(MAKE) -C $< depend install

# ------------

.PHONY: all clean
.SUFFIXES:
Expand Down
Binary file added deps/LuaJIT-2.0.4.tar.gz
Binary file not shown.
56 changes: 0 additions & 56 deletions deps/luajit/COPYRIGHT

This file was deleted.

151 changes: 0 additions & 151 deletions deps/luajit/Makefile

This file was deleted.

16 changes: 0 additions & 16 deletions deps/luajit/README

This file was deleted.

Loading

0 comments on commit 29b1848

Please sign in to comment.