Skip to main content

pmakefile

Background

Makefile is a fundamental tool when it comes to building software. As a simple way to organize code compilation, it's been part of Unix world for over 40 years. However, it's not a perfect tool. Its cross-platform support is not native yet, and learning curves can be steep. This project aims to provide a practical alternative to Makefile subset for most common use cases.

Software can be reproducible, protable, and maintainable, for regular users and developers, with a simple "P-makefile".

Usage

See the example/ directory where we write a single make in Python using pmakefile and zig cc to cross-compile the QuickJS project for Windows, Linux, and macOS (x86_64 and aarch64), which is a huge task and so far not achieved by any other known makefile written for QuickJS. With pmakefile, writing make promises us excellent portability, static type checking, and simplicity, while depending on only a standard Python distribution.

The pmakefile Python module exports some useful functions, see builtin functions

The pmakefile structure can be given as follows:

from pmakefile import *

phony([
    'all', 'clean', ... # phony targets
])

ROOT = Path(__file__).parent.relative_to(os.getcwd())

@recipe('dep1', 'dep2')
def my_recipe():
    """documentation for my_recipe"""

    # some python statements

Then you can use it in your favorite shell:

pmk help
# pmk all
# pmk clean

Useful Helper Functions

  • get_os() -> 'windows' | 'linux' | 'macos'
  • log(msg: str, level: 'ok' | 'error' | 'info' | 'debug' | 'warn' | 'normal' = 'normal')
  • shell(command: str | list[str], *, env: dict | None = None, noprint: bool = False)
  • get_deps(): get direct dependencies of current target
  • with proft(title: str): ...: profile the execution time of the code block and report with the given title (when the environment variable PMAKEFILE_PROF is set)
  • get_dlext() -> str: get platform-specific dynamic library file extension

License

MIT License is used for this project. See LICENSE for more details.

Metadata

Release files for pmakefile 0.4.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pmakefile 0.4.5
File Size Uploaded
pmakefile-0.4.5.tar.gz 7.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pmakefile 0.4.5
File Interpreter ABI Platform
pmakefile-0.4.5-py3-none-any.whl Python 3 none any Details

Total release size: 15.0 kB

Release files / pmakefile-0.4.5.tar.gz

Download URL pmakefile-0.4.5.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
9c8ec5132b4605d5d8a2770e529b295ee8a40c898317fa40840661e487288f77
BLAKE2b-256 checksum
How to use checksums
4e6359f1f2d2864f8147ab9874091645cdf480fec4ea6bb78bdd96d98601ed3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release files / pmakefile-0.4.5-py3-none-any.whl

Download URL pmakefile-0.4.5-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5f721abd2d96a03959acfb253fc258ecabf2d1fbd03b8171282ac3877a3bb611
BLAKE2b-256 checksum
How to use checksums
bdeb6f3dd550abf22f8c7d9982047f705e596befe7c0af0b96fdccd095dfd885
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.4.5 This release

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page