1- .PHONY : build build-dev build-linux build-linux-arm64 clean docs docs-cli docs-local docs-nav install lint local-down local-up test uninstall validate-registry check-licenses check-notice notice
2-
31MODULE_PATH := github.com/mozilla-ai/mcpd/v2
42
53# /usr/local/bin is a common default for user-installed binaries
@@ -32,6 +30,7 @@ BUILDFLAGS := -trimpath
3230# The license types allowed to be imported by the project
3331ALLOWED_LICENSES := Apache-2.0,MIT,BSD-2-Clause,BSD-3-Clause,ZeroBSD,Unlicense
3432
33+ .PHONY : check-licenses
3534check-licenses :
3635 @echo " Checking licenses..."
3736 @go install github.com/google/go-licenses/v2@latest
@@ -43,6 +42,7 @@ check-licenses:
4342 exit 1; \
4443 fi
4544
45+ .PHONY : check-notice
4646check-notice :
4747 @echo " Checking NOTICE..."
4848 @go install github.com/google/go-licenses/v2@latest
@@ -56,87 +56,100 @@ check-notice:
5656 echo " ✓ NOTICE is up to date" ; \
5757 fi
5858
59+ .PHONY : notice
5960notice :
6061 @echo " Generating NOTICE..."
6162 @go install github.com/google/go-licenses/v2@latest
6263 @go-licenses report ./... --ignore github.com/mozilla-ai/mcpd/v2 --template build/licenses/notice.tpl > NOTICE
6364 @echo " ✓ NOTICE generated"
6465
66+ .PHONY : lint
6567lint : check-notice
6668 golangci-lint run --fix -v
6769
70+ .PHONY : test
6871test : lint
6972 go test ./...
7073
74+ .PHONY : validate-registry
7175validate-registry :
7276 @echo " Validating Mozilla AI registry against schema..."
7377 @go run -tags=validate_registry ./tools/validate/registry.go \
7478 internal/provider/mozilla_ai/data/schema.json \
7579 internal/provider/mozilla_ai/data/registry.json
7680
81+ .PHONY : build
7782build : lint
7883 @echo " building mcpd (version: $( VERSION) , commit: $( COMMIT) )..."
7984 @go build $(BUILDFLAGS ) -o mcpd -ldflags=" $( LDFLAGS) " .
8085
86+ .PHONY : build-linux
8187build-linux :
8288 @echo " building mcpd for amd64/linux (version: $( VERSION) , commit: $( COMMIT) )..."
8389 @GOOS=linux GOARCH=amd64 go build $(BUILDFLAGS ) -o mcpd -ldflags=" $( LDFLAGS) " .
8490
91+ .PHONY : build-linux-arm64
8592build-linux-arm64 :
8693 @echo " building mcpd for arm64/linux (version: $( VERSION) , commit: $( COMMIT) )..."
8794 @GOOS=linux GOARCH=arm64 go build $(BUILDFLAGS ) -o mcpd -ldflags=" $( LDFLAGS) " .
8895
8996# For development builds without optimizations (for debugging)
97+ .PHONY : build-dev
9098build-dev :
9199 @echo " building mcpd for development (version: $( VERSION) , commit: $( COMMIT) )..."
92100 @go build -o mcpd -ldflags=" -X '$( MODULE_PATH) /internal/cmd.version=$( VERSION) ' \
93101 -X ' $(MODULE_PATH)/internal/cmd.commit=$(COMMIT)' \
94102 -X ' $(MODULE_PATH)/internal/cmd.date=$(DATE)' " .
95103
104+ .PHONY : install
96105install : build
97106 @# Copy the executable to the install directory
98107 @# Requires sudo if INSTALL_DIR is a system path like /usr/local/bin
99108 @echo " installing mcpd to $( INSTALL_DIR) ..."
100109 @cp mcpd $(INSTALL_DIR ) /mcpd
101110 @chmod +x $(INSTALL_DIR ) /mcpd
102111
112+ .PHONY : clean
103113clean :
104114 @# Remove the built executable and any temporary files
105115 @echo " cleaning up local build artifacts..."
106116 @rm -f mcpd # The executable itself
107117 @rm -rf $(TARGET_PLATFORM ) # Remove any orphaned Docker build directories
108118
119+ .PHONY : uninstall
109120uninstall :
110121 @# Remove the installed executable from the system
111122 @# Requires sudo if INSTALL_DIR is a system path
112123 @echo " uninstalling mcpd from $( INSTALL_DIR) ..."
113124 @rm -f $(INSTALL_DIR ) /mcpd
114125
115126# Runs MkDocs locally
116- docs : docs-local
117-
118- # Runs MkDocs locally
119- docs-local : docs-nav
127+ .PHONY : docs
128+ docs : docs-nav docs-api
120129 @uv venv && \
121130 source .venv/bin/activate && \
122131 uv pip install mkdocs mkdocs-material && \
123132 uv run mkdocs serve
124133
125134# Generates CLI markdown documentation
135+ .PHONY : docs-cli
126136docs-cli :
127137 @go run -tags=docsgen_cli ./tools/docsgen/cmds/main.go
128138 @echo " mcpd CLI command documentation generated"
129139
130140# Generates OpenAPI specification YAML
141+ .PHONY : docs-api
131142docs-api :
132143 @go run -tags=docsgen_api ./tools/docsgen/api/openapi.go
133144 @echo " OpenAPI specification generated"
134145
135146# # Updates mkdocs.yaml nav to match generated CLI docs
147+ .PHONY : docs-nav
136148docs-nav : docs-cli
137149 @go run -tags=docsgen_nav ./tools/docsgen/nav/main.go
138150 @echo " navigation updated for MkDocs site"
139151
152+ .PHONY : local-up
140153local-up : build-linux
141154 @echo " organizing binary for docker build"
142155 @mkdir -p $(TARGET_PLATFORM )
@@ -146,6 +159,7 @@ local-up: build-linux
146159 @echo " cleaning up temporary platform directory"
147160 @rm -rf $(TARGET_PLATFORM )
148161
162+ .PHONY : local-down
149163local-down :
150164 @echo " stopping mcpd container"
151165 @docker compose down
0 commit comments