--- /dev/null
+# Use `make` variables so you can override on the command line:
+# e.g. `make test FEATURES=serde`
+CARGO ?= cargo
+FEATURES ?=
+PROFILE ?= debug # or 'release'
+TARGET_DIR ?= target
+
+ifeq ($(PROFILE),release)
+ BUILD_FLAGS := --release
+else
+ BUILD_FLAGS :=
+endif
+
+ifeq ($(FEATURES),)
+ FEATURE_FLAGS :=
+else
+ FEATURE_FLAGS := --features "$(FEATURES)"
+endif
+
+.PHONY: all build test clean fmt clippy doc ci
+
+# Default: build and test
+all: build test
+
+build:
+ $(CARGO) build $(BUILD_FLAGS) $(FEATURE_FLAGS)
+
+test:
+ $(CARGO) test $(BUILD_FLAGS) $(FEATURE_FLAGS)
+
+clean:
+ $(CARGO) clean
+
+fmt:
+ $(CARGO) fmt
+
+clippy:
+ $(CARGO) clippy $(FEATURE_FLAGS) --all-targets --all-features
+
+doc:
+ $(CARGO) doc --no-deps $(BUILD_FLAGS) $(FEATURE_FLAGS)
+