diff options
author | Kieran Bingham <kieran.bingham@ideasonboard.com> | 2022-11-17 20:25:35 +0000 |
---|---|---|
committer | Kieran Bingham <kieran.bingham@ideasonboard.com> | 2022-11-22 12:31:29 +0000 |
commit | 110e59049e73686a145921450c738733c9e79317 (patch) | |
tree | 297fea6a44082d272058ae3cd03496a73967da42 | |
parent | 2619164b6998b2143e776a1c2f10140af9fe878b (diff) |
Makefile: Provide a make wrapper around meson
Provide a convenience wrapper around the build system to allow
auto-complete and simply targets.
'make help' will report the available options.
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rw-r--r-- | Makefile | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2f88df0 --- /dev/null +++ b/Makefile @@ -0,0 +1,55 @@ +ifeq ("$(origin V)", "command line") + VERBOSE = $(V) +endif +ifeq ($(VERBOSE),1) + ninja_args = -v -j1 +endif + +ninja = ninja $(ninja_args) + +all: uvc-gadget + +BUILDDIR=build/ + +.PHONY: help +## MakeHelp: Discovered in gphotos-uploader-cli +help: ## Show this help + @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \ + sort | \ + awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' + +reconfigure: ## Reconfigure the build +reconfigure: RECONFIGURE=--reconfigure + +asan: ## Reconfigure with the address sanitizer enabled +asan: ASAN="-Db_sanitize=address,undefined" +asan: reconfigure + +configure: ## Configure the build +$(BUILDDIR)/build.ninja reconfigure configure: + meson $(BUILDDIR) \ + $(RECONFIGURE) $(ASAN) \ + -Dprefix=/usr + +uvc-gadget: ## Build the uvc-gadget library and application +uvc-gadget: | $(BUILDDIR)/build.ninja + $(ninja) -C $(BUILDDIR) + +.PHONY: test +test: ## Run tests +install: ## Install the package on this system. (Or set DESTDIR) +test install: | $(BUILDDIR)/build.ninja + $(ninja) -C $(BUILDDIR) $* + +iwyu: ## Generate include-what-you-use report + iwyu_tool -p $(BUILDDIR) -j4 > iwyu.report + echo "Generated iwyu.report" + +.PHONY: package +package: ## Install to a temporary package/ directory + mkdir -p package + DESTDIR=$(shell pwd)/package \ + $(ninja) -C $(BUILDDIR) install + +clean: ## Remove build entirely + rm -rf $(BUILDDIR) |