From 319f10b1f20170adf7efa05938b6bb23584c4729 Mon Sep 17 00:00:00 2001 From: Dave Tang Date: Mon, 22 Jun 2026 20:12:06 +0900 Subject: GNU Make notes --- examples/visual/Makefile | 28 ++++++++++++++++++++++++++++ examples/visual/README.md | 35 +++++++++++++++++++++++++++++++++++ examples/visual/out.png | Bin 0 -> 26851 bytes 3 files changed, 63 insertions(+) create mode 100644 examples/visual/Makefile create mode 100644 examples/visual/README.md create mode 100644 examples/visual/out.png (limited to 'examples/visual') diff --git a/examples/visual/Makefile b/examples/visual/Makefile new file mode 100644 index 0000000..6352ecb --- /dev/null +++ b/examples/visual/Makefile @@ -0,0 +1,28 @@ +# Simple Makefile Example + +# Default target +all: build test clean + +# Build target +build: compile link + @echo "Building the project..." + +# Compile target +compile: init + @echo "Compiling source files..." + +# Link target +link: init + @echo "Linking objects..." + +# Test target +test: build + @echo "Running tests..." + +# Clean target +clean: + @echo "Cleaning up..." + +# Init target (independent target) +init: + @echo "Initializing the build environment..." diff --git a/examples/visual/README.md b/examples/visual/README.md new file mode 100644 index 0000000..f497901 --- /dev/null +++ b/examples/visual/README.md @@ -0,0 +1,35 @@ +# README + +Creates a graph of dependencies from GNU-Make using [make2graph](https://github.com/lindenb/makefile2graph). + +```console +git clone https://github.com/lindenb/makefile2graph.git +cd makefile2graph +make +./make2graph --version +``` +``` +1.5.0 +``` + +Install `graphviz`. + +```console +sudo apt update +sudo apt install -y graphviz +``` + +`make` + +* -B, --always-make + * Unconditionally make all targets. +* -n, --just-print, --dry-run, --recon + * Print the commands that would be executed, but do not execute them (except in certain circumstances). +* -d + * Print debugging information in addition to normal processing. + +```console +make -Bnd | ./make2graph | dot -Tpng -o out.png +``` + +![](out.png) diff --git a/examples/visual/out.png b/examples/visual/out.png new file mode 100644 index 0000000..becc47e Binary files /dev/null and b/examples/visual/out.png differ -- cgit v1.3.1