User:Gszorc/Build frontend shootout
This article examines alternatives to Makefile's for containing mozilla-central's build system definition. See discussion at https://groups.google.com/forum/?fromgroups=#!topic/mozilla.dev.platform/SACOnl-avMs
Goals
We want a frontend language whose output is a giant data structure. The data structure will be consumed by a generator to produce files that actually build the tree.
The produced data structure can come about many different ways. The frontend files themselves could be a data structure (e.g. JSON). They could be scripts that call built-in functions which register elements with the data structure. They could be scripts that populate specific variables whose values are read post execution.
Comparison
Makefile
This is what things would look like in a Makefile.in today in mozilla-central.
DEPTH := @DEPTH@
topsrcdir := @top_srcdir@
srcdir := @srcdir@
VPATH := @srcdir@
include $(DEPTH)/config/autoconf.mk
CPPSRCS := \
foo.cpp \
bar.cpp \
$(NULL)
CXXFLAGS += -DFOO=1
ifneq (,WIN32)
CPPSRCS += win32.cpp
endif
include $(topsrcdir)/config/rules.mk
Python (data oriented)
We use Python as the frontend language. We try to make it is *data oriented* as possible. By that, we mean we value static data structures over function calls.
CPP_SOURCES = ['foo.cpp', 'bar.cpp']
CPP_FLAGS = ['-DFOO=1']
if ENV.WIN32:
CPP_SOURCES += ['win32.cpp']
Python (procedural oriented)
In this flavor of Python, all relevant tasks are done with calls to built-in functions.
CPP_SOURCES('foo.cpp', 'bar.cpp')
CPP_FLAGS('-DFOO=1')
if ENV.WIN32:
CPP_SOURCES('win32.cpp')
SCons
TODO
WAF
TODO
Lua
TODO
GYP
TODO