Skip to content

duzy/smart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

Smart (Simple Make ART) (BETA)

NOTE: The smart project has temporarily gone private and should reopen again in the future, please read here for more information.

Overview

The language is inspired by GNU make. It has a similar syntax to Makefile, but a smart program is highly modularized, multi-dialect (extensible) and data-typed. In a Makefile, there's only a global namespace, macros defined can later be referenced by any other macros or rules. In smart, symbols are contained in a module, and the major modules are projects. A project is designed to be executed in order to update outdated targets, a module is to do more specific tasks and supposed to be used by a project.

A smart module is declared with the keyword module or project. A module can be imported or used by any other module using keywords import or use. Symbols and rules defined in a module can only be accessed within the module scope.

The smart language has some basic data types, this is another important difference comparing to macros in a makefile.

Quick Example

project example

## "posix/thread" is a predefiend module, allowing users to use pthread
## in the project, it's supposed to append values of symbols like CFLAGS, LDFLAGS,
## LIBS, etc. But at the current version, it affects only the `libs` symbol.
use "posix/thread"

LINK = g++
COMPILE = g++ -c
LIBS =

GREETING = "hello, there"

# The default rule, using `shell` dialect to interpret the recipes.
# Note that the `libs` was introduced by the "posix/thread".
foo:[(shell)]: foo.o
	$(LINK) -o $@ $^ $(libs)

# The second `shell` rule to compile the source.
foo.o:[(shell)]: foo.cpp
	$(COMPILE) -o $@ $<

# The `plain` dialect simply expands the recipes into plain text,
# and the `(as text)` tells that the symbol `text` is being used to
# store the plain text. The `,` starts post-execution of the recipes.
foo.cpp:[(plain) (update-file)]:
	#include <iostream>
	int main(int argc, char** argv) {
	    std::cout <<"$(GREETING)" << std::endl;
	    return 0;
	}

check:[(python) (stdout-equals "okay")]:
	print "not okay"

History

The idea of the smart language is originated from the old smart-make project, which is written in pure Makefile to ease building projects having a complex hierarchy. The rationale of smart-make is very similar to the Android build system.

The goal of smart is to supersede make utility (especially in the scenario of modularization and hierarchical building), following the rationale of smart-make and the Android build system.

Why

Build projects with complex hierarchies the easy way!

Releases

No releases published

Packages

No packages published