Skip to content

Commit fe085e4

Browse files
authored
Update Makefile
1 parent 18cf0dc commit fe085e4

File tree

1 file changed

+48
-18
lines changed

1 file changed

+48
-18
lines changed

Makefile

+48-18
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,53 @@
1-
default: install
1+
# Makefile for mdBook
22

3-
all: hooks install build
3+
# Variables
4+
MD_BOOK = mdbook
5+
BOOK_NAME = book
6+
BUILD_DIR = book
47

8+
# Default target
9+
.PHONY: all
10+
all: build
511

6-
h help:
7-
@grep '^[a-z]' Makefile
8-
9-
10-
.PHONY: hooks
11-
hooks:
12-
cd .git/hooks && ln -s -f ../../hooks/pre-push pre-push
13-
12+
# Build the book
13+
.PHONY: build
14+
build:
15+
@echo "Building the mdBook..."
16+
$(MD_BOOK) build
17+
18+
# Serve the book locally
19+
.PHONY: serve
20+
serve:
21+
@echo "Serving the mdBook on localhost:3000..."
22+
$(MD_BOOK) serve
23+
24+
# Clean the build artifacts
25+
.PHONY: clean
26+
clean:
27+
@echo "Cleaning up the build directory..."
28+
rm -rf $(BUILD_DIR)
29+
30+
# Update mdBook to the latest version
31+
.PHONY: update
32+
update:
33+
@echo "Updating mdBook to the latest version..."
34+
brew upgrade mdbook
35+
36+
# Install mdBook (if not installed)
37+
.PHONY: install
1438
install:
15-
cargo install mdbook
39+
@echo "Installing mdBook using Homebrew..."
40+
brew install mdbook
41+
42+
# Help message
43+
.PHONY: help
44+
help:
45+
@echo "Makefile for mdBook"
46+
@echo "Usage:"
47+
@echo " make build - Build the mdBook"
48+
@echo " make serve - Serve the book locally"
49+
@echo " make clean - Clean build artifacts"
50+
@echo " make update - Update mdBook to the latest version"
51+
@echo " make install - Install mdBook using Homebrew"
52+
@echo " make help - Display this help message"
1653

17-
18-
s serve:
19-
mdbook serve
20-
21-
22-
build:
23-
mdbook build

0 commit comments

Comments
 (0)