Code Monkey home page Code Monkey logo

pymake-demo's Introduction

Python make-like Build System | Yaml-based

This project is for teaching purposes in an Embedded Linux Make/Cmake course to show how Make build system works.

PyMakefile

The input file is a Yaml file, that has the following rules:

  • Attributes with no attributes are parsed as variables, like:
CC: gcc
CFLAGS: -Iinclude -Werror -O2
  • Attributes with sub attributes are parsed as targets, like:
main:
    dep: main.c
    cmd: $(CC) $< -o $@

Targets

  • Targets MUST contain: cmd.
  • dep is optional

You can specify one or multiple commands, like follows:

main:
    dep: main.c
    cmd: |
        echo Compiling main.c
        $(CC) $< -o $@

Variable expansion

Variables in the same format as in Makefile will be expanded from the global variables.

Supported variables for this demo are:

  • $@ : The same target name
  • $^ : Full dependencies list
  • $< : First element of the dependencies list
  • $(): Holds a variable name

Usage

python3 pymake.py --help
  • Example:

Change the absolute path in examples/PyMakefile.yml first. This should be set as $(shell pwd) but it is not implemented.

git clone [email protected]:bhstalel/pymake-demo.git
cd pymake-demo
python3 pymake.py main -C examples/

Limitations

Limitations are same as TODO

TODO

  • Use PyMakeDep class to handle if a command should be executed or not
  • Handle variable expansion recursively
  • Handle file depends
  • Make target argument with default value, if default run first target
  • Add more special characters handling
  • Add @ as first character of the command to ignore printing the command
  • Add feature to test if variable is an env var if not declared in the Yaml file
  • Add feature to declare a function.

Feel free to add what you want.

pymake-demo's People

Contributors

bhstalel avatar

Stargazers

Mohamed Aziz Hassene avatar Mohamed Ali Haoufa avatar Moktar avatar Layla Hmidene avatar Samar Lassoued avatar Aymen Rachdi avatar Samar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.