"Fossies" - the Fresh Open Source Software Archive

Member "wrk-4.2.0/Makefile" (7 Feb 2021, 2674 Bytes) of package /linux/www/wrk-4.2.0.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "Makefile": 4.1.0_vs_4.2.0.

    1 CFLAGS  += -std=c99 -Wall -O2 -D_REENTRANT
    2 LIBS    := -lm -lssl -lcrypto -lpthread
    3 
    4 TARGET  := $(shell uname -s | tr '[A-Z]' '[a-z]' 2>/dev/null || echo unknown)
    5 
    6 ifeq ($(TARGET), sunos)
    7 	CFLAGS += -D_PTHREADS -D_POSIX_C_SOURCE=200112L
    8 	LIBS   += -lsocket
    9 else ifeq ($(TARGET), darwin)
   10 	export MACOSX_DEPLOYMENT_TARGET = $(shell sw_vers -productVersion)
   11 else ifeq ($(TARGET), linux)
   12 	CFLAGS  += -D_POSIX_C_SOURCE=200112L -D_BSD_SOURCE -D_DEFAULT_SOURCE
   13 	LIBS    += -ldl
   14 	LDFLAGS += -Wl,-E
   15 else ifeq ($(TARGET), freebsd)
   16 	CFLAGS  += -D_DECLARE_C99_LDBL_MATH
   17 	LDFLAGS += -Wl,-E
   18 endif
   19 
   20 SRC  := wrk.c net.c ssl.c aprintf.c stats.c script.c units.c \
   21 		ae.c zmalloc.c http_parser.c
   22 BIN  := wrk
   23 VER  ?= $(shell git describe --tags --always --dirty)
   24 
   25 ODIR := obj
   26 OBJ  := $(patsubst %.c,$(ODIR)/%.o,$(SRC)) $(ODIR)/bytecode.o $(ODIR)/version.o
   27 LIBS := -lluajit-5.1 $(LIBS)
   28 
   29 DEPS    :=
   30 CFLAGS  += -I$(ODIR)/include
   31 LDFLAGS += -L$(ODIR)/lib
   32 
   33 ifneq ($(WITH_LUAJIT),)
   34 	CFLAGS  += -I$(WITH_LUAJIT)/include
   35 	LDFLAGS += -L$(WITH_LUAJIT)/lib
   36 else
   37 	CFLAGS  += -I$(ODIR)/include/luajit-2.1
   38 	DEPS    += $(ODIR)/lib/libluajit-5.1.a
   39 endif
   40 
   41 ifneq ($(WITH_OPENSSL),)
   42 	CFLAGS  += -I$(WITH_OPENSSL)/include
   43 	LDFLAGS += -L$(WITH_OPENSSL)/lib
   44 else
   45 	DEPS += $(ODIR)/lib/libssl.a
   46 endif
   47 
   48 all: $(BIN)
   49 
   50 clean:
   51 	$(RM) -rf $(BIN) obj/*
   52 
   53 $(BIN): $(OBJ)
   54 	@echo LINK $(BIN)
   55 	@$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
   56 
   57 $(OBJ): config.h Makefile $(DEPS) | $(ODIR)
   58 
   59 $(ODIR):
   60 	@mkdir -p $@
   61 
   62 $(ODIR)/bytecode.c: src/wrk.lua $(DEPS)
   63 	@echo LUAJIT $<
   64 	@$(SHELL) -c 'PATH="obj/bin:$(PATH)" luajit -b "$(CURDIR)/$<" "$(CURDIR)/$@"'
   65 
   66 $(ODIR)/version.o:
   67 	@echo 'const char *VERSION="$(VER)";' | $(CC) -xc -c -o $@ -
   68 
   69 $(ODIR)/%.o : %.c
   70 	@echo CC $<
   71 	@$(CC) $(CFLAGS) -c -o $@ $<
   72 
   73 # Dependencies
   74 
   75 LUAJIT  := $(notdir $(patsubst %.zip,%,$(wildcard deps/LuaJIT*.zip)))
   76 OPENSSL := $(notdir $(patsubst %.tar.gz,%,$(wildcard deps/openssl*.tar.gz)))
   77 
   78 OPENSSL_OPTS = no-shared no-psk no-srp no-dtls no-idea --prefix=$(abspath $(ODIR))
   79 
   80 $(ODIR)/$(LUAJIT): deps/$(LUAJIT).zip | $(ODIR)
   81 	echo $(LUAJIT)
   82 	@unzip -nd $(ODIR) $<
   83 
   84 $(ODIR)/$(OPENSSL): deps/$(OPENSSL).tar.gz | $(ODIR)
   85 	@tar -C $(ODIR) -xf $<
   86 
   87 $(ODIR)/lib/libluajit-5.1.a: $(ODIR)/$(LUAJIT)
   88 	@echo Building LuaJIT...
   89 	@$(MAKE) -C $< PREFIX=$(abspath $(ODIR)) BUILDMODE=static install
   90 	@cd $(ODIR)/bin && ln -s luajit-2.1.0-beta3 luajit
   91 
   92 $(ODIR)/lib/libssl.a: $(ODIR)/$(OPENSSL)
   93 	@echo Building OpenSSL...
   94 	@$(SHELL) -c "cd $< && ./config $(OPENSSL_OPTS)"
   95 	@$(MAKE) -C $< depend
   96 	@$(MAKE) -C $<
   97 	@$(MAKE) -C $< install_sw
   98 	@touch $@
   99 
  100 # ------------
  101 
  102 .PHONY: all clean
  103 .PHONY: $(ODIR)/version.o
  104 
  105 .SUFFIXES:
  106 .SUFFIXES: .c .o .lua
  107 
  108 vpath %.c   src
  109 vpath %.h   src
  110 vpath %.lua scripts