make0
make0 是一個純 Python 實作的 Makefile 建置工具,完全不依賴系統的 make,透過直接呼叫 shell 來執行 recipe。
特色
- ✅ 解析標準 Makefile 語法
- ✅ 變數展開(
=,:=,?=,+=,!=) - ✅ 自動變數:
$@,$<,$^,$?,$*,$+ - ✅
.PHONY偽目標 - ✅ 檔案時間戳記比較(判斷是否需要重建)
- ✅ Recipe 前綴:
@(靜音)、-(忽略錯誤)、+(強制執行) - ✅ 內建函式:
wildcard,shell,notdir,dir,basename,suffix,subst,patsubst,filter,strip,word,words,firstword,lastword - ✅
include指令 - ✅ Dry-run 模式 (
-n) - ✅ 彩色輸出
安裝
chmod +x make0.py
# 或直接用 python3 執行
python3 make0.py
用法
make0 [選項] [target ...]
選項:
-f FILE 指定 Makefile(預設: Makefile)
-n Dry-run,只印出命令不執行
-s 靜音模式,不印出 recipe 命令
-p 印出解析後的變數與規則資料庫
-l 列出所有 target
-C DIR 切換至 DIR 目錄後再執行
-e 環境變數覆蓋 Makefile 變數
--var VAR=VAL 覆蓋特定變數
範例
pip install --upgrade make0
# 建置預設 target
make
# 建置多個 targets
make all clean
# 使用指定 Makefile
make -f Makefile.demo greet
# Dry-run
make -n all
# 列出所有 target
make -l
# 印出解析的資料庫
make -p
# 覆蓋變數
make --var CC=clang all
Makefile 語法支援
| 語法 | 說明 |
|---|---|
VAR = val |
遞迴展開(lazy) |
VAR := val |
立即展開 |
VAR ?= val |
僅在未定義時設定 |
VAR += val |
附加 |
VAR != cmd |
Shell 命令輸出 |
$(VAR) |
變數引用 |
$(shell cmd) |
執行 shell |
$(wildcard *.c) |
萬用字元 |
.PHONY: t |
宣告偽目標 |
$@ |
目標名稱 |
$< |
第一個 prerequisite |
$^ |
所有 prerequisites(去重) |
$? |
比目標新的 prerequisites |
@cmd |
靜音執行 |
-cmd |
忽略錯誤 |
Metadata
Release files for make0 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| make0-0.3.0.tar.gz | 8.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| make0-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.4 kB
Release files / make0-0.3.0.tar.gz
| Download URL | make0-0.3.0.tar.gz |
|---|---|
| Size | 8.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0efce61a26daa077b4e394e58632d689e06911412aa27d56cafa29a00186331d
|
|
BLAKE2b-256 checksum How to use checksums |
f03af22f3849688fbaa17b9f7de9ad2d12eeba26db6b4a54cdec47ddea4ac388
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / make0-0.3.0-py3-none-any.whl
| Download URL | make0-0.3.0-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
313f265f8245e43caf441ec19f8dfe8d58f4fdb76ffd6fdc9322d41224b15c08
|
|
BLAKE2b-256 checksum How to use checksums |
49469f250937d984c7c827479eb214119b30576d906725bb217ead975d8a0dc9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Security for make0 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.