redirectionio 3.0.0

Redirection IO Library to handle matching rule, redirect and filtering headers and body.
Documentation
RUST_SOURCES = $(shell find src/ -type f -name '*.rs')

RUST_EXTRA =                        \
        Cargo.toml

EXTRA_DIST += $(RUST_SOURCES) $(RUST_EXTRA)

DESTDIR ?=

MAKE_PID    := $(shell echo $$PPID)
JOB_FLAG    := $(filter -j%, $(subst -j ,-j,$(shell ps T | grep "^\s*$(MAKE_PID).*$(MAKE)")))
JOBS        := $(subst -j,,$(JOB_FLAG))

ifdef JOBS
CARGO_FLAGS=-j $(JOBS)
else
CARGO_FLAGS=
endif

prefix := @prefix@
exec_prefix := @exec_prefix@

all: @RUST_TARGET_DIR@/@RUST_TARGET_SUBDIR@/libredirectionio.a target/redirectionio.h

target/redirectionio.h: $(EXTRA_DIST)
	@CARGO_BIN@ build $(CARGO_FLAGS) --lib @RUST_RELEASE@ --target-dir @RUST_TARGET_DIR@

@RUST_TARGET_DIR@/@RUST_TARGET_SUBDIR@/libredirectionio.a: $(EXTRA_DIST)
	@CARGO_BIN@ build $(CARGO_FLAGS) --lib @RUST_RELEASE@ --target-dir @RUST_TARGET_DIR@

install: @RUST_TARGET_DIR@/@RUST_TARGET_SUBDIR@/libredirectionio.a target/redirectionio.h
	mkdir -p $(DESTDIR)@prefix@/include/
	install -c -m 644 target/redirectionio.h $(DESTDIR)@prefix@/include/
	mkdir -p $(DESTDIR)@libdir@/
	install -c -m 644 @RUST_TARGET_DIR@/@RUST_TARGET_SUBDIR@/libredirectionio.a $(DESTDIR)@libdir@/
	mkdir -p $(DESTDIR)@libdir@/pkgconfig/
	install -c -m 644 libredirectionio.pc $(DESTDIR)@libdir@/pkgconfig/

build-wasm:
	RUSTFLAGS='--cfg getrandom_backend="wasm_js"' wasm-pack build --scope redirection.io --no-default-features --out-dir pkg/wasm --no-pack --release --features wasmbind

.PHONY:	clean
clean:
	rm -f target/redirectionio.h
	rm -f @RUST_TARGET_DIR@/@RUST_TARGET_SUBDIR@/libredirectionio.a
	@CARGO_BIN@ clean --package redirectionio @RUST_RELEASE@

.PHONY:	fullclean
fullclean:
	rm -rf target