Initial snapshot

This commit is contained in:
Mercier Pierre-Olivier 2013-02-11 22:04:30 +01:00
commit fee4dd4e6d
373 changed files with 62144 additions and 0 deletions

41
environment/Makefile Normal file
View file

@ -0,0 +1,41 @@
##
## licence kaneton licence
##
## project kaneton
##
## file /home/buckman/kaneton/environment/Makefile
##
## created julien quintard [fri feb 11 02:59:20 2005]
## updated matthieu bucchianeri [tue jan 24 11:42:31 2006]
##
#
# ---------- dependencies -----------------------------------------------------
#
include env.mk
#
# ---------- directives -------------------------------------------------------
#
.PHONY: main initialize clean clear prototypes headers
#
# ---------- rules ------------------------------------------------------------
#
main: initialize
initialize:
$(call env_launch,$(_ENVIRONMENT_DIR_)/initialize.py,,)
clean:
$(call env_launch,$(_ENVIRONMENT_DIR_)/clean.py,,)
clear:
$(call env_purge,)
prototypes:
headers:

Binary file not shown.

138
environment/clean.py Normal file
View file

@ -0,0 +1,138 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kaneton/environment/clean.py
#
# created julien quintard [sat dec 16 20:57:38 2006]
# updated julien quintard [mon apr 20 03:33:17 2009]
#
#
# ---------- imports ----------------------------------------------------------
#
import os
import env
#
# ---------- functions --------------------------------------------------------
#
#
# machine()
#
# this function removes the links to the machine dependent files
# and directories.
#
def machine():
env.display(env.HEADER_OK,
"removing links to machine-dependent directories",
env.OPTION_NONE)
env.remove(env._GLUE_CURRENT_, env.OPTION_NONE)
env.remove(env._ARCHITECTURE_CURRENT_, env.OPTION_NONE)
env.remove(env._PLATFORM_CURRENT_, env.OPTION_NONE)
#
# clear()
#
# this function clears the kaneton development tree.
#
def clear():
env.display(env.HEADER_OK,
"clearing the kaneton development tree",
env.OPTION_NONE)
env.launch(env._SOURCE_DIR_ + "/Makefile", "clear", env.OPTION_QUIET)
#
# boot()
#
# this function removes everything that has been generated
# for booting the kernel like images and so forth.
#
def boot():
if env.path(env._IMAGE_, env.OPTION_EXIST):
env.remove(env._IMAGE_, env.OPTION_NONE)
#
# dependencies()
#
# this function removes the kaneton dependencies.
#
def dependencies():
dependencies = None
dep = None
env.display(env.HEADER_OK,
"removing the kaneton header dependencies",
env.OPTION_NONE)
dependencies = env.search(env._SOURCE_DIR_,
env._DEPENDENCY_MK_,
env.OPTION_FILE | env.OPTION_RECURSIVE)
for dep in dependencies:
env.remove(dep, env.OPTION_NONE)
#
# clean()
#
# the function removes the generated kaneton development environment files.
#
def clean():
env.remove(env._ENV_MK_, env.OPTION_NONE)
env.remove(env._ENV_PY_, env.OPTION_NONE)
#
# main()
#
# this function initializes the development environment.
#
import sys
def main():
# display some stuff.
env.display(env.HEADER_OK,
"cleaning the kaneton development environment",
env.OPTION_NONE)
# clear the kaneton development tree.
clear()
# remove the generated boot stuff.
boot()
# uninstall the chosen machine.
machine()
# generate the kaneton dependencies.
dependencies()
# remove the environment-specific files.
clean()
# display some stuff.
env.display(env.HEADER_OK,
"environment development cleaned successfully",
env.OPTION_NONE)
#
# ---------- entry point ------------------------------------------------------
#
if __name__ == "__main__":
main()

426
environment/critical.py Normal file
View file

@ -0,0 +1,426 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kaneton/environment/critical.py
#
# created julien quintard [fri dec 15 13:43:03 2006]
# updated julien quintard [fri dec 17 20:00:58 2010]
#
#
# ---------- imports ----------------------------------------------------------
#
import os
import sys
import re
#
# ---------- globals ----------------------------------------------------------
#
g_directories = None
g_contents = None
g_assignments = []
g_variables = {}
#
# ---------- functions --------------------------------------------------------
#
#
# error()
#
# this function displays an error and quit.
#
def error(message):
sys.stderr.write("[!] " + message)
sys.exit(42)
#
# warning()
#
# this function simply displays an error.
#
def warning(msg):
sys.stderr.write("[!] " + msg)
#
# load()
#
# this function takes an arbitray number of directories where pattern
# files could be located and load them in a single python string.
#
def load(directories, pattern):
content = ""
directory = None
includes = None
include = None
handle = None
files = None
line = None
file = None
cwd = None
for directory in directories:
if not os.path.isdir(directory):
continue
files = os.listdir(directory);
for file in files:
if not os.path.isfile(directory + "/" + file):
continue
if not re.match(pattern, file):
continue
try:
handle = open(directory + "/" + file, "r")
except IOError:
error("unable to open the file " + directory + "/" + file + ".\n")
for line in handle.readlines():
content += line
content += "\n"
includes = re.findall("(" \
"^" \
"include" \
"[ \t]*" \
"(.*)" \
"\n" \
")", content, re.MULTILINE);
for include in includes:
content = content.replace(include[0],
load([os.path.dirname(directory +
"/" +
include[1])],
"^" +
os.path.basename(directory +
"/" +
include[1]) +
"$"))
handle.close()
return content
#
# comments()
#
# this function removes the comments from the file
#
def comments():
global g_contents
comments = None
c = None
comments = re.findall("^#.*$", g_contents, re.MULTILINE);
for c in comments:
g_contents = g_contents.replace(c, "", 1)
#
# locate()
#
# this function tries to locate the variable of the given array and
# return the corresponding tuple.
#
def locate(array, variable):
var = None
for var in array:
if variable == var[0]:
return var
return None
#
# extract()
#
# this function extracts the variables assignments from the environment
# configuration files previously loaded.
#
def extract():
global g_assignments
assignments = None
assignment = None
already = None
new = None
assignments = re.findall("^" \
"[ \t]*" \
"([a-zA-Z0-9_]+)" \
"[ \t]*" \
"(\+?=)" \
"[ \t]*" \
"((?:(?:\\\\\n)|[^\n])*)" \
"\n", g_contents, re.MULTILINE);
for assignment in assignments:
# look for a previous registered assignment.
already = locate(g_assignments, assignment[0])
if already:
# if it is an assignment, just override the previous declaration.
if assignment[1] == "=":
new = (assignment[0], assignment[2])
# if it is a concatenation, override the previous one with a
# concatenation of the two values.
elif assignment[1] == "+=":
new = (assignment[0], already[1] + " " + assignment[2])
else:
error("unknown assignment token '" + assignment[1] + "' for the "
"variable '" + assignment[0] + "'.\n")
# remove and insert the new tuple.
g_assignments.remove(already)
g_assignments.append(new)
else:
if assignment[1] == "=":
# simple insert the tuple.
new = (assignment[0], assignment[2])
g_assignments.append(new)
elif assignment[1] == "+=":
error("appending to the undefined variable '" + assignment[0] +
"' is not allowed.\n")
else:
error("unknown assignment token '" + assignment[1] + "' for the "
"variable '" + assignment[0] + "'.\n")
#
# expand()
#
# this function tries to expand the given variable.
#
def expand(name, stack):
variables = None
position = None
tuple = None
value = None
var = None
# try to get the variable's value from the already expanded variables.
try:
value = g_variables[name]
return
except:
# check if the variable was declared somewhere.
tuple = locate(g_assignments, name)
if not tuple:
warning("the kaneton environment variable " + name +
" is not defined\n")
value = ""
else:
value = tuple[1]
# check recursion assignments.
try:
position = stack.index(name)
except:
pass
if position != None:
error("the kaneton environment variable " + name +
" recursively references itself.\n")
# locate, expand and replace the kaneton variables.
variables = re.findall("\$\{([^}]+)\}", value)
if variables:
for var in variables:
expand(var, stack + [name])
for var in variables:
value = value.replace("${" + var + "}", g_variables[var])
# locate, expand and replace the shell variables.
variables = re.findall("\$\(([^}]+)\)", value)
if variables:
for var in variables:
if os.getenv(var) == None:
warning("shell user variable " + var + " is not defined\n")
value = value.replace("$(" + var + ")", "")
else:
value = value.replace("$(" + var + ")", os.getenv(var))
# finally register the new variable with its expanded value.
g_variables[name] = value
#
# resolve()
#
# this function resolves the variable assignments.
def resolve():
for assignment in g_assignments:
expand(assignment[0], [])
#
# generate()
#
# this function generates the kaneton development environment files.
#
def generate(mfile, mcontent, pfile, pcontent):
mhandle = None
phandle = None
line = None
var = None
# open the make environment file.
try:
mhandle = open(mfile, "w")
except IOError:
error("unable to open the file " + mfile + ".\n")
# open the python environment file.
try:
phandle = open(pfile, "w")
except IOError:
error("unable to open the file " + pfile + ".\n")
# inject the kaneton environment configuration for the make and python
# environment.
for var in g_variables:
mhandle.write(var + " := " + g_variables[var] + "\n")
phandle.write(var + " = " + "\"" + g_variables[var] + "\"" + "\n")
# append the make environment files to the make environment file.
mhandle.write(mcontent)
# append the python environment files to the python environment file.
phandle.write(pcontent)
# close the files.
phandle.close()
mhandle.close()
#
# main()
#
# this function builds a kaneton development environment.
#
def main():
global g_directories
global g_contents
architecture = None
source_dir = None
platform = None
contents = None
machine = None
python = None
host = None
user = None
# get the shell environment variables.
user = os.getenv("KANETON_USER")
host = os.getenv("KANETON_HOST")
python = os.getenv("KANETON_PYTHON")
platform = os.getenv("KANETON_PLATFORM")
architecture = os.getenv("KANETON_ARCHITECTURE")
# check the presence of the shell environment variable.
if not (user != None and
os.path.isdir("profile/user/" + user)):
error("the shell environment variable KANETON_USER is not set " + \
"or is incorrect.\n")
if not (python != None and
os.path.isfile(python)):
error("the shell environment variable KANETON_PYTHON is not set " + \
"or is incorrect.\n")
if not (platform != None and
os.path.isdir("profile/kaneton/machine/platform/" + platform)):
error("the shell environment variable KANETON_PLATFORM is not " + \
"set or is incorrect.\n")
if not (architecture != None and
os.path.isdir("profile/kaneton/machine/architecture/" + architecture)):
error("the shell environment variable KANETON_ARCHITECTURE is " + \
"not set or is incorrect.\n")
if not (host != None and
os.path.isdir("profile/host/" + host + "." + architecture)):
error("the shell environment variable KANETON_HOST or " + \
"KANETON_ARCHITECTURE is not set or is incorrect.\n")
# set the configuration directories based on the user variables.
g_directories = ("profile/",
"profile/host/",
"profile/host/" + host + "." + architecture + "/",
"profile/boot/",
"profile/boot/" + platform + "." + architecture + "/",
"profile/kaneton/",
"profile/kaneton/core/",
"profile/kaneton/machine/",
"profile/kaneton/machine/platform/",
"profile/kaneton/machine/platform/" + platform + "/",
"profile/kaneton/machine/architecture/",
"profile/kaneton/machine/architecture/" + \
architecture + "/",
"profile/kaneton/machine/glue/",
"profile/kaneton/machine/glue/" + platform + "." + \
architecture + "/",
"profile/kaneton/library/",
"profile/kaneton/modules/",
"profile/user/",
"profile/user/" + user + "/")
# first, set a virtual kaneton variable containing the location of
# the kaneton source directory.
# this directory is expected to be relatively located at: ../
# since this script should have been launched in the environment/
# directory
cwd = os.getcwd()
os.chdir("..")
source_dir = os.getcwd()
os.chdir(cwd)
# load the content of the configuration files *.conf.
g_contents = "_SOURCE_DIR_ = " + source_dir + "\n"
g_contents += load(g_directories, "^.*\.conf$")
# removes the comments
comments()
# extract the assignments from the files.
extract()
# resolve the variables in assignments.
resolve()
# generate the development environment files.
generate("env.mk", load(g_directories, "^.*\.mk$"),
"env.py", load(g_directories, "^.*\.py$"))
#
# ---------- entry point ------------------------------------------------------
#
main()

BIN
environment/critical.pyc Normal file

Binary file not shown.

168
environment/initialize.py Normal file
View file

@ -0,0 +1,168 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kaneton/environment/initialize.py
#
# created julien quintard [fri dec 15 13:43:03 2006]
# updated julien quintard [thu feb 10 19:24:31 2011]
#
#
# ---------- imports ----------------------------------------------------------
#
import critical
import env
import sys
import time
#
# ---------- functions --------------------------------------------------------
#
#
# warning()
#
# this function displays the current configuration.
#
def warning():
env.display(env.HEADER_NONE, "", env.OPTION_NONE)
env.display(env.HEADER_OK, "configuration:", env.OPTION_NONE)
env.display(env.HEADER_OK,
" user: " + env._USER_,
env.OPTION_NONE)
env.display(env.HEADER_OK,
" host: " + env._HOST_,
env.OPTION_NONE)
env.display(env.HEADER_OK,
" platform: " + env._PLATFORM_,
env.OPTION_NONE)
env.display(env.HEADER_OK,
" architecture: " + env._ARCHITECTURE_,
env.OPTION_NONE)
env.display(env.HEADER_NONE, "", env.OPTION_NONE)
#
# machine()
#
# this function installs the links to the glue, platform and architecture
# dependent files and directories.
def machine():
env.display(env.HEADER_OK,
"installing links to machine-dependent directories",
env.OPTION_NONE)
env.remove(env._GLUE_CURRENT_, env.OPTION_NONE)
env.link(env._GLUE_CURRENT_, env._GLUE_DIR_, env.OPTION_NONE)
env.remove(env._PLATFORM_CURRENT_, env.OPTION_NONE)
env.link(env._PLATFORM_CURRENT_, env._PLATFORM_DIR_, env.OPTION_NONE)
env.remove(env._ARCHITECTURE_CURRENT_, env.OPTION_NONE)
env.link(env._ARCHITECTURE_CURRENT_, env._ARCHITECTURE_DIR_, env.OPTION_NONE)
#
# check()
#
# this function looks for every binary the behaviour profile needs to work
# properly.
#
def check():
binaries = None
binary = None
env.display(env.HEADER_OK,
"looking for programs needed by the development environment",
env.OPTION_NONE)
binaries = env._BINARIES_.split(",")
for binary in binaries:
binary = binary.replace('\t', ' ')
binary = binary.strip()
binary = binary.split(' ')
if env.locate(binary[0], env.OPTION_NONE) != 0:
env.display(env.HEADER_ERROR,
" the program " + binary[0] + " is not present " \
"on your system",
env.OPTION_NONE)
#
# prototypes()
#
# this function generates the kaneton prototypes.
#
def prototypes():
useless = None
env.display(env.HEADER_OK,
"generating the kaneton prototypes",
env.OPTION_NONE)
env.launch(env._SOURCE_DIR_ + "/Makefile", "prototypes", env.OPTION_QUIET)
#
# headers()
#
# this function generates the kaneton header dependencies.
#
def headers():
env.display(env.HEADER_OK,
"generating the kaneton header dependencies",
env.OPTION_NONE)
env.launch(env._SOURCE_DIR_ + "/Makefile", "headers", env.OPTION_QUIET)
#
# main()
#
# this function initializes the development environment.
#
def main():
# display some stuff.
env.display(env.HEADER_OK,
"installing the kaneton development environment",
env.OPTION_NONE)
# display the current configuration and ask the user to continue.
warning()
# install the chosen machine: platform/architecture.
machine()
# check the presence of the binaries used by the behaviour profile.
check()
# generate the kaneton prototypes.
prototypes()
# generate the kaneton headers.
headers()
# display some stuff.
env.display(env.HEADER_OK,
"environment development installed successfully",
env.OPTION_NONE)
#
# ---------- entry point ------------------------------------------------------
#
if __name__ == "__main__":
main()

View file

@ -0,0 +1,76 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kaneton/environment/profile/boot/boot.conf
#
# created julien quintard [tue may 8 11:00:40 2007]
# updated julien quintard [tue may 5 10:16:49 2009]
#
#
# ---------- information ------------------------------------------------------
#
# this file declares the default boot variables which should be overriden
# by the user profile.
#
#
# ---------- multi-bootloader -------------------------------------------------
#
_MBL_SCRIPT_ = <null>
_BOOT_MODE_ = <null>
_BOOT_DEVICE_ = <null>
#
# ---------- network ----------------------------------------------------------
#
_ADDRESS_ = <null>
#
# ---------- tftp server ------------------------------------------------------
#
_TFTP_ADDRESS_ = <null>
_TFTP_DIRECTORY_ = <null>
#
# ---------- devices ----------------------------------------------------------
#
_UDEVICE_ = <null>
_MDEVICE_ = <null>
_IMAGE_ = ${_PROFILE_USER_DIR_}/${_USER_}.img
#
# ---------- inputs ----------------------------------------------------------
#
# the inputs are additional files such as boot-time servers, configuration
# files.
#
_INPUTS_ =
#
# ---------- components -------------------------------------------------------
#
# this variable contains the list of the components to build.
#
_COMPONENT_FIRMWARE_ =
_COMPONENT_LOADER_ = ${_LOADER_}
_COMPONENT_KANETON_ = ${_KANETON_}
_COMPONENTS_ = ${_COMPONENT_FIRMWARE_} \
${_COMPONENT_LOADER_} \
${_COMPONENT_KANETON_} \
${_INPUTS_}

View file

@ -0,0 +1,23 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kaneton/environment/profile/user/boot.desc
#
# created julien quintard [tue may 8 13:00:28 2007]
# updated julien quintard [tue jun 26 15:20:39 2007]
#
#
# ---------- information ------------------------------------------------------
#
# XXX
#
# XXX
#
# _BOOT_MODE_ = { peripheral, network, image }
# _BOOT_DEVICE = { floppy, hard-drive }

View file

@ -0,0 +1,348 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kaneton/environment/profile/environment.conf
#
# created julien quintard [fri dec 15 13:50:15 2006]
# updated julien quintard [wed feb 9 05:33:19 2011]
#
#
# ---------- information ------------------------------------------------------
#
# this file contains the default environment configuration including
# kaneton directories, librarires, script, tools etc. locations.
#
#
# ---------- signature --------------------------------------------------------
#
_SIGNATURE_ = kaneton
#
# ---------- shell environment variables --------------------------------------
#
_USER_ = $(KANETON_USER)
_HOST_ = $(KANETON_HOST)
_PYTHON_ = $(KANETON_PYTHON)
_PLATFORM_ = $(KANETON_PLATFORM)
_ARCHITECTURE_ = $(KANETON_ARCHITECTURE)
#
# ---------- source directory -------------------------------------------------
#
_BOOT_DIR_ = ${_SOURCE_DIR_}/boot
_CHEAT_DIR_ = ${_SOURCE_DIR_}/cheat
_CONFIGURE_DIR_ = ${_SOURCE_DIR_}/configure
_ENVIRONMENT_DIR_ = ${_SOURCE_DIR_}/environment
_EXPORT_DIR_ = ${_SOURCE_DIR_}/export
_HISTORY_DIR_ = ${_SOURCE_DIR_}/history
_KANETON_DIR_ = ${_SOURCE_DIR_}/kaneton
_LICENSE_DIR_ = ${_SOURCE_DIR_}/license
_SAMPLE_DIR_ = ${_SOURCE_DIR_}/sample
_TEST_DIR_ = ${_SOURCE_DIR_}/test
_TOOL_DIR_ = ${_SOURCE_DIR_}/tool
_TRANSCRIPT_DIR_ = ${_SOURCE_DIR_}/transcript
_VIEW_DIR_ = ${_SOURCE_DIR_}/view
#
# ---------- boot directory ---------------------------------------------------
#
_BOOT_STRAP_DIR_ = ${_BOOT_DIR_}/strap
_BOOT_LOADER_DIR_ = ${_BOOT_DIR_}/loader
_LOADER_DIR_ = ${_BOOT_LOADER_DIR_}/${_PLATFORM_}.${_ARCHITECTURE_}
#
# ---------- kaneton directory ------------------------------------------------
#
_CORE_DIR_ = ${_KANETON_DIR_}/core
_MACHINE_DIR_ = ${_KANETON_DIR_}/machine
_LIBRARY_DIR_ = ${_KANETON_DIR_}/library
_MODULES_DIR_ = ${_KANETON_DIR_}/modules
_INCLUDE_DIR_ = ${_KANETON_DIR_}/include
#
# ---------- core directory ---------------------------------------------------
#
_CORE_AS_DIR_ = ${_CORE_DIR_}/as
_CORE_CAPABILITY_DIR_ = ${_CORE_DIR_}/capability
_CORE_CLOCK_DIR_ = ${_CORE_DIR_}/clock
_CORE_CPU_DIR_ = ${_CORE_DIR_}/cpu
_CORE_EVENT_DIR_ = ${_CORE_DIR_}/event
_CORE_ID_DIR_ = ${_CORE_DIR_}/id
_CORE_INCLUDE_DIR_ = ${_CORE_DIR_}/include
_CORE_INTERFACE_DIR_ = ${_CORE_DIR_}/interface
_CORE_IO_DIR_ = ${_CORE_DIR_}/io
_CORE_KERNEL_DIR_ = ${_CORE_DIR_}/kernel
_CORE_MAP_DIR_ = ${_CORE_DIR_}/map
_CORE_MESSAGE_DIR_ = ${_CORE_DIR_}/message
_CORE_REGION_DIR_ = ${_CORE_DIR_}/region
_CORE_SCHEDULER_DIR_ = ${_CORE_DIR_}/scheduler
_CORE_SEGMENT_DIR_ = ${_CORE_DIR_}/segment
_CORE_SET_DIR_ = ${_CORE_DIR_}/set
_CORE_TASK_DIR_ = ${_CORE_DIR_}/task
_CORE_THREAD_DIR_ = ${_CORE_DIR_}/thread
_CORE_TIMER_DIR_ = ${_CORE_DIR_}/timer
#
# ---------- machine directory ------------------------------------------------
#
_MACHINE_GLUE_DIR_ = ${_MACHINE_DIR_}/glue
_MACHINE_ARCHITECTURE_DIR_ = ${_MACHINE_DIR_}/architecture
_MACHINE_PLATFORM_DIR_ = ${_MACHINE_DIR_}/platform
_MACHINE_INCLUDE_DIR_ = ${_MACHINE_DIR_}/include
#
# ---------- library directory ------------------------------------------------
#
_LIBRARY_INCLUDE_DIR_ = ${_LIBRARY_DIR_}/include
#
# ---------- modules directory ------------------------------------------------
#
_MODULES_INCLUDE_DIR_ = ${_MODULES_DIR_}/modules
#
# ---------- glue directory ---------------------------------------------------
#
_GLUE_DIR_ = ${_MACHINE_GLUE_DIR_}/${_PLATFORM_}.${_ARCHITECTURE_}
_GLUE_INCLUDE_DIR_ = ${_GLUE_DIR_}/include
#
# ---------- platform directory -----------------------------------------------
#
_PLATFORM_DIR_ = ${_MACHINE_PLATFORM_DIR_}/${_PLATFORM_}
_PLATFORM_INCLUDE_DIR_ = ${_PLATFORM_DIR_}/include
#
# ---------- architecture directory -------------------------------------------
#
_ARCHITECTURE_DIR_ = ${_MACHINE_ARCHITECTURE_DIR_}/${_ARCHITECTURE_}
_ARCHITECTURE_INCLUDE_DIR_ = ${_ARCHITECTURE_DIR_}/include
#
# ---------- kaneton library objects ------------------------------------------
#
_CORE_LO_ = ${_CORE_DIR_}/core.lo
_MACHINE_LO_ = ${_MACHINE_DIR_}/machine.lo
_LIBRARY_LO_ = ${_LIBRARY_DIR_}/library.lo
_MODULES_LO_ = ${_MODULES_DIR_}/modules.lo
_GLUE_LO_ = ${_GLUE_DIR_}/glue.lo
_ARCHITECTURE_LO_ = ${_ARCHITECTURE_DIR_}/architecture.lo
_PLATFORM_LO_ = ${_PLATFORM_DIR_}/platform.lo
#
# ---------- current selected machine -----------------------------------------
#
_GLUE_CURRENT_ = ${_MACHINE_GLUE_DIR_}/.current
_ARCHITECTURE_CURRENT_ = ${_MACHINE_ARCHITECTURE_DIR_}/.current
_PLATFORM_CURRENT_ = ${_MACHINE_PLATFORM_DIR_}/.current
#
# ---------- environment directory --------------------------------------------
#
_PROFILE_DIR_ = ${_ENVIRONMENT_DIR_}/profile
#
# ---------- profile directory ------------------------------------------------
#
_PROFILE_BOOT_DIR_ = ${_PROFILE_DIR_}/boot
_PROFILE_HOST_DIR_ = ${_PROFILE_DIR_}/host/${_HOST_}.${_ARCHITECTURE_}
_PROFILE_KANETON_DIR_ = ${_PROFILE_DIR_}/kaneton
_PROFILE_USER_DIR_ = ${_PROFILE_DIR_}/user/${_USER_}
_PROFILE_CORE_DIR_ = ${_PROFILE_KANETON_DIR_}/core
_PROFILE_LIBRARY_DIR_ = ${_PROFILE_KANETON_DIR_}/library
_PROFILE_MACHINE_DIR_ = ${_PROFILE_KANETON_DIR_}/machine
_PROFILE_MODULES_DIR_ = ${_PROFILE_KANETON_DIR_}/modules
_PROFILE_GLUE_DIR_ = ${_PROFILE_MACHINE_DIR_}/glue/${_PLATFORM_}.${_ARCHITECTURE_}
_PROFILE_PLATFORM_DIR_ = ${_PROFILE_MACHINE_DIR_}/platform/${_PLATFORM_}
_PROFILE_ARCHITECTURE_DIR_ = ${_PROFILE_MACHINE_DIR_}/architecture/${_ARCHITECTURE_}
#
# ---------- view directory ---------------------------------------------------
#
_BIBLIOGRAPHY_DIR_ = ${_VIEW_DIR_}/bibliography
_BOOK_DIR_ = ${_VIEW_DIR_}/book
_EXAM_DIR_ = ${_VIEW_DIR_}/exam
_FEEDBACK_DIR_ = ${_VIEW_DIR_}/feedback
_FIGURES_DIR_ = ${_VIEW_DIR_}/figures
_INTERNSHIP_DIR_ = ${_VIEW_DIR_}/internship
_LECTURE_DIR_ = ${_VIEW_DIR_}/lecture
_LOGO_DIR_ = ${_VIEW_DIR_}/logo
_PACKAGE_DIR_ = ${_VIEW_DIR_}/package
_PAPER_DIR_ = ${_VIEW_DIR_}/paper
_TALK_DIR_ = ${_VIEW_DIR_}/talk
_TEMPLATE_DIR_ = ${_VIEW_DIR_}/template
#
# ---------- layouts ----------------------------------------------------------
#
_LAYOUT_DIR_ = ${_GLUE_DIR_}/layout
_KERNEL_LAYOUT_ = ${_LAYOUT_DIR_}/kernel.lyt
_DRIVER_LAYOUT_ = ${_LAYOUT_DIR_}/driver.lyt
_SERVICE_LAYOUT_ = ${_LAYOUT_DIR_}/service.lyt
_GUEST_LAYOUT_ = ${_LAYOUT_DIR_}/guest.lyt
#
# ---------- tool directory ---------------------------------------------------
#
_CTC_DIR_ = ${_TOOL_DIR_}/ctc
_FIRMWARE_DIR_ = ${_TOOL_DIR_}/firmware/${_PLATFORM_}.${_ARCHITECTURE_}
_MBL_DIR_ = ${_TOOL_DIR_}/mbl
_MKP_DIR_ = ${_TOOL_DIR_}/mkp
_SCRIPT_DIR_ = ${_TOOL_DIR_}/script
#
# ---------- core library-objects ---------------------------------------------
#
_AS_LO_ = ${_CORE_AS_DIR_}/as.lo
_CAPABILITY_LO_ = ${_CORE_CAPABILITY_DIR_}/capability.lo
_CLOCK_LO_ = ${_CORE_CLOCK_DIR_}/clock.lo
_CPU_LO_ = ${_CORE_CPU_DIR_}/cpu.lo
_EVENT_LO_ = ${_CORE_EVENT_DIR_}/event.lo
_ID_LO_ = ${_CORE_ID_DIR_}/id.lo
_INTERFACE_LO_ = ${_CORE_INTERFACE_DIR_}/interface.lo
_IO_LO_ = ${_CORE_IO_DIR_}/io.lo
_KERNEL_LO_ = ${_CORE_KERNEL_DIR_}/kernel.lo
_MAP_LO_ = ${_CORE_MAP_DIR_}/map.lo
_MESSAGE_LO_ = ${_CORE_MESSAGE_DIR_}/message.lo
_REGION_LO_ = ${_CORE_REGION_DIR_}/region.lo
_SCHEDULER_LO_ = ${_CORE_SCHEDULER_DIR_}/scheduler.lo
_SEGMENT_LO_ = ${_CORE_SEGMENT_DIR_}/segment.lo
_SET_LO_ = ${_CORE_SET_DIR_}/set.lo
_TASK_LO_ = ${_CORE_TASK_DIR_}/task.lo
_THREAD_LO_ = ${_CORE_THREAD_DIR_}/thread.lo
_TIMER_LO_ = ${_CORE_TIMER_DIR_}/timer.lo
#
# ---------- binaries ---------------------------------------------------------
#
_LOADER_ = ${_LOADER_DIR_}/loader
_KANETON_ = ${_KANETON_DIR_}/kaneton
#
# ---------- environment files ------------------------------------------------
#
_ENV_MK_ = ${_ENVIRONMENT_DIR_}/env.mk
_ENV_PY_ = ${_ENVIRONMENT_DIR_}/env.py
#
# ---------- tools ------------------------------------------------------------
#
_CTC_BUILD_TOOL_ = ${_CTC_DIR_}/buildctf
_CTC_GATHER_TOOL_ = ${_CTC_DIR_}/enhashctf
_CTC_COMPARE_TOOL_ = ${_CTC_DIR_}/ctcompare
_CTC_SHOW_TOOL_ = ${_CTC_DIR_}/showkeys
_CTC_DETOK_TOOL_ = ${_CTC_DIR_}/detok
_MKP_TOOL_ = ${_MKP_DIR_}/mkp.py
_REPLAY_TOOL_ = ${_SCRIPT_DIR_}/scriptreplay.pl
#
# ---------- test -------------------------------------------------------------
#
_TEST_CLIENT_DIR_ = ${_TEST_DIR_}/client
_TEST_CONFIGURATION_DIR_ = ${_TEST_DIR_}/configuration
_TEST_ENGINE_DIR_ = ${_TEST_DIR_}/engine
_TEST_PACKAGES_DIR_ = ${_TEST_DIR_}/packages
_TEST_SERVER_DIR_ = ${_TEST_DIR_}/server
_TEST_STORE_DIR_ = ${_TEST_DIR_}/store
_TEST_SUITES_DIR_ = ${_TEST_DIR_}/suites
_TEST_TESTS_DIR_ = ${_TEST_DIR_}/tests
_TEST_UTILITIES_DIR_ = ${_TEST_DIR_}/utilities
_TEST_SUITES_DIR_ = ${_TEST_DIR_}/suites
_TEST_HOOKS_DIR_ = ${_TEST_DIR_}/hooks
_TEST_TESTS_BOOT_DIR_ = ${_TEST_TESTS_DIR_}/boot
_TEST_TESTS_KANETON_DIR_ = ${_TEST_TESTS_DIR_}/kaneton
_TEST_ENGINE_LO_ = ${_TEST_ENGINE_DIR_}/engine.lo
_TEST_STORE_CAPABILITY_DIR_ = ${_TEST_STORE_DIR_}/capability
_TEST_STORE_CERTIFICATE_DIR_ = ${_TEST_STORE_DIR_}/certificate
_TEST_STORE_CODE_DIR_ = ${_TEST_STORE_DIR_}/code
_TEST_STORE_DATABASE_DIR_ = ${_TEST_STORE_DIR_}/database
_TEST_STORE_KEY_DIR_ = ${_TEST_STORE_DIR_}/key
_TEST_STORE_REPORT_DIR_ = ${_TEST_STORE_DIR_}/report
_TEST_STORE_BUNDLE_DIR_ = ${_TEST_STORE_DIR_}/bundle/${_PLATFORM_}.${_ARCHITECTURE_}
_TEST_STORE_SNAPSHOT_DIR_ = ${_TEST_STORE_DIR_}/snapshot
_TEST_STORE_BUNDLE_BOOT_LO_ = ${_TEST_STORE_BUNDLE_DIR_}/boot.lo
_TEST_STORE_BUNDLE_KANETON_LO_ = ${_TEST_STORE_BUNDLE_DIR_}/kaneton.lo
_TEST_CLIENT_SCRIPT_ = ${_TEST_CLIENT_DIR_}/client.py
_TEST_SERVER_SCRIPT_ = ${_TEST_SERVER_DIR_}/server.py
_TEST_CAPABILITY_SCRIPT_ = ${_TEST_UTILITIES_DIR_}/capability.py
_TEST_CERTIFICATE_SCRIPT_ = ${_TEST_UTILITIES_DIR_}/certificate.py
_TEST_CODE_SCRIPT_ = ${_TEST_UTILITIES_DIR_}/code.py
_TEST_DATABASE_SCRIPT_ = ${_TEST_UTILITIES_DIR_}/database.py
_TEST_INVENTORY_SCRIPT_ = ${_TEST_UTILITIES_DIR_}/inventory.py
#
# ---------- scripts ----------------------------------------------------------
#
_INITIALIZE_SCRIPT_ = ${_ENVIRONMENT_DIR_}/initialize.py
_CLEAN_SCRIPT_ = ${_ENVIRONMENT_DIR_}/clean.py
_CONFIGURE_SCRIPT_ = ${_CONFIGURE_DIR_}/configure.py
_EXPORT_SCRIPT_ = ${_EXPORT_DIR_}/export.py
_CHEAT_SCRIPT_ = ${_CHEAT_DIR_}/cheat.py
_RECORD_SCRIPT_ = ${_TRANSCRIPT_DIR_}/record.py
_PLAY_SCRIPT_ = ${_TRANSCRIPT_DIR_}/play.py
_VIEW_SCRIPT_ = ${_VIEW_DIR_}/view.py
#
# ---------- makefile dependency file -----------------------------------------
#
_DEPENDENCY_MK_ = .dependency.mk
#
# ---------- latex dependency file --------------------------------------------
#
_DEPENDENCY_TEX_ = .dependency.tex
#
# ---------- python package directories ---------------------------------------
#
_PYTHON_INCLUDE_DIR_ = ${_ENVIRONMENT_DIR_}:${_TEST_PACKAGES_DIR_}

View file

@ -0,0 +1,113 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kane...ironment/profile/host/darwin/darwin.conf
#
# created julien quintard [tue may 8 13:19:52 2007]
# updated julien quintard [fri may 1 02:11:38 2009]
#
#
# ---------- information ------------------------------------------------------
#
# this file contains the libraries, binaries, script and tools related to
# the generic darwin host sub-profile.
#
#
# ---------- includes ---------------------------------------------------------
#
_INCLUDES_ = -I${_INCLUDE_DIR_}
#
# ---------- flags ------------------------------------------------------------
#
_CC_FLAGS_ = -D___kaneton \
${_INCLUDES_} \
${_KANETON_FLAGS_} \
-fno-builtin \
-Wimplicit \
-Wparentheses \
-Wreturn-type \
-Wswitch -Wswitch-enum \
-Wunused-function \
-Wunused-variable \
-Wmissing-prototypes \
-Wmissing-declarations \
-Wall
_LD_FLAGS_ = ${_INCLUDES_}
_AS_FLAGS_ =
_CPP_FLAGS_ =
_SHELL_FLAGS_ =
_PYTHON_FLAGS_ =
_PERL_FLAGS_ =
_MAKE_FLAGS_ =
#
# ---------- binaries ---------------------------------------------------------
#
_BINARIES_ = ${_SHELL_}, ${_CC_}, ${_MAKE_}, \
${_RM_}, ${_AR_}, ${_RANLIB_}, \
${_LD_}, ${_AS_}, ${_BIBTEX_},\
${_LN_}, ${_TOUCH_}, ${_WC_}, \
${_DATE_}, ${_TAIL_}, ${_TAR_}, \
${_PDFLATEX_}, ${_CP_}, \
${_CAT_}, ${_SED_}, ${_CPP_}, \
${_MTOOLS_}, ${_MCOPY_}, \
${_XPDF_}, ${_MKTEMP_}, ${_MV_},\
${_LEX_}, ${_SCRIPT_}, \
${_PERL_}, ${_PYTHON_}, \
${_DIRNAME_}, ${_BASENAME_}, \
${_WHICH_}
_SHELL_ = bash
_CC_ = i386-elf-gcc-3.4.6
_AS_ = i386-elf-as
_MAKE_ = gmake
_RM_ = rm -f
_PURGE_ = ${_RM_} *.pyc *~ .*~ \#* .\#*
_AR_ = i386-elf-ar cq
_RANLIB_ = i386-elf-ranlib
_CD_ = cd
_LD_ = i386-elf-ld
_LN_ = ln -s -f
_TOUCH_ = touch
_WC_ = wc
_DATE_ = date -u
_TAIL_ = tail
_TAR_ = tar
_PDFLATEX_ = pdflatex
_BIBTEX_ = bibtex
_CP_ = cp
_CAT_ = cat
_SED_ = sed -r
_ECHO_ = /bin/echo
_CPP_ = i386-elf-cpp-3.4.6
_MTOOLS_ = mtools
_MCOPY_ = mcopy
_XPDF_ = open
_MKTEMP_ = mktemp
_MV_ = mv
_PWD_ = pwd
_LEX_ = lex -t
_SCRIPT_ = script
_PERL_ = perl
_PYTHON_ = python2.5
_DIRNAME_ = dirname
_BASENAME_ = basename
_WHICH_ = which
_EXIT_ = exit

View file

@ -0,0 +1,33 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/fanfwe/kane...nvironment/profile/host/darwin/darwin.desc
#
# created julien quintard [tue may 8 13:20:04 2007]
# updated francois goudal [mon aug 4 15:54:31 2008]
#
#
# ---------- information ------------------------------------------------------
#
# this file describes the darwin environment variables.
#
- variable: _SHELL_
string: Shell
type: any
description: The shell binary path
- variable: _CC_
string: C Compiler
type: any
description: The C compiler binary path
- variable: _MAKE_
string: Make
type: any
description: The make binary path

View file

@ -0,0 +1,493 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kane...nvironment/profile/host/darwin/darwin.mk
#
# created julien quintard [tue may 8 13:03:34 2007]
# updated julien quintard [fri aug 29 20:03:17 2008]
#
#
# ---------- information ------------------------------------------------------
#
# this file implements the remaining functions of the kaneton make interface.
#
# indeed the major generic part of the interface is already provided by the
# host profile.
#
#
# ---------- python path ------------------------------------------------------
#
export PYTHONPATH=$(shell $(_ECHO_) $${PYTHONPATH}):$(_PYTHON_INCLUDE_DIR_)
#
# ---------- functions --------------------------------------------------------
#
#
# colorize functions
#
# 1: text
# 2: options
#
define env_colorize-black
"$(1)"
endef
define env_colorize-red
"$(1)"
endef
define env_colorize-green
"$(1)"
endef
define env_colorize-yellow
"$(1)"
endef
define env_colorize-blue
"$(1)"
endef
define env_colorize-magenta
"$(1)"
endef
define env_colorize-cyan
"$(1)"
endef
define env_colorize-white
"$(1)"
endef
define env_colorize-
"$(1)"
endef
#
# perform function
#
# 1: command
#
ifeq ($(_OUTPUT_),$(_OUTPUT_VERBOSE_)) # if the user wants to display
# additional debug information
define env_perform
$(_ECHO_) " $(1)" && \
$(1)
endef
else
define env_perform
$(1)
endef
endif
#
# print functions wrapper
#
# 1: text
# 2: color
# 3: options
#
ifeq ($(_DISPLAY_),$(_DISPLAY_COLORED_)) # if the user wants to display
# the text with color
define env_print
print_options="" && \
if [ -n "$(3)" ] ; then \
if [ $$(( $(3) & $(ENV_OPTION_NO_NEWLINE) )) -ne 0 ] ; then \
print_options="$${print_options} -n" ; \
fi ; \
fi && \
$(_ECHO_) $${print_options} $(call env_colorize-$(2),$(1),)
endef
else # if not ...
define env_print
print_options="" && \
if [ -n "$(3)" ] ; then \
if [ $$(( $(3) & $(ENV_OPTION_NO_NEWLINE) )) -ne 0 ] ; then \
print_options="$${print_options} -n" ; \
fi ; \
fi && \
$(_ECHO_) $${print_options} $(1)
endef
endif
#
# change the current working directory
#
# $(1): directory
# $(2): options
#
define env_cd
cd_options="" && \
$(call env_perform, \
$(_CD_) $${cd_options} $(1))
endef
#
# returns a file contents
#
# $(1): the file
# $(2): options
#
define env_pull
$(_CAT_) $(2) $(1)
endef
#
# launch a new program/script/make etc.
#
# $(1): file
# $(2): arguments
# $(3): options
#
define env_launch
launch_options="" && \
cwd=$$($(_PWD_)) && \
directory=$$($(_DIRNAME_) $(1)) && \
file=$$($(_BASENAME_) $(1)) && \
if [ "$${directory}" != "." ] ; then \
$(call env_perform, \
$(_CD_) $${directory}) ; \
fi && \
case "$${file}" in \
*.sh) \
$(call env_perform, \
$(_SHELL_) $${launch_options} $${file} $(_SHELL_FLAGS_) $(2)) ; \
;; \
*.py) \
$(call env_perform, \
$(_PYTHON_) $${launch_options} $${file} $(_PYTHON_FLAGS_) $(2)) ; \
;; \
*.pl) \
$(call env_perform, \
$(_PERL_) $${launch_options} $${file} $(_PERL_FLAGS_) $(2)) ; \
;; \
Makefile) \
$(call env_perform, \
$(_MAKE_) $${launch_options} -f $${file} $(_MAKE_FLAGS_) ${2}) ; \
;; \
esac ; \
return=$${?} && \
if [ "$${directory}" != "." ] ; then \
$(call env_perform, \
$(_CD_) $${cwd}) ; \
fi && \
if [ $${return} -ne 0 ] ; then \
$(_EXIT_) 42 ; \
fi
endef
#
# from c file to preprocessed c file
#
# $(1): preprocessed file
# $(2): c file
# $(3): options
#
define env_preprocess
preprocess_options="" && \
$(call env_display,green,PREPROCESS,$(2), ,) && \
$(call env_perform, \
$(_CPP_) -P $(_CPP_FLAGS_) $${preprocess_options} $(2) -o $(1))
endef
#
# from c file to object file
#
# $(1): object file
# $(2): c file
# $(3): options
#
define env_compile-c
compile_c_options="" && \
$(call env_display,green,COMPILE-C,$(2), ,) && \
$(call env_perform, \
$(_CC_) $(_CC_FLAGS_) $${compile_c_options} -c $(2) -o $(1))
endef
#
# from lex file to c file
#
# $(1): c file
# $(2): lex file
# $(3): options
#
define env_lex-l
lex_l_options="" && \
$(call env_display,green,LEX-L,$(2), ,) && \
$(call env_perform, \
$(_LEX_) $${lex_l_options} $(2) > $(1))
endef
#
# from S file to object file
#
# $(1): object file
# $(2): S file
# $(3): options
#
define env_assemble-S
assemble_S_options="" && \
$(call env_display,green,ASSEMBLE-S,$(2), ,) && \
$(call env_perform, \
$(_CPP_) $(2) | $(_AS_) $(_AS_FLAGS_) $${assemble_S_options} -o $(1))
endef
#
# create a static library from object files
#
# $(1): static library file name
# $(2): object files
# $(3): options
#
define env_static-library
static_library_options="" && \
$(call env_display,magenta,STATIC-LIBRARY,$(1), ,) && \
$(call env_perform, \
$(_AR_) $${static_library_options} $(1) $(2)) && \
$(call env_perform, \
$(_RANLIB_) $${static_library_options} $(1))
endef
#
# create a dynamic library from object files, static libraries
# and/or dynamic libraries
#
# $(1): dynamic library file name
# $(2): objects files and/or libraries
# $(3): options
#
define env_dynamic-library
dynamic_library_options="" && \
$(call env_display,magenta,DYNAMIC-LIBRARY,$(1), ,) && \
$(call env_perform, \
$(_LD_) --shared $(_LD_FLAGS_) $${dynamic_library_options} \
-o $(1) $(2))
endef
#
# create an executable file from object file and/or library files
#
# $(1): executable file name
# $(2): objects files and/or libraries
# $(3): layout file
# $(4): options
#
define env_executable
executable_options="" && \
if [ -n "$(3)" ] ; then \
executable_options="$${executable_options} -T $(3)" ; \
fi && \
if [ -n "$(4)" ] ; then \
if [ $$(( $(4) & $(ENV_OPTION_NO_STANDARD) )) -ne 0 ] ; then \
executable_options="$${executable_options} -nostdinc -nostdlib" ; \
fi ; \
fi && \
$(call env_display,magenta,EXECUTABLE,$(1), ,) && \
$(call env_perform, \
$(_CC_) $(_CC_FLAGS_) $(_LD_FLAGS_) $${executable_options} -o $(1) \
$(2) "`$(_CC_) -print-libgcc-file-name`")
endef
#
# create an archive file from multiple object files
#
# note that the archive file is also an object file
#
# $(1): archive file name
# $(2): objects files and/or libraries
# $(3): options
#
define env_archive
archive_options="" && \
$(call env_display,magenta,ARCHIVE,$(1), ,) && \
$(call env_perform, \
$(_LD_) -r $(_LD_FLAGS_) $${archive_options} -o $(1) $(2))
endef
#
# remove the files
#
# $(1): files
# $(2): options
#
define env_remove
remove_options="" && \
for f in $(1) ; do \
if [ -e $${f} ] ; then \
$(call env_display,red,REMOVE,$${f}, ,) ; \
fi && \
$(call env_perform, \
$(_RM_) $${remove_options} $${f}) ; \
done
endef
#
# purge i.e clean the directory from unwanted files
#
define env_purge
$(call env_display,red,PURGE,,,) && \
$(call env_perform, \
$(_PURGE_))
endef
#
# generate prototypes from a source file
#
# $(1): file list
# $(2): options
#
define env_prototypes
prototypes_options="" && \
for f in $(1) ; do \
if [ -e $${f} ] ; then \
$(call env_display,yellow,PROTOTYPES,$${f}, ,) && \
$(call env_launch,$(_MKP_TOOL_), \
$${prototypes_options} $${f},) ; \
fi ; \
done
endef
#
# genereate header dependencies
#
# $(1): the files for which the dependencies are generated
# $(2): options
#
define env_headers
headers_options="" && \
for f in $(1) ; do \
if [ -e $${f} ] ; then \
$(call env_display,yellow,HEADERS,$$f, ,) && \
$(call env_perform, \
$(_CC_) $(_CC_FLAGS_) -M -MG $${headers_options} \
$${f} >> $(_DEPENDENCY_MK_)) ; \
fi ; \
done
endef
#
# generate a version file
#
# $(1): the version file to generate
#
define env_version
$(call env_display,yellow,VERSION,$(1), ,) && \
$(_ECHO_) -n "" > $(1) && \
$(_ECHO_) -n "const char version[] = \"$(_TITLE_)-$(_VERSION_)" >> $(1) && \
$(_ECHO_) " "$(shell LANG=C $(_DATE_))" $(USER)@$(HOSTNAME)\";" >> $(1)
endef
#
# create a link between two files
#
# $(1): link created
# $(2): destination
# $(3): options
#
define env_link
link_options="" && \
$(call env_display,cyan,LINK,$(1), ,) && \
$(call env_perform, \
$(_LN_) $${link_options} $(2) $(1))
endef
#
# compile a tex document
#
# $(1): the file name without extension
# $(2): options
#
define env_compile-tex
compile_tex_options="" && \
$(call env_display,green,COMPILE-TEX,$(1), ,) && \
$(call env_perform, \
$(_PDFLATEX_) $${compile_tex_options} $(1).tex) && \
$(call env_perform, \
$(_BIBTEX_) $(1).tex) && \
$(call env_perform, \
$(_PDFLATEX_) $${compile_tex_options} $(1).tex) ; \
$(call env_perform, \
$(_PDFLATEX_) $${compile_tex_options} $(1).tex)
endef
#
# build a document
#
# $(1): the file name without extension
# $(2): options
#
define env_document
if [ -n "$(2)" ] ; then \
if [ $$(( $(2) & $(ENV_OPTION_PRIVATE) )) -ne 0 ] ; then \
$(_ECHO_) '\def\mode{private}' > $(_DEPENDENCY_TEX_) ; \
fi ; \
fi && \
if [ ! -f $(_DEPENDENCY_TEX_) ] ; then \
$(_ECHO_) '\def\mode{public}' > $(_DEPENDENCY_TEX_) ; \
fi && \
$(call env_compile-tex,$(1),$(2))
endef
#
# launch a document viewer
#
# $(1): the file name without extension
# $(2): options
#
define env_view
$(call env_display,yellow,VIEW,$(1), ,) && \
$(call env_perform, \
$(_XPDF_) $(1).pdf)
endef
#
# ---------- component-based behaviour ----------------------------------------
#
#
# meta definitions
#
ifneq ($(call findstring,kaneton,$(components)),)
_CC_FLAGS_ += -D___kaneton$$\kernel
endif

View file

@ -0,0 +1,226 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kane...nvironment/profile/host/darwin/darwin.py
#
# created julien quintard [tue may 8 13:20:21 2007]
# updated julien quintard [tue may 5 12:10:33 2009]
#
#
# ---------- information ------------------------------------------------------
#
# this file implements the remaining functions of the kaneton python interface.
#
# note that the host profile already provides many functions. these
# functions can be overriden but you will probably just use them.
#
# in addition, the host profile already imports some packages.
#
#
# ---------- python path ------------------------------------------------------
#
pythonpath = os.getenv("PYTHONPATH")
if not pythonpath:
pythonpath = ""
os.putenv("PYTHONPATH", pythonpath + ":" + _PYTHON_INCLUDE_DIR_)
#
# ---------- functions --------------------------------------------------------
#
#
# colorize()
#
# this function returns a colorized text if the environment is configured
# to or simply the original text.
#
# note that this function implementation is based on UNIX escape sequences.
#
def colorize(text, color, options):
if _DISPLAY_ == _DISPLAY_UNCOLORED_:
return text
if options & OPTION_FLICKERING:
text = "" + text
if options & OPTION_BOLD:
text = "" + text
if color == COLOR_BLACK:
text = "" + text
elif color == COLOR_RED:
text = "" + text
elif color == COLOR_GREEN:
text = "" + text
elif color == COLOR_YELLOW:
text = "" + text
elif color == COLOR_BLUE:
text = "" + text
elif color == COLOR_MAGENTA:
text = "" + text
elif color == COLOR_CYAN:
text = "" + text
elif color == COLOR_WHITE:
text = "" + text
return text + ""
#
# launch()
#
# this function launch a new program/script/make etc.
#
def launch(file, arguments, options):
directory = None
info = None
status = 0
wd = None
if options & OPTION_QUIET:
output = " >/dev/null 2>&1"
else:
output = ""
info = os.path.split(file)
directory = info[0]
file = info[1]
if directory:
wd = cwd(OPTION_NONE)
cd(directory, OPTION_NONE)
if re.match("^.*\.sh$", file):
status = os.system(_SHELL_ + " " + file + " " + arguments + output)
elif re.match("^.*\.py$", file):
status = os.system(_PYTHON_ + " " + file + " " + arguments + output)
elif re.match("^.*\.pl$", file):
status = os.system(_PERL_ + " " + file + " " + arguments + output)
elif re.match("^Makefile$", file):
status = os.system(_MAKE_ + " -f " + file + " " + arguments + output)
else:
status = os.system(file + " " + arguments + output)
if directory:
cd(wd, OPTION_NONE)
return status
#
# pack()
#
# this function creates an archive of the given directory.
#
def pack(directory, file, options):
launch(_TAR_, "-cjf " + file + " " + directory, OPTION_NONE)
#
# unpack()
#
# this function unpackages an archive into the given (optional) directory.
#
def unpack(file, directory, options):
if directory:
launch(_TAR_, "-xjf " + file + " -C " + directory, OPTION_NONE)
else:
launch(_TAR_, "-xjf " + file, OPTION_NONE)
#
# load()
#
# this function copies a file on a device, this device can be virtual:
# an image.
#
def load(file, device, path, options):
if options == OPTION_DEVICE:
launch(_MCOPY_, "-o -n " + file + " " + device + path, OPTION_NONE)
if options == OPTION_IMAGE:
launch(_MCOPY_, "-o -n " + "-i" + device + " " +
file + " ::" + path, OPTION_NONE)
#
# record()
#
# this function runs the program recording a session.
#
def record(transcript, options):
directory = None
time = None
log = None
tmp = None
wd = None
tmp = temporary(OPTION_DIRECTORY)
directory = tmp + "/" + "transcript"
log = directory + "/" + "log"
time = directory + "/" + "time"
mkdir(directory, OPTION_NONE)
launch(_SCRIPT_, "-q -t " + log + " -c " +
_TRANSCRIPT_CMD_ + " 2> " + time, OPTION_NONE)
wd = cwd(OPTION_NONE)
cd(tmp, OPTION_NONE)
pack("transcript", wd + "/" + transcript, OPTION_NONE)
cd(wd, OPTION_NONE)
remove(tmp, OPTION_NONE)
#
# play()
#
# this function runs the program replaying a session.
#
def play(transcript, options):
directory = None
time = None
log = None
tmp = None
wd = None
tmp = temporary(OPTION_DIRECTORY)
log = tmp + "/" + "transcript/log"
time = tmp + "/" + "transcript/time"
unpack(transcript, tmp, OPTION_NONE)
launch(_SCRIPTREPLAY_TOOL_, time + " " + log, OPTION_NONE)
remove(tmp, OPTION_NONE)
#
# locate()
#
# this function tries to locate a program on the system.
#
def locate(file, options):
return launch(_WHICH_, file + " 1>/dev/null 2>/dev/null", OPTION_NONE)

View file

@ -0,0 +1 @@
.

View file

@ -0,0 +1,33 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/fanfwe/kane...t/profile/host/darwin/ia32.ia32/ia32.conf
#
# created julien quintard [thu jun 28 21:15:33 2007]
# updated francois goudal [mon aug 4 15:57:00 2008]
#
#
# ---------- information ------------------------------------------------------
#
# this file contains definitions specific to the ia32 target microprocessor
# architecture.
#
#
# include the darwin generic definitions
#
include ../darwin.conf
#
# microprocessor specific definitions
#
_CC_FLAGS_ += -D___kaneton$$\endian=0 \
-D___kaneton$$\wordsz=32 \
-D___kaneton$$\pagesz=4096

View file

@ -0,0 +1 @@
../darwin.desc

View file

@ -0,0 +1 @@
../darwin.mk

View file

@ -0,0 +1 @@
../darwin.py

View file

@ -0,0 +1 @@
.

View file

@ -0,0 +1,33 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/fanfwe/kane...t/profile/host/darwin/ia32.null/null.conf
#
# created julien quintard [thu jun 28 21:15:33 2007]
# updated francois goudal [mon aug 4 16:05:31 2008]
#
#
# ---------- information ------------------------------------------------------
#
# this file contains definitions specific to the null target microprocessor
# architecture.
#
#
# include the darwin generic definitions
#
include ../darwin.conf
#
# microprocessor specific definitions
#
_CC_FLAGS_ += -D___kaneton$$\endian=0 \
-D___kaneton$$\wordsz=32 \
-D___kaneton$$\pagesz=1

View file

@ -0,0 +1 @@
../darwin.desc

View file

@ -0,0 +1 @@
../darwin.mk

View file

@ -0,0 +1 @@
../darwin.py

View file

@ -0,0 +1,33 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kaneton/environment/profile/host/host.conf
#
# created julien quintard [tue may 8 13:03:21 2007]
# updated julien quintard [fri dec 17 20:04:01 2010]
#
#
# ---------- information ------------------------------------------------------
#
# this file contains the default host variables. the different hosts
# should either complete or override them.
#
#
# ---------- garbage ----------------------------------------------------------
#
_GARBAGE_ = *~ .*~ \#* .\#* *.pyc *.aux \
*.log *.toc *.bbl *.blg *.nav \
*.out *.snm *.vrb *.pdf
#
# ---------- binaries ---------------------------------------------------------
#
_BINARIES_ = <null>

View file

@ -0,0 +1,18 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kaneton/environment/profile/host/host.desc
#
# created julien quintard [tue may 8 13:03:26 2007]
# updated julien quintard [sat may 19 14:30:26 2007]
#
#
# ---------- information ------------------------------------------------------
#
# XXX
#

View file

@ -0,0 +1,214 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kaneton.STABLE/environment/profile/host/host.mk
#
# created julien quintard [tue may 8 13:03:34 2007]
# updated julien quintard [mon nov 29 10:18:58 2010]
#
#
# ---------- information ------------------------------------------------------
#
# this file contains generic stuff about the implementation of the kaneton
# make interface. there are few functions here because make was not designed
# in a portable way.
#
#
# ---------- directives -------------------------------------------------------
#
.SILENT:
#
# ---------- options ----------------------------------------------------------
#
ENV_HEADER_NONE = 0
ENV_HEADER_OK = 1
ENV_HEADER_ERROR = 2
ENV_HEADER_INTERACTIVE = 4
ENV_COLOR_NONE = 0
ENV_COLOR_RED = 1
ENV_COLOR_GREEN = 2
ENV_COLOR_YELLOW = 3
ENV_COLOR_BLUE = 4
ENV_COLOR_WHITE = 5
ENV_OPTION_NONE = 0
ENV_OPTION_NO_NEWLINE = 1
ENV_OPTION_FLICKERING = 2
ENV_OPTION_NO_STANDARD = 1
ENV_OPTION_STANDARD = 2
ENV_OPTION_PRIVATE = 1
#
# ---------- default rule -----------------------------------------------------
#
# this rule is invoked when a Makefile is called without specifying a
# rule name.
#
# this rule is intended to check whether the configured environment files
# are up-to-date. if not, this rule re-builds the configured environment files.
#
ENV_DEPENDENCIES := $(wildcard \
$(_PROFILE_DIR_)/*.conf \
$(_PROFILE_DIR_)/host/*.conf \
$(_PROFILE_DIR_)/host/*.mk \
$(_PROFILE_DIR_)/host/*.py \
$(_PROFILE_HOST_DIR_)/*.conf \
$(_PROFILE_HOST_DIR_)/*.mk \
$(_PROFILE_HOST_DIR_)/*.py \
$(_PROFILE_DIR_)/kaneton/*.conf \
$(_PROFILE_DIR_)/kaneton/*.py \
$(_PROFILE_DIR_)/kaneton/*.mk \
$(_PROFILE_LIBRARY_DIR_)/*.conf \
$(_PROFILE_LIBRARY_DIR_)/*.mk \
$(_PROFILE_LIBRARY_DIR_)/*.py \
$(_PROFILE_MODULES_DIR_)/*.conf \
$(_PROFILE_MODULES_DIR_)/*.mk \
$(_PROFILE_MODULES_DIR_)/*.py \
$(_PROFILE_MACHINE_DIR_)/*.conf \
$(_PROFILE_MACHINE_DIR_)/*.mk \
$(_PROFILE_MACHINE_DIR_)/*.py \
$(_PROFILE_PLATFORM_DIR_)/*.conf \
$(_PROFILE_PLATFORM_DIR_)/*.mk \
$(_PROFILE_PLATFORM_DIR_)/*.py \
$(_PROFILE_ARCHITECTURE_DIR_)/*.conf \
$(_PROFILE_ARCHITECTURE_DIR_)/*.mk \
$(_PROFILE_ARCHITECTURE_DIR_)/*.py \
$(_PROFILE_GLUE_DIR_)/*.conf \
$(_PROFILE_GLUE_DIR_)/*.mk \
$(_PROFILE_GLUE_DIR_)/*.py \
$(_PROFILE_CORE_DIR_)/*.conf \
$(_PROFILE_CORE_DIR_)/*.mk \
$(_PROFILE_CORE_DIR_)/*.py \
$(_PROFILE_DIR_)/user/*.conf \
$(_PROFILE_DIR_)/user/*.mk \
$(_PROFILE_DIR_)/user/*.py \
$(_PROFILE_USER_DIR_)/*.conf \
$(_PROFILE_USER_DIR_)/*.mk \
$(_PROFILE_USER_DIR_)/*.py)
_: $(_ENV_MK_) $(_ENV_PY_)
$(call env_launch,Makefile,main,)
$(_ENV_MK_) $(_ENV_PY): \
$(ENV_DEPENDENCIES)
$(call env_launch,$(_ENVIRONMENT_DIR_)/Makefile,initialize,)
#
# ---------- traps ------------------------------------------------------------
#
%.o: %.S
$(call env_assemble-S,$@,$<,)
%.o: %.c
$(call env_compile-c,$@,$<,)
%.c: %.l
$(call env_lex-l,$@,$<,)
#
# ---------- functions --------------------------------------------------------
#
#
# display functions
#
# 1: action
# 2: file
# 3: identation
# 4: options
#
define env_display-red
$(call env_print,[,blue,$(ENV_OPTION_NO_NEWLINE)) && \
$(call env_print,$(1),red,$(ENV_OPTION_NO_NEWLINE)) && \
$(call env_print,],blue,$(ENV_OPTION_NO_NEWLINE)) && \
$(call env_print,$(3)$(2),,)
endef
define env_display-green
$(call env_print,[,blue,$(ENV_OPTION_NO_NEWLINE)) && \
$(call env_print,$(1),green,$(ENV_OPTION_NO_NEWLINE)) && \
$(call env_print,],blue,$(ENV_OPTION_NO_NEWLINE)) && \
$(call env_print,$(3)$(2),,)
endef
define env_display-yellow
$(call env_print,[,blue,$(ENV_OPTION_NO_NEWLINE)) && \
$(call env_print,$(1),yellow,$(ENV_OPTION_NO_NEWLINE)) && \
$(call env_print,],blue,$(ENV_OPTION_NO_NEWLINE)) && \
$(call env_print,$(3)$(2),,)
endef
define env_display-magenta
$(call env_print,[,blue,$(ENV_OPTION_NO_NEWLINE)) && \
$(call env_print,$(1),magenta,$(ENV_OPTION_NO_NEWLINE)) && \
$(call env_print,],blue,$(ENV_OPTION_NO_NEWLINE)) && \
$(call env_print,$(3)$(2),,)
endef
define env_display-cyan
$(call env_print,[,blue,$(ENV_OPTION_NO_NEWLINE)) && \
$(call env_print,$(1),cyan,$(ENV_OPTION_NO_NEWLINE)) && \
$(call env_print,],blue,$(ENV_OPTION_NO_NEWLINE)) && \
$(call env_print,$(3)$(2),,)
endef
#
# display wrapper
#
# $(1): color
# $(2): action
# $(3): file
# $(4): indentation
# $(5): options
#
define env_display
$(call env_display-$(1),$(2),$(3),$(4),$(5))
endef
#
# ---------- information ------------------------------------------------------
#
directory := $(CURDIR)
#
# ---------- component-based behaviour ----------------------------------------
#
#
# behaviour
#
behaviour := default
#
# components
#
ifeq ($(call findstring,$(component),$(components)),)
components += $(component)
endif
export components
#
# ---------- cc flags ---------------------------------------------------------
#
_CC_FLAGS_ += $(foreach m,$(_MODULES_),-DMODULE_$(m))

View file

@ -0,0 +1,382 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kaneton/environment/profile/host/host.py
#
# created julien quintard [tue may 8 13:03:40 2007]
# updated julien quintard [mon mar 7 16:36:27 2011]
#
#
# ---------- information ------------------------------------------------------
#
# this file contains generic stuff about the python interface including
# options and general functions.
#
# since the python scripting language was designed to provide portable
# operations, the following operations are considered as generic, making
# work easier for host sub-profiles.
#
#
# ---------- imports ----------------------------------------------------------
#
import os
import re
import sys
import tempfile
import shutil
import time
#
# ---------- options ----------------------------------------------------------
#
HEADER_NONE = 0
HEADER_OK = 1
HEADER_ERROR = 2
HEADER_INTERACTIVE = 4
COLOR_NONE = 0
COLOR_BLACK = 1
COLOR_RED = 2
COLOR_GREEN = 3
COLOR_YELLOW = 4
COLOR_BLUE = 5
COLOR_MAGENTA = 6
COLOR_CYAN = 7
COLOR_WHITE = 8
OPTION_NONE = 0
OPTION_QUIET = 1
OPTION_NO_NEWLINE = 1
OPTION_FLICKERING = 2
OPTION_BOLD = 4
OPTION_FILE = 1
OPTION_DIRECTORY = 2
OPTION_LINK = 4
OPTION_RECURSIVE = 8
OPTION_EXIST = 16
OPTION_HIDDEN = 32
OPTION_ALL = OPTION_FILE | OPTION_DIRECTORY | OPTION_LINK
OPTION_DEVICE = 1
OPTION_IMAGE = 2
OPTION_CURRENT_DIRECTORY = 1
#
# ---------- functions --------------------------------------------------------
#
#
# display()
#
# this function prints a kaneton message.
#
def display(header, text, options):
if header == HEADER_NONE:
sys.stdout.write(colorize(text, COLOR_NONE, OPTION_NONE))
elif header == HEADER_OK:
sys.stdout.write(colorize("[", COLOR_BLUE, OPTION_BOLD))
sys.stdout.write(colorize("+", COLOR_GREEN, OPTION_BOLD))
sys.stdout.write(colorize("]", COLOR_BLUE, OPTION_BOLD))
sys.stdout.write(" ")
sys.stdout.write(colorize(text, COLOR_NONE, OPTION_NONE))
elif header == HEADER_ERROR:
sys.stdout.write(colorize("[", COLOR_BLUE, OPTION_BOLD))
sys.stdout.write(colorize("!", COLOR_RED, OPTION_BOLD))
sys.stdout.write(colorize("]", COLOR_BLUE, OPTION_BOLD))
sys.stdout.write(" ")
sys.stdout.write(colorize(text, COLOR_NONE, OPTION_NONE))
elif header == HEADER_INTERACTIVE:
sys.stdout.write(colorize("[", COLOR_BLUE, OPTION_BOLD))
sys.stdout.write(colorize("?",
COLOR_YELLOW,
OPTION_FLICKERING | OPTION_BOLD))
sys.stdout.write(colorize("]", COLOR_BLUE, OPTION_BOLD))
sys.stdout.write(" ")
sys.stdout.write(colorize(text, COLOR_NONE, OPTION_NONE))
if not options & OPTION_NO_NEWLINE:
sys.stdout.write("\n")
#
# pull()
#
# this function reads the content of a single file.
#
def pull(file, options):
handle = None
line = None
if not os.path.exists(file):
return None
try:
handle = open(file, "r")
except IOError:
return None
content = ""
for line in handle.readlines():
content += line
handle.close()
return content
#
# push()
#
# this function writes the content of a single file.
#
def push(file, content, options):
handle = None
handle = open(file, "w")
handle.write(content)
handle.close()
#
# temporary()
#
# this function provides an easy way to create a temporary file or directory.
#
def temporary(options):
location = None
if options == OPTION_FILE:
tuple = tempfile.mkstemp()
os.close(tuple[0])
location = tuple[1]
elif options == OPTION_DIRECTORY:
location = tempfile.mkdtemp()
return location
#
# cwd()
#
# this function returns the current working directory.
#
def cwd(options):
return os.getcwd()
#
# input()
#
# this function waits for an input.
#
def input(options):
return input()
#
# copy()
#
# this function copies a file or a directory.
#
def copy(source, destination, options):
if os.path.isdir(source):
shutil.copytree(source, destination, True)
else:
shutil.copy2(source, destination)
#
# move()
#
# this function moves a file or a directory.
#
def move(source, destination, options):
copy(source, destination, options)
remove(source, options)
#
# link()
#
# this function builds a link name source to the file destination.
#
def link(source, destination, options):
os.symlink(destination, source)
#
# remove()
#
# this function removes the targets.
#
def remove(target, options):
entries = None
entry = None
if os.path.isfile(target) or os.path.islink(target):
os.unlink(target)
if os.path.isdir(target):
entries = os.listdir(target)
for entry in entries:
remove(target + "/" + entry, OPTION_NONE)
os.rmdir(target)
#
# list()
#
# this function lists the entries of a directory.
#
def list(directory, options):
elements = []
entries = None
entry = None
entries = os.listdir(directory)
for entry in entries:
if not (options & OPTION_HIDDEN) and \
(entry[0:1] == "."):
continue
if (options & OPTION_LINK) and \
(os.path.islink(directory + "/" + entry)):
elements += [ entry ]
if (options & OPTION_FILE) and \
(os.path.isfile(directory + "/" + entry)) and \
(not os.path.islink(directory + "/" + entry)):
elements += [ entry ]
if (options & OPTION_DIRECTORY) and \
(os.path.isdir(directory + "/" + entry)) and \
(not os.path.islink(directory + "/" + entry)):
elements += [ entry ]
return elements
#
# cd()
#
# this function changes the current working directory.
#
def cd(directory, options):
os.chdir(directory)
#
# search()
#
# this function searches for file names matching the given pattern.
#
def search(directory, pattern, options):
elements = []
entries = None
entry = None
entries = os.listdir(directory)
for entry in entries:
if (options & OPTION_FILE) and \
(os.path.isfile(directory + "/" + entry)) and \
(re.search(pattern, entry)):
elements += [ directory + "/" + entry ]
if (os.path.isdir(directory + "/" + entry)):
if (options & OPTION_DIRECTORY) and \
(re.search(pattern, entry)):
elements += [ directory + "/" + entry ]
if (options & OPTION_RECURSIVE) and \
(not os.path.islink(directory + "/" + entry)):
elements += search(directory + "/" + entry, pattern, options)
return elements
#
# mkdir()
#
# this function creates a directory.
#
def mkdir(directory, options):
path = None
steps = None
step = None
steps = directory.strip("/").split("/")
for step in steps:
if not path:
path = "/" + step
else:
path = path + "/" + step
if not os.path.exists(path):
os.mkdir(path)
#
# stamp()
#
# this function returns the current formatted date.
#
def stamp(options):
return time.strftime("%Y%m%d")
#
# path()
#
# this function returns information on a path: file, directory etc.
#
def path(path, options):
if options == OPTION_FILE:
return os.path.basename(path)
if options == OPTION_DIRECTORY:
return os.path.dirname(path)
if options == OPTION_EXIST:
return os.path.exists(path)
return None
#
# info()
#
# this function returns information on the system.
#
def info(options):
if (options & OPTION_CURRENT_DIRECTORY):
return os.path.curdir

View file

@ -0,0 +1 @@
.

View file

@ -0,0 +1 @@
../linux.conf

View file

@ -0,0 +1 @@
../linux.desc

View file

@ -0,0 +1 @@
../linux.mk

View file

@ -0,0 +1 @@
../linux.py

View file

@ -0,0 +1 @@
.

View file

@ -0,0 +1,137 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kane...ofile/host/linux/ia32.mips64/mips64.conf
#
# created julien quintard [thu jun 28 21:15:33 2007]
# updated julien quintard [fri may 1 23:54:21 2009]
#
#
# ---------- information ------------------------------------------------------
#
# this file contains definitions specific to the mips64 target microprocessor
# architecture.
#
#
# include the linux generic definitions
#
_INCLUDES_ = -I${_INCLUDE_DIR_}
#
# ---------- flags ------------------------------------------------------------
#
_CC_FLAGS_ = -D___kaneton \
${_INCLUDES_} \
${_KANETON_FLAGS_} \
-fno-builtin \
-Wimplicit \
-Wparentheses \
-Wreturn-type \
-Wswitch -Wswitch-enum \
-Wunused-function \
-Wunused-variable \
-Wmissing-prototypes \
-Wmissing-declarations \
-Wall -W -std=c99 \
-mabi=64 \
-G 0 \
-march=mips64 \
-EL \
-mgp64 \
-mfp64 \
-mlong64 \
-DMIPS64_DEPENDENT \
-DMIPS64_DEV
_LD_FLAGS_ = --warn-unresolved-symbols \
--oformat=elf64-littlemips
_ASM_FLAGS_ = -mabi=64 \
-G 0 \
-march=mips64 \
-EL \
-mgp64 \
-mfp64
_CPP_FLAGS_ =
_SHELL_FLAGS_ =
_PYTHON_FLAGS_ =
_PERL_FLAGS_ =
_MAKE_FLAGS_ =
#
# ---------- binaries ---------------------------------------------------------
#
_BINARIES_ = ${_SHELL_}, ${_CC_}, ${_MAKE_}, \
${_RM_}, ${_AR_}, ${_RANLIB_}, \
${_LD_}, ${_AS_}, ${_BIBTEX_},\
${_LN_}, ${_TOUCH_}, ${_WC_}, \
${_DATE_}, ${_TAIL_}, ${_TAR_}, \
${_PDFLATEX_}, ${_CP_}, \
${_CAT_}, ${_SED_}, ${_CPP_}, \
${_MTOOLS_}, ${_MCOPY_}, \
${_XPDF_}, ${_MKTEMP_}, ${_MV_},\
${_LEX_}, ${_SCRIPT_}, \
${_PERL_}, ${_PYTHON_}, \
${_DIRNAME_}, ${_BASENAME_}, \
${_WHICH_}
_SHELL_ = bash
_CC_ = mips64-gcc
_AS_ = mips64-as
_OBJCOPY_ = mips64-objcopy
_MAKE_ = gmake
_RM_ = rm -f
_PURGE_ = ${_RM_} *.pyc *~ .*~ \#* .\#*
_AR_ = mips64-ar cq
_RANLIB_ = mips64-ranlib
_CD_ = cd
_LD_ = mips64-ld
_LN_ = ln -s -f
_TOUCH_ = touch
_WC_ = wc
_DATE_ = date -u
_TAIL_ = tail
_TAR_ = tar
_PDFLATEX_ = pdflatex
_BIBTEX_ = bibtex
_CP_ = cp
_CAT_ = cat
_SED_ = sed -r
_ECHO_ = echo
_CPP_ = mips64-cpp
_MTOOLS_ = mtools
_MCOPY_ = mcopy
_XPDF_ = xpdf
_MKTEMP_ = mktemp
_MV_ = mv
_PWD_ = pwd
_LEX_ = lex -t
_SCRIPT_ = script
_PERL_ = perl
_PYTHON_ = python
_DIRNAME_ = dirname
_BASENAME_ = basename
_WHICH_ = which
_EXIT_ = exit
#
# microprocessor specific definitions
#
_CC_FLAGS_ += -D___kaneton$$\endian=1 \
-D___kaneton$$\wordsz=64 \
-D___kaneton$$\pagesz=4096

View file

@ -0,0 +1,33 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kane...nvironment/profile/host/linux/linux.desc
#
# created julien quintard [tue may 8 13:20:04 2007]
# updated julien quintard [tue may 29 16:37:31 2007]
#
#
# ---------- information ------------------------------------------------------
#
# this file describes the linux environment variables.
#
- variable: _SHELL_
string: Shell
type: any
description: The shell binary path
- variable: _CC_
string: C Compiler
type: any
description: The C compiler binary path
- variable: _MAKE_
string: Make
type: any
description: The make binary path

View file

@ -0,0 +1,23 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/enguerrand/...profile/host/linux/ia32.mips64/mips64.mk
#
# created julien quintard [tue may 8 13:03:34 2007]
# updated enguerrand raymond [sun may 17 09:36:48 2009]
#
#
# ---------- information ------------------------------------------------------
#
# this file implements the remaining functions of the kaneton make interface.
#
# indeed the major generic part of the interface is already provided by the
# host profile.
#
include ../linux.mk

View file

@ -0,0 +1,219 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/enguerrand/...profile/host/linux/ia32.mips64/mips64.py
#
# created julien quintard [tue may 8 13:20:21 2007]
# updated enguerrand raymond [fri apr 17 20:59:36 2009]
#
#
# ---------- information ------------------------------------------------------
#
# this file implements the remaining functions of the kaneton python interface.
#
# note that the host profile already provides many functions. these
# functions can be overriden but you will probably just use them.
#
# in addition, the host profile already imports some packages.
#
#
# ---------- python path ------------------------------------------------------
#
pythonpath = os.getenv("PYTHONPATH")
if not pythonpath:
pythonpath = ""
os.putenv("PYTHONPATH", pythonpath + ":" + _PYTHON_INCLUDE_DIR_)
#
# ---------- functions --------------------------------------------------------
#
#
# colorize()
#
# this function returns a colorized text if the environment is configured
# to or simply the original text.
#
# note that this function implementation is based on UNIX escape sequences.
#
def colorize(text, color, options):
if _DISPLAY_ == _DISPLAY_UNCOLORED_:
return text
if options & OPTION_FLICKERING:
text = "" + text + ""
if color == COLOR_BLACK:
text = "" + text + ""
elif color == COLOR_RED:
text = "" + text + ""
elif color == COLOR_GREEN:
text = "" + text + ""
elif color == COLOR_YELLOW:
text = "" + text + ""
elif color == COLOR_BLUE:
text = "" + text + ""
elif color == COLOR_MAGENTA:
text = "" + text + ""
elif color == COLOR_CYAN:
text = "" + text + ""
elif color == COLOR_WHITE:
text = "" + text + ""
return text
#
# launch()
#
# this function launch a new program/script/make etc.
#
def launch(file, arguments, options):
directory = None
info = None
status = 0
wd = None
info = os.path.split(file)
directory = info[0]
file = info[1]
if directory:
wd = cwd(OPTION_NONE)
cd(directory, OPTION_NONE)
if re.match("^.*\.sh$", file):
status = os.system(_SHELL_ + " " + file + " " + arguments)
elif re.match("^.*\.py$", file):
status = os.system(_PYTHON_ + " " + file + " " + arguments)
elif re.match("^.*\.pl$", file):
status = os.system(_PERL_ + " " + file + " " + arguments)
elif re.match("^Makefile$", file):
status = os.system(_MAKE_ + " -f " + file + " " + arguments)
else:
status = os.system(file + " " + arguments)
if directory:
cd(wd, OPTION_NONE)
return status
#
# pack()
#
# this function creates an archive of the given directory.
#
def pack(directory, file, options):
launch(_TAR_, "-cjf " + file + " " + directory, OPTION_NONE)
#
# unpack()
#
# this function unpackages an archive into the given (optional) directory.
#
def unpack(file, directory, options):
if directory:
launch(_TAR_, "-xjf " + file + " -C " + directory, OPTION_NONE)
else:
launch(_TAR_, "-xjf " + file, OPTION_NONE)
#
# load()
#
# this function copies a file on a device, this device can be virtual:
# an image.
#
def load(file, device, path, options):
if options == OPTION_DEVICE:
launch(_MCOPY_, "-o -n " + file + " " + device + path, OPTION_NONE)
if options == OPTION_IMAGE:
launch(_MCOPY_, "-o -n " + "-i" + device + " " +
file + " ::" + path, OPTION_NONE)
#
# record()
#
# this function runs the program recording a session.
#
def record(transcript, options):
directory = None
time = None
log = None
tmp = None
wd = None
tmp = temporary(OPTION_DIRECTORY)
directory = tmp + "/" + "transcript"
log = directory + "/" + "log"
time = directory + "/" + "time"
mkdir(directory, OPTION_NONE)
launch(_SCRIPT_, "-q -t " + log + " -c " +
_TRANSCRIPT_CMD_ + " 2> " + time, OPTION_NONE)
wd = cwd(OPTION_NONE)
cd(tmp, OPTION_NONE)
pack("transcript", wd + "/" + transcript, OPTION_NONE)
cd(wd, OPTION_NONE)
remove(tmp, OPTION_NONE)
#
# play()
#
# this function runs the program replaying a session.
#
def play(transcript, options):
directory = None
time = None
log = None
tmp = None
wd = None
tmp = temporary(OPTION_DIRECTORY)
log = tmp + "/" + "transcript/log"
time = tmp + "/" + "transcript/time"
unpack(transcript, tmp, OPTION_NONE)
launch(_SCRIPTREPLAY_TOOL_, time + " " + log, OPTION_NONE)
remove(tmp, OPTION_NONE)
#
# locate()
#
# this function tries to locate a program on the system.
#
def locate(file, options):
return launch(_WHICH_, file + " 1>/dev/null 2>/dev/null", OPTION_NONE)

View file

@ -0,0 +1,48 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/enguerrand/...t/profile/host/linux/ia32.mips64/util.py
#
# created enguerrand raymond [fri apr 17 20:59:04 2009]
# updated enguerrand raymond [fri apr 17 21:00:47 2009]
#
#
# ---------- information ------------------------------------------------------
#
# this file implements some useful functions used for mips compilation, build
# and installation.
#
#
# binary_extract()
#
# this function extracts given sections (section names separate by space)
# from elf to put in binary
#
def binary_extract(elf, sections, binary):
section_list = sections.split()
cmd_option = "-S"
for section in section_list:
cmd_option += " -j " + section
cmd_option += " --output-target binary " + elf + " " + binary
launch(_OBJCOPY_, cmd_option, "")
#
# concat_file()
#
# this function concatenates file a the result file end
#
def concat_file(file, result):
os.system(_CAT_ + " " + file + " >> " + result)

View file

@ -0,0 +1,33 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kane...t/profile/host/linux/ia32.null/null.conf
#
# created julien quintard [thu jun 28 21:15:33 2007]
# updated julien quintard [wed mar 26 23:37:31 2008]
#
#
# ---------- information ------------------------------------------------------
#
# this file contains definitions specific to the null target microprocessor
# architecture.
#
#
# include the linux generic definitions
#
include ../linux.conf
#
# microprocessor specific definitions
#
_CC_FLAGS_ += -D___kaneton$$\endian=0 \
-D___kaneton$$\wordsz=32 \
-D___kaneton$$\pagesz=1

View file

@ -0,0 +1 @@
../linux.desc

View file

@ -0,0 +1 @@
../linux.mk

View file

@ -0,0 +1 @@
../linux.py

View file

@ -0,0 +1,113 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kane...nvironment/profile/host/linux/linux.conf
#
# created julien quintard [tue may 8 13:19:52 2007]
# updated julien quintard [mon feb 7 10:36:01 2011]
#
#
# ---------- information ------------------------------------------------------
#
# this file contains the libraries, binaries, script and tools related to
# the generic linux host sub-profile.
#
#
# ---------- includes ---------------------------------------------------------
#
_INCLUDES_ = -I${_INCLUDE_DIR_}
#
# ---------- flags ------------------------------------------------------------
#
_CC_FLAGS_ = ${_INCLUDES_} \
${_KANETON_FLAGS_} \
-fno-builtin \
-fno-stack-protector \
-Wimplicit \
-Wparentheses \
-Wreturn-type \
-Wswitch -Wswitch-enum \
-Wunused-function \
-Wunused-variable \
-Wmissing-prototypes \
-Wmissing-declarations \
-Wall
_LD_FLAGS_ = ${_INCLUDES_}
_ASM_FLAGS_ =
_CPP_FLAGS_ =
_SHELL_FLAGS_ =
_PYTHON_FLAGS_ =
_PERL_FLAGS_ =
_MAKE_FLAGS_ =
#
# ---------- binaries ---------------------------------------------------------
#
_BINARIES_ = ${_SHELL_}, ${_CC_}, ${_MAKE_}, \
${_RM_}, ${_AR_}, ${_RANLIB_}, \
${_LD_}, ${_AS_}, ${_BIBTEX_},\
${_LN_}, ${_TOUCH_}, ${_WC_}, \
${_DATE_}, ${_TAIL_}, ${_TAR_}, \
${_PDFLATEX_}, ${_CP_}, \
${_CAT_}, ${_SED_}, ${_CPP_}, \
${_MTOOLS_}, ${_MCOPY_}, \
${_XPDF_}, ${_MKTEMP_}, ${_MV_},\
${_LEX_}, ${_SCRIPT_}, \
${_PERL_}, ${_PYTHON_}, \
${_DIRNAME_}, ${_BASENAME_}, \
${_WHICH_}
_SHELL_ = bash
_CC_ = gcc
_AS_ = as
_MAKE_ = make
_RM_ = rm -f
_PURGE_ = ${_RM_} ${_GARBAGE_}
_AR_ = ar cq
_RANLIB_ = ranlib
_CD_ = cd
_LD_ = ld
_LN_ = ln -s -f
_TOUCH_ = touch
_WC_ = wc
_DATE_ = date -u
_TAIL_ = tail
_TAR_ = tar
_PDFLATEX_ = pdflatex
_BIBTEX_ = bibtex
_CP_ = cp
_CAT_ = cat
_SED_ = sed -r
_ECHO_ = echo
_CPP_ = cpp
_MTOOLS_ = mtools
_MCOPY_ = mcopy
_XPDF_ = xpdf
_MKTEMP_ = mktemp
_MV_ = mv
_PWD_ = pwd
_LEX_ = lex -t
_SCRIPT_ = script
_PERL_ = perl
_PYTHON_ = python
_DIRNAME_ = dirname
_BASENAME_ = basename
_WHICH_ = which
_EXIT_ = exit

View file

@ -0,0 +1,33 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kane...nvironment/profile/host/linux/linux.desc
#
# created julien quintard [tue may 8 13:20:04 2007]
# updated julien quintard [tue may 29 16:37:31 2007]
#
#
# ---------- information ------------------------------------------------------
#
# this file describes the linux environment variables.
#
- variable: _SHELL_
string: Shell
type: any
description: The shell binary path
- variable: _CC_
string: C Compiler
type: any
description: The C compiler binary path
- variable: _MAKE_
string: Make
type: any
description: The make binary path

View file

@ -0,0 +1,507 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kane.../environment/profile/host/linux/linux.mk
#
# created julien quintard [tue may 8 13:03:34 2007]
# updated julien quintard [sun dec 5 00:02:41 2010]
#
#
# ---------- information ------------------------------------------------------
#
# this file implements the remaining functions of the kaneton make interface.
#
# indeed the major generic part of the interface is already provided by the
# host profile.
#
#
# ---------- lang -------------------------------------------------------------
#
# incorrect locales may prevent the system from compiling properly.
#
# the following forces the LANG environment variable to US.
#
export LANG=US
#
# ---------- python path ------------------------------------------------------
#
export PYTHONPATH=$(shell $(_ECHO_) $${PYTHONPATH}):$(_PYTHON_INCLUDE_DIR_)
#
# ---------- functions --------------------------------------------------------
#
#
# colorize functions
#
# 1: text
# 2: options
#
define env_colorize-black
"$(1)"
endef
define env_colorize-red
"$(1)"
endef
define env_colorize-green
"$(1)"
endef
define env_colorize-yellow
"$(1)"
endef
define env_colorize-blue
"$(1)"
endef
define env_colorize-magenta
"$(1)"
endef
define env_colorize-cyan
"$(1)"
endef
define env_colorize-white
"$(1)"
endef
define env_colorize-
"$(1)"
endef
#
# perform function
#
# 1: command
#
ifeq ($(_OUTPUT_),$(_OUTPUT_VERBOSE_)) # if the user wants to display
# additional debug information
define env_perform
$(_ECHO_) " $(1)" && \
$(1)
endef
else
define env_perform
$(1)
endef
endif
#
# print functions wrapper
#
# 1: text
# 2: color
# 3: options
#
ifeq ($(_DISPLAY_),$(_DISPLAY_COLORED_)) # if the user wants to display
# the text with color
define env_print
print_options="" && \
if [ -n "$(3)" ] ; then \
if [ $$(( $(3) & $(ENV_OPTION_NO_NEWLINE) )) -ne 0 ] ; then \
print_options="$${print_options} -n" ; \
fi ; \
fi && \
$(_ECHO_) $${print_options} $(call env_colorize-$(2),$(1),)
endef
else # if not ...
define env_print
print_options="" && \
if [ -n "$(3)" ] ; then \
if [ $$(( $(3) & $(ENV_OPTION_NO_NEWLINE) )) -ne 0 ] ; then \
print_options="$${print_options} -n" ; \
fi ; \
fi && \
$(_ECHO_) $${print_options} "$(1)"
endef
endif
#
# change the current working directory
#
# $(1): directory
# $(2): options
#
define env_cd
cd_options="" && \
$(call env_perform, \
$(_CD_) $${cd_options} $(1))
endef
#
# returns a file contents
#
# $(1): the file
# $(2): options
#
define env_pull
$(_CAT_) $(2) $(1)
endef
#
# launch a new program/script/make etc.
#
# $(1): file
# $(2): arguments
# $(3): options
#
define env_launch
launch_options="" && \
cwd=$$($(_PWD_)) && \
directory=$$($(_DIRNAME_) $(1)) && \
file=$$($(_BASENAME_) $(1)) && \
if [ "$${directory}" != "." ] ; then \
$(call env_perform, \
$(_CD_) $${directory}) ; \
fi && \
case "$${file}" in \
*.sh) \
$(call env_perform, \
$(_SHELL_) $${launch_options} $${file} $(_SHELL_FLAGS_) $(2)) ; \
;; \
*.py) \
$(call env_perform, \
$(_PYTHON_) $${launch_options} $${file} $(_PYTHON_FLAGS_) $(2)) ; \
;; \
*.pl) \
$(call env_perform, \
$(_PERL_) $${launch_options} $${file} $(_PERL_FLAGS_) $(2)) ; \
;; \
Makefile) \
$(call env_perform, \
$(_MAKE_) $${launch_options} -f $${file} $(_MAKE_FLAGS_) ${2}) ; \
;; \
esac ; \
return=$${?} && \
if [ "$${directory}" != "." ] ; then \
$(call env_perform, \
$(_CD_) $${cwd}) ; \
fi && \
if [ $${return} -ne 0 ] ; then \
$(_EXIT_) 42 ; \
fi
endef
#
# from c file to preprocessed c file
#
# $(1): preprocessed file
# $(2): c file
# $(3): options
#
define env_preprocess
preprocess_options="" && \
$(call env_display,green,PREPROCESS,$(2), ,) && \
$(call env_perform, \
$(_CPP_) -P $(_CPP_FLAGS_) $${preprocess_options} $(2) -o $(1))
endef
#
# from c file to object file
#
# $(1): object file
# $(2): c file
# $(3): options
#
define env_compile-c
compile_c_options="" && \
$(call env_display,green,COMPILE-C,$(2), ,) && \
$(call env_perform, \
$(_CC_) $(_CC_FLAGS_) $${compile_c_options} -c $(2) -o $(1))
endef
#
# from lex file to c file
#
# $(1): c file
# $(2): lex file
# $(3): options
#
define env_lex-l
lex_l_options="" && \
$(call env_display,green,LEX-L,$(2), ,) && \
$(call env_perform, \
$(_LEX_) $${lex_l_options} $(2) > $(1))
endef
#
# from S file to object file
#
# $(1): object file
# $(2): S file
# $(3): options
#
define env_assemble-S
assemble_S_options="" && \
$(call env_display,green,ASSEMBLE-S,$(2), ,) && \
$(call env_perform, \
$(_CPP_) $(2) | $(_AS_) $(_ASM_FLAGS_) $${assemble_S_options} -o $(1))
endef
#
# create a static library from object files
#
# $(1): static library file name
# $(2): object files
# $(3): options
#
define env_static-library
static_library_options="" && \
$(call env_display,magenta,STATIC-LIBRARY,$(1), ,) && \
$(call env_perform, \
$(_AR_) $${static_library_options} $(1) $(2)) && \
$(call env_perform, \
$(_RANLIB_) $${static_library_options} $(1))
endef
#
# create a dynamic library from object files, static libraries
# and/or dynamic libraries
#
# $(1): dynamic library file name
# $(2): objects files and/or libraries
# $(3): options
#
define env_dynamic-library
dynamic_library_options="" && \
$(call env_display,magenta,DYNAMIC-LIBRARY,$(1), ,) && \
$(call env_perform, \
$(_LD_) --shared $(_LD_FLAGS_) $${dynamic_library_options} \
-o $(1) $(2))
endef
#
# create an executable file from object file and/or library files
#
# $(1): executable file name
# $(2): objects files and/or libraries
# $(3): layout file
# $(4): options
#
define env_executable
executable_options="" && \
if [ -n "$(3)" ] ; then \
executable_options="$${executable_options} -T $(3)" ; \
fi && \
if [ -n "$(4)" ] ; then \
if [ $$(( $(4) & $(ENV_OPTION_NO_STANDARD) )) -ne 0 ] ; then \
executable_options="$${executable_options} -nostdinc -nostdlib" ; \
fi ; \
fi && \
$(call env_display,magenta,EXECUTABLE,$(1), ,) && \
$(call env_perform, \
$(_CC_) $(_CC_FLAGS_) $(_LD_FLAGS_) $${executable_options} -o $(1) \
$(2) "`$(_CC_) -print-libgcc-file-name`")
endef
#
# create an archive file from multiple object files
#
# note that the archive file is also an object file
#
# $(1): archive file name
# $(2): objects files and/or libraries
# $(3): options
#
define env_archive
archive_options="" && \
$(call env_display,magenta,ARCHIVE,$(1), ,) && \
$(call env_perform, \
$(_LD_) -r $(_LD_FLAGS_) $${archive_options} -o $(1) $(2))
endef
#
# remove the files
#
# $(1): files
# $(2): options
#
define env_remove
remove_options="" && \
for f in $(1) ; do \
if [ -e $${f} ] ; then \
$(call env_display,red,REMOVE,$${f}, ,) ; \
fi && \
$(call env_perform, \
$(_RM_) $${remove_options} $${f}) ; \
done
endef
#
# purge i.e clean the directory from unwanted files
#
define env_purge
$(call env_display,red,PURGE,,,) && \
$(call env_perform, \
$(_PURGE_))
endef
#
# generate prototypes from a source file
#
# $(1): file list
# $(2): options
#
define env_prototypes
prototypes_options="" && \
for f in $(1) ; do \
if [ -e $${f} ] ; then \
$(call env_display,yellow,PROTOTYPES,$${f}, ,) && \
$(call env_launch,$(_MKP_TOOL_), \
$${prototypes_options} $${f},) ; \
fi ; \
done
endef
#
# genereate header dependencies
#
# $(1): the files for which the dependencies are generated
# $(2): options
#
define env_headers
headers_options="" && \
for f in $(1) ; do \
if [ -e $${f} ] ; then \
$(call env_display,yellow,HEADERS,$$f, ,) && \
$(call env_perform, \
$(_CC_) $(_CC_FLAGS_) -M -MG $${headers_options} \
$${f} >> $(_DEPENDENCY_MK_)) ; \
fi ; \
done
endef
#
# generate a version file
#
# $(1): the version file to generate
#
define env_version
$(call env_display,yellow,VERSION,$(1), ,) && \
$(_ECHO_) -n "" > $(1) && \
$(_ECHO_) -n "const char version[] = \"$(_TITLE_)-$(_VERSION_)" >> $(1) && \
$(_ECHO_) " "$(shell $(_DATE_))" $(USER)@$(HOSTNAME)\";" >> $(1)
endef
#
# create a link between two files
#
# $(1): link created
# $(2): destination
# $(3): options
#
define env_link
link_options="" && \
$(call env_display,cyan,LINK,$(1), ,) && \
$(call env_perform, \
$(_LN_) $${link_options} $(2) $(1))
endef
#
# compile a tex document
#
# $(1): the file name without extension
# $(2): options
#
define env_compile-tex
compile_tex_options="" && \
$(call env_display,green,COMPILE-TEX,$(1), ,) && \
$(call env_perform, \
$(_PDFLATEX_) $${compile_tex_options} $(1)) && \
$(call env_perform, \
$(_PDFLATEX_) $${compile_tex_options} $(1)) && \
$(call env_perform, \
$(_BIBTEX_) $(1)) && \
$(call env_perform, \
$(_BIBTEX_) $(1)) && \
$(call env_perform, \
$(_PDFLATEX_) $${compile_tex_options} $(1)) ; \
$(call env_perform, \
$(_PDFLATEX_) $${compile_tex_options} $(1))
endef
#
# build a document
#
# $(1): the file name without extension
# $(2): options
#
define env_document
$(call env_remove,$(_DEPENDENCY_TEX_),) && \
if [ -n "$(2)" ] ; then \
if [ $$(( $(2) & $(ENV_OPTION_PRIVATE) )) -ne 0 ] ; then \
$(_ECHO_) '\def\mode{private}' > $(_DEPENDENCY_TEX_) ; \
fi ; \
fi && \
if [ ! -f $(_DEPENDENCY_TEX_) ] ; then \
$(_ECHO_) '\def\mode{public}' > $(_DEPENDENCY_TEX_) ; \
fi && \
$(call env_compile-tex,$(1),$(2))
endef
#
# launch a document viewer
#
# $(1): the file name without extension
# $(2): options
#
define env_view
$(call env_display,yellow,VIEW,$(1), ,) && \
$(call env_perform, \
$(_XPDF_) $(1).pdf)
endef
#
# ---------- component-based behaviour ----------------------------------------
#
#
# kaneton
#
ifneq ($(call findstring,kaneton,$(components)),)
_CC_FLAGS_ += -D___kaneton$$\kernel
endif

View file

@ -0,0 +1,239 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kaneton/environment/profile/host/linux/linux.py
#
# created julien quintard [tue may 8 13:20:21 2007]
# updated julien quintard [sat mar 5 09:13:35 2011]
#
#
# ---------- information ------------------------------------------------------
#
# this file implements the remaining functions of the kaneton python interface.
#
# note that the host profile already provides many functions. these
# functions can be overriden but you will probably just use them.
#
# in addition, the host profile already imports some packages.
#
#
# ---------- lang -------------------------------------------------------------
#
# incorrect locales may prevent the system from compiling properly.
#
# the following forces the LANG environment variable to US.
#
os.putenv("LANG", "US")
#
# ---------- python path ------------------------------------------------------
#
_pythonpath_ = os.getenv("PYTHONPATH")
if not _pythonpath_:
os.putenv("PYTHONPATH", _PYTHON_INCLUDE_DIR_)
else:
os.putenv("PYTHONPATH", _pythonpath_ + ":" + _PYTHON_INCLUDE_DIR_)
#
# ---------- functions --------------------------------------------------------
#
#
# colorize()
#
# this function returns a colorized text if the environment is configured
# to or simply the original text.
#
# note that this function implementation is based on UNIX escape sequences.
#
def colorize(text, color, options):
if _DISPLAY_ == _DISPLAY_UNCOLORED_:
return text
if options & OPTION_FLICKERING:
text = "" + text
if options & OPTION_BOLD:
text = "" + text
if color == COLOR_BLACK:
text = "" + text
elif color == COLOR_RED:
text = "" + text
elif color == COLOR_GREEN:
text = "" + text
elif color == COLOR_YELLOW:
text = "" + text
elif color == COLOR_BLUE:
text = "" + text
elif color == COLOR_MAGENTA:
text = "" + text
elif color == COLOR_CYAN:
text = "" + text
elif color == COLOR_WHITE:
text = "" + text
return text + ""
#
# launch()
#
# this function launch a new program/script/make etc.
#
def launch(file, arguments, options):
directory = None
info = None
status = 0
wd = None
if options & OPTION_QUIET:
output = " >/dev/null 2>&1"
else:
output = ""
info = os.path.split(file)
directory = info[0]
file = info[1]
if directory:
wd = cwd(OPTION_NONE)
cd(directory, OPTION_NONE)
if re.match("^.*\.sh$", file):
status = os.system(_SHELL_ + " " + file + " " + arguments + output)
elif re.match("^.*\.py$", file):
status = os.system(_PYTHON_ + " " + file + " " + arguments + output)
elif re.match("^.*\.pl$", file):
status = os.system(_PERL_ + " " + file + " " + arguments + output)
elif re.match("^Makefile$", file):
status = os.system(_MAKE_ + " -f " + file + " " + arguments + output)
else:
if directory:
file = "./" + file
status = os.system(file + " " + arguments + output)
if directory:
cd(wd, OPTION_NONE)
return status
#
# pack()
#
# this function creates an archive of the given directory.
#
def pack(directory, file, options):
launch(_TAR_, "-cjf " + file + " " + directory, OPTION_NONE)
#
# unpack()
#
# this function unpackages an archive into the given (optional) directory.
#
def unpack(file, directory, options):
if directory:
launch(_TAR_, "-xjf " + file + " -C " + directory, OPTION_NONE)
else:
launch(_TAR_, "-xjf " + file, OPTION_NONE)
#
# load()
#
# this function copies a file on a device, this device can be virtual:
# an image.
#
def load(file, device, path, options):
if options == OPTION_DEVICE:
return launch(_MCOPY_, "-o -n " + file + " " + device + path,
OPTION_NONE)
elif options == OPTION_IMAGE:
return launch(_MCOPY_, "-o -n " + "-i" + device + " " +
file + " ::" + path, OPTION_NONE)
#
# record()
#
# this function runs the program recording a session.
#
def record(transcript, options):
directory = None
time = None
log = None
tmp = None
wd = None
tmp = temporary(OPTION_DIRECTORY)
directory = tmp + "/" + "transcript"
log = directory + "/" + "log"
time = directory + "/" + "time"
mkdir(directory, OPTION_NONE)
launch(_SCRIPT_, "-q -t " + log + " -c " +
_TRANSCRIPT_CMD_ + " 2> " + time, OPTION_NONE)
wd = cwd(OPTION_NONE)
cd(tmp, OPTION_NONE)
pack("transcript", wd + "/" + transcript, OPTION_NONE)
cd(wd, OPTION_NONE)
remove(tmp, OPTION_NONE)
#
# play()
#
# this function runs the program replaying a session.
#
def play(transcript, options):
directory = None
time = None
log = None
tmp = None
wd = None
tmp = temporary(OPTION_DIRECTORY)
log = tmp + "/" + "transcript/log"
time = tmp + "/" + "transcript/time"
unpack(transcript, tmp, OPTION_NONE)
launch(_REPLAY_TOOL_, time + " " + log, OPTION_NONE)
remove(tmp, OPTION_NONE)
#
# locate()
#
# this function tries to locate a program on the system.
#
def locate(file, options):
return launch(_WHICH_, file + " 1>/dev/null 2>/dev/null", OPTION_NONE)

View file

@ -0,0 +1,152 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kane...vironment/profile/kaneton/core/core.conf
#
# created julien quintard [tue may 8 13:42:57 2007]
# updated julien quintard [sun nov 28 19:36:43 2010]
#
#
# ---------- information ------------------------------------------------------
#
# these variables are core-dependent are used to parameterise the kernel.
#
#
# ---------- flags ------------------------------------------------------------
#
_CORE_FLAGS_ = ${_AS_FLAGS_} \
${_CAPABILITY_FLAGS_} \
${_CPU_FLAGS_} \
${_EVENT_FLAGS_} \
${_ID_FLAGS_} \
${_INTERFACE_FLAGS_} \
${_IO_FLAGS_} \
${_KERNEL_FLAGS_} \
${_MAP_FLAGS_} \
${_MESSAGE_FLAGS_} \
${_REGION_FLAGS_} \
${_SCHEDULER_FLAGS_} \
${_SEGMENT_FLAGS_} \
${_SET_FLAGS_} \
${_TASK_FLAGS_} \
${_THREAD_FLAGS_} \
${_TIME_FLAGS_}
#
# ---------- as manager -------------------------------------------------------
#
_AS_FLAGS_ =
#
# ---------- capability manager -----------------------------------------------
#
_CAPABILITY_FLAGS_ =
#
# ---------- cpu manager ------------------------------------------------------
#
_CPU_FLAGS_ =
#
# ---------- event manager ----------------------------------------------------
#
_EVENT_FLAGS_ =
#
# ---------- id manager -------------------------------------------------------
#
_ID_FLAGS_ =
#
# ---------- interface manager ------------------------------------------------
#
_INTERFACE_FLAGS_ =
#
# ---------- io manager -------------------------------------------------------
#
_IO_FLAGS_ =
#
# ---------- kernel manager ---------------------------------------------------
#
_KERNEL_FLAGS_ =
#
# ---------- map manager ------------------------------------------------------
#
_MAP_FLAGS_ =
#
# ---------- message manager --------------------------------------------------
#
_MESSAGE_FLAGS_ =
#
# ---------- region manager ---------------------------------------------------
#
_REGION_FLAGS_ = ${_REGION_ALGORITHM_} \
${_REGION_FIT_}
_REGION_ALGORITHM_ = -DREGION_ALGORITHM=REGION_ALGORITHM_FIT
_REGION_FIT_ = -DREGION_FIT=FIT_FIRST
#
# ---------- scheduler manager ------------------------------------------------
#
_SCHEDULER_FLAGS_ = ${_SCHEDULER_ALGORITHM_}
_SCHEDULER_ALGORITHM_ = -DSCHEDULER_ALGORITHM=SCHEDULER_ALGORITHM_MFQ
#
# ---------- segment manager --------------------------------------------------
#
_SEGMENT_FLAGS_ = ${_SEGMENT_ALGORITHM_} \
${_SEGMENT_FIT_}
_SEGMENT_ALGORITHM_ = -DSEGMENT_ALGORITHM=SEGMENT_ALGORITHM_FIT
_SEGMENT_FIT_ = -DSEGMENT_FIT=FIT_FIRST
#
# ---------- set manager ------------------------------------------------------
#
_SET_FLAGS_ =
#
# ---------- task manager -----------------------------------------------------
#
_TASK_FLAGS_ =
#
# ---------- thread manager ---------------------------------------------------
#
_THREAD_FLAGS_ =
#
# ---------- time manager -----------------------------------------------------
#
_TIME_FLAGS_ =

View file

@ -0,0 +1,26 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kane...vironment/profile/kaneton/core/core.desc
#
# created julien quintard [tue may 8 13:43:36 2007]
# updated julien quintard [thu may 31 21:49:29 2007]
#
#
# ---------- information ------------------------------------------------------
#
# this files contains the core variable descriptions.
#
- variable: _SEGMENT_LOOKUP_ALGORITHM_
string: Segment Manager Algorithm
type: set
values:
First Fit: -DSEGMENT_LOOKUP_ALGORITHM=FIT_FIRST
Best Fit: -DSEGMENT_LOOKUP_ALGORITHM=FIT_BEST
description: Specify the type of algorithm to use.

View file

@ -0,0 +1,34 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kane...environment/profile/kaneton/kaneton.conf
#
# created julien quintard [tue may 8 13:26:13 2007]
# updated julien quintard [sat feb 5 12:17:24 2011]
#
#
# ---------- information ------------------------------------------------------
#
# this file contains general kaneton microkernel configuration variables.
#
#
# ---------- general ----------------------------------------------------------
#
_TITLE_ = kaneton
_VERSION_ = 0.7
#
# ---------- flags ------------------------------------------------------------
#
_KANETON_FLAGS_ = ${_CORE_FLAGS_} \
${_MACHINE_FLAGS_} \
${_LIBRARY_FLAGS_} \
${_MODULES_FLAGS_}

View file

@ -0,0 +1,12 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kaneton/environment/profile/kaneton/kaneton.desc
#
# created julien quintard [tue may 8 13:42:18 2007]
# updated julien quintard [tue may 8 13:42:18 2007]
#

View file

@ -0,0 +1,24 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kane...ent/profile/kaneton/library/library.conf
#
# created julien quintard [fri may 1 20:05:33 2009]
# updated julien quintard [fri may 1 20:05:55 2009]
#
#
# ---------- information ------------------------------------------------------
#
# this file contains the configuration of the in-kernel library.
#
#
# ---------- flags ------------------------------------------------------------
#
_LIBRARY_FLAGS_ =

View file

@ -0,0 +1,12 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kane...ent/profile/kaneton/library/library.desc
#
# created julien quintard [fri may 1 20:06:04 2009]
# updated julien quintard [fri may 1 20:06:05 2009]
#

View file

@ -0,0 +1,24 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kane...ent/profile/kaneton/machine/machine.conf
#
# created julien quintard [fri may 1 19:37:15 2009]
# updated julien quintard [fri may 1 19:37:48 2009]
#
#
# ---------- information ------------------------------------------------------
#
# this file contains the machine configuration such as flags etc.
#
#
# ---------- flags ------------------------------------------------------------
#
_MACHINE_FLAGS_ =

View file

@ -0,0 +1,12 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kane...ent/profile/kaneton/machine/machine.desc
#
# created julien quintard [fri may 1 19:38:08 2009]
# updated julien quintard [fri may 1 19:38:08 2009]
#

View file

@ -0,0 +1,12 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/enguerrand/...achine/platform/qemu-mips/qemu-mips.conf
#
# created enguerrand raymond [sat apr 11 01:29:35 2009]
# updated enguerrand raymond [tue may 12 00:48:19 2009]
#

View file

@ -0,0 +1,64 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kane...ent/profile/kaneton/modules/modules.conf
#
# created julien quintard [fri may 1 19:28:05 2009]
# updated julien quintard [sun dec 5 00:59:12 2010]
#
#
# ---------- information ------------------------------------------------------
#
# this file contains information related to kaneton static modules.
#
#
# ---------- modules ----------------------------------------------------------
#
_MODULES_ = console report
#
# ---------- flags ------------------------------------------------------------
#
_MODULES_FLAGS_ = ${_MODULE_CONSOLE_FLAGS_} \
${_MODULE_FORWARD_FLAGS_} \
${_MODULE_TEST_FLAGS_} \
${_MODULE_BUNDLE_FLAGS_} \
${_MODULE_REPORT_FLAGS_}
#
# ---------- console ----------------------------------------------------------
#
_MODULE_CONSOLE_FLAGS_ =
#
# ---------- forward ----------------------------------------------------------
#
_MODULE_FORWARD_FLAGS_ =
#
# ---------- test -------------------------------------------------------------
#
_MODULE_TEST_FLAGS_ =
#
# ---------- bundle -----------------------------------------------------------
#
_MODULE_BUNDLE_FLAGS_ =
#
# ---------- report -----------------------------------------------------------
#
_MODULE_REPORT_FLAGS_ =

View file

@ -0,0 +1,12 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kane...ent/profile/kaneton/modules/modules.desc
#
# created julien quintard [fri may 1 19:36:15 2009]
# updated julien quintard [fri may 1 19:36:15 2009]
#

View file

@ -0,0 +1,39 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kane...ironment/profile/user/sample/sample.conf
#
# created julien quintard [sat jun 9 22:40:33 2007]
# updated julien quintard [thu mar 3 18:18:10 2011]
#
#
# ---------- information ------------------------------------------------------
#
# a sample of the user configuration file.
#
#
# ---------- boot stuff -------------------------------------------------------
#
_MBL_SCRIPT_ = ${_MBL_DIR_}/grub/grub.py
_BOOT_MODE_ = image
_BOOT_DEVICE_ = floppy
#
# ---------- environment ------------------------------------------------------
#
_OUTPUT_ = ${_OUTPUT_VERBOSE_}
#
# ---------- inputs -----------------------------------------------------------
#
#_INPUTS_ += ${_SAMPLE_DIR_}/chiche/chiche

View file

@ -0,0 +1,33 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kaneton/environment/profile/user/test/test.conf
#
# created julien quintard [thu apr 16 04:29:52 2009]
# updated julien quintard [sat dec 18 21:24:24 2010]
#
#
# ---------- boot -------------------------------------------------------------
#
_MBL_SCRIPT_ = ${_MBL_DIR_}/grub/grub.py
_BOOT_MODE_ = image
_BOOT_DEVICE_ = floppy
#
# ---------- modules ----------------------------------------------------------
#
_MODULES_ += bundle test
#
# ---------- display ----------------------------------------------------------
#
_DISPLAY_ = ${_DISPLAY_UNCOLORED_}

View file

@ -0,0 +1,65 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kaneton/environment/profile/user/user.conf
#
# created julien quintard [tue may 8 10:47:42 2007]
# updated julien quintard [sat may 7 14:13:14 2011]
#
#
# ---------- information ------------------------------------------------------
#
# this file defines the default user profile environment variables.
#
#
# ---------- display ----------------------------------------------------------
#
_DISPLAY_UNCOLORED_ = 1
_DISPLAY_COLORED_ = 2
_DISPLAY_ = ${_DISPLAY_COLORED_}
#
# ---------- output -----------------------------------------------------------
#
_OUTPUT_PRETTY_ = 1
_OUTPUT_VERBOSE_ = 2
_OUTPUT_ = ${_OUTPUT_PRETTY_}
#
# ---------- cheat ------------------------------------------------------------
#
_CHEAT_FILTER_ = configure \
environment \
license \
tool \
transcript
#
# ---------- transcript -------------------------------------------------------
#
_TRANSCRIPT_CMD_ = ${_SHELL_}
#
# ---------- test -------------------------------------------------------------
#
_TEST_SERVER_ = https://test.opaak.org:8421
_TEST_CAPABILITY_ = ${_PROFILE_USER_DIR_}/${_USER_}.cap
_TEST_PLATFORM_ = ${_PLATFORM_}
_TEST_ARCHITECTURE_ = ${_ARCHITECTURE_}
_TEST_NAME_ = <null>
_TEST_EMAIL_ = <null>

View file

@ -0,0 +1,26 @@
#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/kaneton/environment/profile/user/user.desc
#
# created julien quintard [fri may 25 09:36:30 2007]
# updated julien quintard [thu may 31 21:49:03 2007]
#
#
# ---------- information ------------------------------------------------------
#
# this file contains the description of the user variables.
#
- variable: _DISPLAY_
string: Display Colorization
type: set
values:
Uncolored: ${_DISPLAY_UNCOLORED_}
Colored: ${_DISPLAY_COLORED_}
description: Activate or not the colorization of the environment messages.