From 987c4882f983451cc6a2eefab9b1f19ce64469f6 Mon Sep 17 00:00:00 2001 From: "benjamin%smedbergs.us" Date: Thu, 30 Nov 2006 16:43:12 +0000 Subject: [PATCH] Bug 362264 - Cross-platform Tamarin build system (early initial cut, only builds on mac-x86 right now), a=stejohns --- js/tamarin/MMgc/manifest.mk | 42 +++++++ js/tamarin/build/__init__.py | 5 + js/tamarin/build/calcdepends.py | 86 +++++++++++++ js/tamarin/build/config.mk | 127 +++++++++++++++++++ js/tamarin/build/configuration.py | 188 ++++++++++++++++++++++++++++ js/tamarin/build/dependparser.py | 26 ++++ js/tamarin/build/getopt.py | 74 +++++++++++ js/tamarin/build/process.py | 14 +++ js/tamarin/build/rules.mk | 31 +++++ js/tamarin/codegen/manifest.mk | 18 +++ js/tamarin/configure.py | 58 +++++++++ js/tamarin/core/manifest.mk | 78 ++++++++++++ js/tamarin/manifest.mk | 22 ++++ js/tamarin/pcre/manifest.mk | 18 +++ js/tamarin/platform/mac/manifest.mk | 7 ++ js/tamarin/shell/manifest.mk | 27 ++++ 16 files changed, 821 insertions(+) create mode 100644 js/tamarin/MMgc/manifest.mk create mode 100644 js/tamarin/build/__init__.py create mode 100755 js/tamarin/build/calcdepends.py create mode 100644 js/tamarin/build/config.mk create mode 100644 js/tamarin/build/configuration.py create mode 100755 js/tamarin/build/dependparser.py create mode 100644 js/tamarin/build/getopt.py create mode 100644 js/tamarin/build/process.py create mode 100644 js/tamarin/build/rules.mk create mode 100644 js/tamarin/codegen/manifest.mk create mode 100755 js/tamarin/configure.py create mode 100644 js/tamarin/core/manifest.mk create mode 100644 js/tamarin/manifest.mk create mode 100644 js/tamarin/pcre/manifest.mk create mode 100644 js/tamarin/platform/mac/manifest.mk create mode 100644 js/tamarin/shell/manifest.mk diff --git a/js/tamarin/MMgc/manifest.mk b/js/tamarin/MMgc/manifest.mk new file mode 100644 index 000000000000..7eb94fb8a754 --- /dev/null +++ b/js/tamarin/MMgc/manifest.mk @@ -0,0 +1,42 @@ +STATIC_LIBRARIES += MMgc +MMgc_BUILD_ALL = 1 + +MMgc_CXXSRCS := $(MMgc_CXXSRCS) \ + $(curdir)/MMgc.cpp \ + $(curdir)/FixedAlloc.cpp \ + $(curdir)/FixedMalloc.cpp \ + $(curdir)/GC.cpp \ + $(curdir)/GCAlloc.cpp \ + $(curdir)/GCHashtable.cpp \ + $(curdir)/GCHeap.cpp \ + $(curdir)/GCLargeAlloc.cpp \ + $(curdir)/GCMemoryProfiler.cpp \ + $(curdir)/GCObject.cpp \ + $(curdir)/GCTests.cpp \ + $(NULL) + +ifeq (windows,$(TARGET_OS)) +MMgc_CXXSRCS := $(MMgc_CXXSRCS) \ + $(curdir)/GCAllocObjectWin.cpp \ + $(curdir)/GCDebugWin.cpp \ + $(curdir)/GCHeapWin.cpp \ + $(NULL) +endif + +ifeq (darwin,$(TARGET_OS)) +MMgc_CXXSRCS := $(MMgc_CXXSRCS) \ + $(curdir)/GCAllocObjectMac.cpp \ + $(curdir)/GCDebugMac.cpp \ + $(curdir)/GCHeapMac.cpp \ + $(NULL) +endif + +ifeq (linux,$(TARGET_OS)) +MMgc_CXXSRCS := $(MMgc_CXXSRCS) \ + $(curdir)/GCAllocObjectUnix.cpp \ + $(curdir)/GCDebugUnix.cpp \ + $(curdir)/GCHeapUnix.cpp \ + $(NULL) +endif + +$(curdir)/GCDebugMac.$(OBJ_SUFFIX): CXXFLAGS += -Wno-deprecated-declarations diff --git a/js/tamarin/build/__init__.py b/js/tamarin/build/__init__.py new file mode 100644 index 000000000000..abaec878f246 --- /dev/null +++ b/js/tamarin/build/__init__.py @@ -0,0 +1,5 @@ +__all__ = [ + 'build', + 'process', + 'getopt' + ] diff --git a/js/tamarin/build/calcdepends.py b/js/tamarin/build/calcdepends.py new file mode 100755 index 000000000000..7170c9e1b08f --- /dev/null +++ b/js/tamarin/build/calcdepends.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python + +import os +from stat import * + +class StatCache: + def __init__(self): + self._dict = {} + + def getStat(self, key): + if not key in self._dict: + try: + self._dict[key] = os.stat(key) + except OSError: + self._dict[key] = None + + return self._dict[key] + + def getMTime(self, key): + s = self.getStat(key); + if s == None: + return 0; + + return s.st_mtime + +_statcache = StatCache() + +def rebuildNeeded(file, dependencies): + """Calculate whether a file needs to be rebuilt by comparing its timestamp + against a list of dependencies. + + returns True or False""" + + f = _statcache.getMTime(file) + if f == 0: + return True + + for dep in dependencies: + d = _statcache.getMTime(dep) + if d == 0 or d > f: + return True + + return False + +def rebuildsNeeded(files, outfile): + """Write a makefile snippet indicating whether object files need to be + rebuilt. + + @param files: a dictionary of { 'objfile', 'depfile' }""" + + ostream = open(outfile, "w") + + for (objfile, depfile) in files.items(): + rebuild = True + + try: + d = open(depfile, "r") + rebuild = \ + rebuildNeeded(objfile, \ + [line.rstrip("\n\r") for line in d.readlines()]) + d.close() + + except IOError: + pass + + if rebuild: + ostream.write(objfile + ": FORCE\n") + + ostream.close() + +if __name__ == "__main__": + import sys + import re + + _argExpr = re.compile("\\.(ii)$") + + files = {} + + sys.argv.pop(0) + outfile = sys.argv.pop(0) + + for objfile in sys.argv: + depfile = _argExpr.sub(".deps", objfile) + files[objfile] = depfile + + rebuildsNeeded(files, outfile) diff --git a/js/tamarin/build/config.mk b/js/tamarin/build/config.mk new file mode 100644 index 000000000000..6e0517b7137e --- /dev/null +++ b/js/tamarin/build/config.mk @@ -0,0 +1,127 @@ +GARBAGE := + +VPATH = $(topsrcdir) + +curdir := . +srcdir := $(topsrcdir) + +COMPILE_CPPFLAGS = $(CPPFLAGS) $(APP_CPPFLAGS) +COMPILE_CXXFLAGS = $(CXXFLAGS) $(APP_CXXFLAGS) + +ifdef ENABLE_DEBUG +COMPILE_CPPFLAGS += $(DEBUG_CPPFLAGS) +COMPILE_CXXFLAGS += $(DEBUG_CXXFLAGS) +else +COMPILE_CPPFLAGS += $(OPT_CPPFLAGS) +COMPILE_CXXFLAGS += $(OPT_CXXFLAGS) +endif + +all:: + +# Usage: from within RECURSE_DIRS +# Variables: +# $(1) = $(curdir) +# $(2) = subdirectory +# Note: positional parameters passed to $(call) are expanded "early". This is +# the magic that sets and revert $(curdir) and $(srcdir) properly. +define RECURSE_DIR +curdir := $(1)/$(2) +srcdir := $(topsrcdir)/$$(curdir) +include $(topsrcdir)/$$(curdir)/manifest.mk +curdir := $(1) +endef + +# Usage: $(call REAL_RECURSE_DIRS,$(DIRS),$(curdir)) +define REAL_RECURSE_DIRS +$(foreach dir,$(1),$(eval $(call RECURSE_DIR,$(2),$(dir)))) +endef + +# Usage: $(call RECURSE_DIRS,$(DIRS))) +define RECURSE_DIRS +$(call REAL_RECURSE_DIRS,$(1),$(curdir)) +endef + +# Usage: $(eval $(call THING_SRCS,$(thingname))) +define THING_SRCS +$(1)_CPPFLAGS ?= $(COMPILE_CPPFLAGS) +$(1)_CXXFLAGS ?= $(COMPILE_CXXFLAGS) +$(1)_CPPFLAGS += $($(1)_EXTRA_CPPFLAGS) +$(1)_CXXFLAGS += $($(1)_EXTRA_CXXFLAGS) +$(1)_INCLUDES += $(INCLUDES) +$(1)_DEFINES += $(DEFINES) + +$(1)_CXXOBJS = $$($(1)_CXXSRCS:%.cpp=%.$(OBJ_SUFFIX)) + +GARBAGE += \ + $$($(1)_CXXOBJS) \ + $$($(1)_CXXOBJS:.$(OBJ_SUFFIX)=.ii) \ + $$($(1)_CXXOBJS:.$(OBJ_SUFFIX)=.deps) \ + $(NULL) + +ifndef PP_PRECIOUS +.INTERMEDIATE: $$($(1)_CXXOBJS:.$(OBJ_SUFFIX)=.ii) +endif + +# XXX Add dependency handling! +$$($(1)_CXXOBJS:.$(OBJ_SUFFIX)=.ii): %.ii: %.cpp + test -d $$(dir $$@) || mkdir -p $$(dir $$@) + $(CXX) -E $$($(1)_CPPFLAGS) $$($(1)_CXXFLAGS) $$($(1)_DEFINES) $$($(1)_INCLUDES) \ + $$< > $$@ + $(PYTHON) $(topsrcdir)/build/dependparser.py $$*.deps < $$@ > /dev/null + +$$($(1)_CXXOBJS): %.$(OBJ_SUFFIX): %.ii + $(CXX) -o $$@ $$($(1)_CPPFLAGS) $$($(1)_CXXFLAGS) $$($(1)_DEFINES) $$($(1)_INCLUDES) -c $$< + +$(1).thing.pp: FORCE + @echo Building $$@ + @$(PYTHON) $(topsrcdir)/build/calcdepends.py $$@ $$($(1)_CXXOBJS:$(OBJ_SUFFIX)=.ii) + +include $(1).thing.pp + +endef # THINGS_SRCS + +# Usage: $(eval $(call STATIC_LIBRARY_RULES,$(static_library_thingname))) +define STATIC_LIBRARY_RULES + $(1)_BASENAME ?= $(1) + $(1)_NAME = $(LIB_PREFIX)$$($(1)_BASENAME).$(LIB_SUFFIX) + +$$($(1)_DIR)$$($(1)_NAME): $$($(1)_CXXOBJS) + $(call MKSTATICLIB,$$@) $$($(1)_CXXOBJS) + +GARBAGE += $$($(1)_DIR)$$($(1)_NAME) + +ifdef $(1)_BUILD_ALL +all:: $$($(1)_DIR)$$($(1)_NAME) +endif + +endef + +# Usage: $(eval $(call PROGRAM_RULES,$(program_thingnaame))) +define PROGRAM_RULES + $(1)_BASENAME ?= $(1) + $(1)_NAME ?= $$($(1)_BASENAME)$(BIN_SUFFIX) + $(1)_DEPS = \ + $$($(1)_EXTRA_DEPS) \ + $$(foreach lib,$$($(1)_STATIC_LIBRARIES),$$($$(lib)_NAME)) \ + $(NULL) + $(1)_LDFLAGS = \ + $$(LDFLAGS) \ + $$(foreach lib,$$(OS_LIBS),$(call EXPAND_LIBNAME,$$(lib))) \ + $$(OS_LDFLAGS) \ + $(NULL) + +$$($(1)_DIR)$$($(1)_NAME): $$($(1)_CXXOBJS) $$($(1)_DEPS) + $(call MKPROGRAM,$$@) \ + $$($(1)_CXXOBJS) \ + -L. $$(foreach lib,$$($(1)_STATIC_LIBRARIES),-l$$(lib)) \ + $$($(1)_LDFLAGS) + +GARBAGE += $$($(1)_DIR)$$($(1)_NAME) + +ifdef $(1)_BUILD_ALL +all:: $$($(1)_DIR)$$($(1)_NAME) +endif + +endef + +.PHONY: all FORCE diff --git a/js/tamarin/build/configuration.py b/js/tamarin/build/configuration.py new file mode 100644 index 000000000000..2f22d2db145a --- /dev/null +++ b/js/tamarin/build/configuration.py @@ -0,0 +1,188 @@ +import os +import sys +import build.process +import re + +# Figure out TARGET and CPU, a la config.guess +# Do cross-compilation in the future, which will require HOST_OS and perhaps +# other settings + +def _configGuess(): + ostest = sys.platform + if re.match('^win', ostest): + os = 'windows' + elif ostest == 'darwin': + os = 'darwin' + elif ostest.search('^linux', ostest): + os = 'linux' + else: + raise Exception('Unrecognized OS: ' + ostest) + + cputest = build.process.run_for_output(['uname', '-m']) + if re.search(r'^i(\d86|86pc|x86)$', cputest): + cpu = 'i686' + elif re.search('^(x86_64|amd64)$', cputest): + cpu = 'x86_64' + elif re.search('^(ppc|powerpc)$', cputest): + cpu = 'powerpc' + else: + raise Exception('Unrecognized CPU: ' + cputest) + + return (os, cpu) + +class Configuration: + def __init__(self, topsrcdir, options=None, sourcefile=None, objdir=None, + optimize=True, debug=False): + self._topsrcdir = topsrcdir + if objdir: + self._objdir = objdir + else: + self._objdir = os.getcwd() + + self._optimize = optimize + self._debug = debug + self._host = _configGuess() + self._target = self._host + + if sourcefile: + srcfile = self._topsrcdir + "/" + sourcefile + if not os.path.exists(srcfile): + raise Exception("Source file " + srcfile + " doesn't exist.") + + objfile = self._objdir + "/" + sourcefile + if os.path.exists(objfile): + raise Exception("Object file " + objfile + " exists, and shouldn't. You must use an object directory to build Tamarin.") + + if options: + o = options.getStringArg("optimize") + + if o != None: + self._optimize = o + + d = options.getStringArg("debug") + if d != None: + self._debug = d + + if options.host: + self._host = _configSub(options.host) + + if options.target: + self._target = _configSub(options.target) + + self._acvars = { + 'topsrcdir': self._topsrcdir, + 'HOST_OS': self._host[0], + 'TARGET_OS': self._target[0], + 'TARGET_CPU': self._target[1] + } + + if self._debug: + self._acvars['ENABLE_DEBUG'] = 1 + + def getHost(self): + """Returns an (os, cpu) tuple of the host machine.""" + return self._host + + def getTarget(self): + """Returns an (os, cpu) tuple of the target machine.""" + return self._target + + def getCompiler(self): + self.COMPILER_IS_GCC = True + self._acvars.update({ + 'OBJ_SUFFIX': 'o', + 'LIB_PREFIX': 'lib', + 'LIB_SUFFIX': 'a', + 'DLL_SUFFIX': 'so', + 'PROGRAM_SUFFIX': '', + 'USE_COMPILER_DEPS': 1, + 'OS_LIBS' : 'z', + 'EXPAND_LIBNAME' : '-l$(1)' + }) + + if self._target[0] == 'windows': + self.COMPILER_IS_GCC = False + del self._acvars['USE_COMPILER_DEPS'] + self._acvars.update({ + 'OBJ_SUFFIX' : 'obj', + 'LIB_PREFIX' : '', + 'LIB_SUFFIX' : 'lib', + 'DLL_SUFFIX' : 'dll', + 'PROGRAM_SUFFIX': '.exe', + 'CPPFLAGS' : '-MT', + 'CXX' : 'cl.exe', + 'CXXFLAGS' : '', + 'AR' : 'lib.exe', + 'LD' : 'link.exe', + 'LDFLAGS' : '', + 'MKSTATICLIB' : '$(AR) -OUT:$(1)', + 'MKPROGRAM' : '$(LD) -OUT:$(1)', + 'EXPAND_LIBNAME' : '$(1).lib' + }) + if debug: + self._acvars['CPPFLAGS'] = '-MTD' + + # Hackery! Make assumptions that we want to build with GCC 3.3 on MacPPC + # and GCC4 on MacIntel + elif self._target[0] == 'darwin': + self._acvars.update({ + 'DLL_SUFFIX' : 'dylib', + 'CPPFLAGS' : '-pipe', + 'CXXFLAGS' : '', + 'LDFLAGS' : '-lz -framework CoreServices', + 'AR' : 'ar', + 'MKSTATICLIB' : '$(AR) cr $(1)', + 'MKPROGRAM' : '$(CXX) -o $(1)' + }) + +# -Wno-trigraphs -Wreturn-type -Wnon-virtual-dtor -Wmissing-braces -Wparentheses -Wunused-label -Wunused-parameter -Wunused-variable -Wunused-value -Wuninitialized + + if self._target[1] == 'i686': + self._acvars['CXX'] = 'g++-4.0' + elif self._target[1] == 'powerpc': + self._acvars['CXX'] = 'g++-3.3' + else: + raise Exception("Unexpected Darwin processor.") + + elif self._target[0] == 'linux': + self._acvars.update({ + 'CPPFLAGS' : '', + 'CXX' : 'g++', + 'CXXFLAGS' : '', + 'LD' : 'ar', + 'LDFLAGS' : '', + 'MKSTATICLIB' : '$(AR) cr $(1)', + 'MKPROGRAM' : '$(CXX) -o $(1)' + }) + + def subst(self, name, value): + self._acvars[name] = value + + _confvar = re.compile("@([^@]+)@") + + def generate(self, makefile): + print "Generating " + makefile + "...", + outpath = self._objdir + "/" + makefile + + contents = \ + "\n".join([k + "=" + str(v) \ + for (k,v) in self._acvars.iteritems()]) + \ + "\n\ninclude $(topsrcdir)/build/config.mk\n" \ + "include $(topsrcdir)/manifest.mk\n" \ + "include $(topsrcdir)/build/rules.mk\n" + + try: + outf = open(outpath, "r") + oldcontents = outf.read() + outf.close() + + if oldcontents == contents: + print "not changed" + return + except IOError: + pass + + outf = open(outpath, "w") + outf.write(contents) + outf.close() + print diff --git a/js/tamarin/build/dependparser.py b/js/tamarin/build/dependparser.py new file mode 100755 index 000000000000..5cd145738113 --- /dev/null +++ b/js/tamarin/build/dependparser.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +"""Pipes stdin | stdout and extracts a list of all header dependencies to +a file.""" + +import re +import sys +from sets import Set + +_lineExp = re.compile("# \d+ \"([^\"<>]+)\""); + +deps = Set() + +for line in sys.stdin: + sys.stdout.write(line) + m = _lineExp.match(line) + if m: + deps.add(m.group(1)) + +if len(sys.argv) != 2: + raise Exception("Unexpected command line argument.") + +outfile = sys.argv[1] +ostream = open(outfile, "w") +ostream.write("\n".join(deps)) +ostream.close() diff --git a/js/tamarin/build/getopt.py b/js/tamarin/build/getopt.py new file mode 100644 index 000000000000..f6cd092961f9 --- /dev/null +++ b/js/tamarin/build/getopt.py @@ -0,0 +1,74 @@ +import sys +import re + +_target = re.compile("^--target=(.*)$") +_host = re.compile("^--host=.*$") +_arg = re.compile("^--(enable|disable|with|without)-(\w+)(?:=(.*)|$)$") +_yes = re.compile("^(t|true|yes|y|1)$", re.I) +_no = re.compile("^(f|false|no|n|0)$", re.I) + +class Options: + def __init__(self, argv = sys.argv): + self._args = {} + self.target = None + self.host = None + + for arg in argv[1:]: + m = _target.search(arg) + if m: + self.target = m.groups(0) + continue + + m = _host.search(arg) + if m: + self.host = m.groups(0) + continue + + m = _arg.search(arg) + if not m: + raise Exception("Unrecognized command line parameter: '" + arg + "'") + + (t, n, v) = m.groups() + + if type(v) == str: + if _yes.search(v): + v = True + if _no.search(v): + v = False + + if t == "enable" or t == "with": + if v: + self._args[n] = v + else: + self._args[n] = True + + elif t == "disable" or t == "without": + if v: + raise Exception("--disable-" + n + " does not take a value.") + + self._args[n] = False + + def getBoolArg(self, name, default=None): + if not name in self._args: + return default + + val = self._args[name] + del self._args[name] + + if type(val) == bool: + return val + + raise Exception("Unrecognized value for option '" + name + "'.") + + def getStringArg(self, name, default=None): + if not name in self._args: + return default + + val = self._args[name] + del self._args[name] + return val + + def finish(self): + if len(self._args): + raise Exception("Unrecognized command line parameters: " + \ + ",".join(self._args.keys())) diff --git a/js/tamarin/build/process.py b/js/tamarin/build/process.py new file mode 100644 index 000000000000..b8406dececcc --- /dev/null +++ b/js/tamarin/build/process.py @@ -0,0 +1,14 @@ +import os + +def run_for_output(cmd): + if type(cmd) == list: + # XXX need to escape arguments better... am I in a shell? + cmd = " ".join(cmd) + + pipe = os.popen(cmd, "r") + output = pipe.read() + exitval = pipe.close() + if (exitval): + raise Exception("Command failed: '" + cmd + "'") + + return output diff --git a/js/tamarin/build/rules.mk b/js/tamarin/build/rules.mk new file mode 100644 index 000000000000..c9f6955336a3 --- /dev/null +++ b/js/tamarin/build/rules.mk @@ -0,0 +1,31 @@ +# For the moment, pretend that nothing but mac exists, and we can always +# use gcc automatic dependencies. + +# A "thing" is any static library, shared library, or program. +# things are made up of CXXSRCS and CSRCS. +# +# By default, we use CPPFLAGS/CFLAGS/CXXFLAGS/LDFLAGS. +# This can be overridden using thingname_CPPFLAGS +# +# If you want to *add* flags (without overriding the defaults), use +# thingname_EXTRA_CPPFLAGS +# +# the default target is "all::". Individual manifest.mk should add +# all:: dependencies for any object that should be made by default. + +# STATIC_LIBRARIES: +# By default, the library base name is the thingname. To override, set +# thingname_BASENAME + +THINGS = \ + $(STATIC_LIBRARIES) \ + $(SHARED_LIBRARIES) \ + $(PROGRAMS) \ + $(NULL) + +$(foreach thing,$(THINGS),$(eval $(call THING_SRCS,$(thing)))) +$(foreach lib,$(STATIC_LIBRARIES),$(eval $(call STATIC_LIBRARY_RULES,$(lib)))) +$(foreach program,$(PROGRAMS),$(eval $(call PROGRAM_RULES,$(program)))) + +clean:: + rm -f $(GARBAGE) diff --git a/js/tamarin/codegen/manifest.mk b/js/tamarin/codegen/manifest.mk new file mode 100644 index 000000000000..0d2c85bf20ab --- /dev/null +++ b/js/tamarin/codegen/manifest.mk @@ -0,0 +1,18 @@ +codegen_cpu_cxxsrc = $(error Unrecognized target CPU.) + +ifeq (i686,$(TARGET_CPU)) +codegen_cpu_cxxsrc := Ia32Assembler.cpp +endif + +ifeq (powerpc,$(TARGET_CPU)) +codegen_cpu_cxxsrc := PpcAssembler.cpp +endif + +ifeq (arm,$(TARGET_CPU)) +codegen_cpu_cxxsrc := ArmAssembler.cpp +endif + +avmplus_CXXSRCS := $(avmplus_CXXSRCS) \ + $(curdir)/CodegenMIR.cpp \ + $(curdir)/$(codegen_cpu_cxxsrc) \ + $(NULL) diff --git a/js/tamarin/configure.py b/js/tamarin/configure.py new file mode 100755 index 000000000000..396cfd7676f7 --- /dev/null +++ b/js/tamarin/configure.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python +# +# This script runs just like a traditional configure script, to do configuration +# testing and makefile generation. + +import os.path +import sys + +thisdir = os.path.dirname(os.path.abspath(__file__)) + +# Look for additional modules in our build/ directory. +sys.path.append(thisdir) + +import build.configuration +from build.configuration import * +import build.getopt + +o = build.getopt.Options() + +config = Configuration(thisdir, options = o, + sourcefile = 'core/avmplus.h') + +buildShell = o.getBoolArg("shell", False) +if (buildShell): + config.subst("ENABLE_SHELL", 1) + +# Get CPP, CC, etc +config.getCompiler() + +APP_CPPFLAGS = "-DSOFT_ASSERTS " +APP_CXXFLAGS = "" +OPT_CXXFLAGS = "-Os " +OPT_CPPFLAGS = "" +DEBUG_CPPFLAGS = "-DDEBUG -D_DEBUG " +DEBUG_CXXFLAGS = "-g " + +if config.COMPILER_IS_GCC: + APP_CXXFLAGS = "-fno-exceptions -fno-rtti -Werror -Wall -Wno-reorder -Wno-switch -Wno-invalid-offsetof -fmessage-length=0 -finline-functions -finline-limit=65536 " +else: + raise Exception("Not implemented") + +os = config.getHost()[0] +if os == "darwin": + APP_CPPFLAGS += "-DTARGET_API_MAC_CARBON=1 -DDARWIN=1 -D_MAC -DTARGET_RT_MAC_MACHO=1 -DUSE_MMAP -D_MAC -D__DEBUGGING__ " + APP_CXXFLAGS += "-fpascal-strings -faltivec -fasm-blocks -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk " + +if o.getBoolArg("debugger"): + APP_CPPFLAGS += "-DDEBUGGER " + +config.subst("APP_CPPFLAGS", APP_CPPFLAGS) +config.subst("APP_CXXFLAGS", APP_CXXFLAGS) +config.subst("OPT_CPPFLAGS", OPT_CPPFLAGS) +config.subst("OPT_CXXFLAGS", OPT_CXXFLAGS) +config.subst("DEBUG_CPPFLAGS", DEBUG_CPPFLAGS) +config.subst("DEBUG_CXXFLAGS", DEBUG_CXXFLAGS) +config.generate("Makefile") +o.finish() + diff --git a/js/tamarin/core/manifest.mk b/js/tamarin/core/manifest.mk new file mode 100644 index 000000000000..c269641c5f5a --- /dev/null +++ b/js/tamarin/core/manifest.mk @@ -0,0 +1,78 @@ +STATIC_LIBRARIES += avmplus +avmplus_BUILD_ALL = 1 + +avmplus_CXXSRCS := $(avmplus_CXXSRCS) \ + $(curdir)/AbcEnv.cpp \ + $(curdir)/AbcGen.cpp \ + $(curdir)/AbcParser.cpp \ + $(curdir)/AbstractFunction.cpp \ + $(curdir)/ActionBlockConstants.cpp \ + $(curdir)/ArrayClass.cpp \ + $(curdir)/ArrayObject.cpp \ + $(curdir)/AtomArray.cpp \ + $(curdir)/AvmCore.cpp \ + $(curdir)/avmplusDebugger.cpp \ + $(curdir)/avmplusHashtable.cpp \ + $(curdir)/avmplusProfiler.cpp \ + $(curdir)/BigInteger.cpp \ + $(curdir)/BooleanClass.cpp \ + $(curdir)/BuiltinTraits.cpp \ + $(curdir)/ClassClass.cpp \ + $(curdir)/ClassClosure.cpp \ + $(curdir)/DateClass.cpp \ + $(curdir)/DateObject.cpp \ + $(curdir)/Domain.cpp \ + $(curdir)/DomainEnv.cpp \ + $(curdir)/DynamicProfiler.cpp \ + $(curdir)/E4XNode.cpp \ + $(curdir)/ErrorClass.cpp \ + $(curdir)/ErrorConstants.cpp \ + $(curdir)/Exception.cpp \ + $(curdir)/FrameState.cpp \ + $(curdir)/FunctionClass.cpp \ + $(curdir)/GrowableBuffer.cpp \ + $(curdir)/IntClass.cpp \ + $(curdir)/Interpreter.cpp \ + $(curdir)/MathClass.cpp \ + $(curdir)/MathUtils.cpp \ + $(curdir)/MethodClosure.cpp \ + $(curdir)/MethodEnv.cpp \ + $(curdir)/MethodInfo.cpp \ + $(curdir)/Multiname.cpp \ + $(curdir)/MultinameHashtable.cpp \ + $(curdir)/Namespace.cpp \ + $(curdir)/NamespaceClass.cpp \ + $(curdir)/NamespaceSet.cpp \ + $(curdir)/NativeFunction.cpp \ + $(curdir)/NumberClass.cpp \ + $(curdir)/ObjectClass.cpp \ + $(curdir)/opcodes.cpp \ + $(curdir)/PoolObject.cpp \ + $(curdir)/PrintWriter.cpp \ + $(curdir)/RegExpClass.cpp \ + $(curdir)/RegExpObject.cpp \ + $(curdir)/ScopeChain.cpp \ + $(curdir)/ScriptBuffer.cpp \ + $(curdir)/ScriptObject.cpp \ + $(curdir)/StackTrace.cpp \ + $(curdir)/StaticProfiler.cpp \ + $(curdir)/StringBuffer.cpp \ + $(curdir)/StringClass.cpp \ + $(curdir)/StringObject.cpp \ + $(curdir)/Toplevel.cpp \ + $(curdir)/Traits.cpp \ + $(curdir)/UnicodeUtils.cpp \ + $(curdir)/Verifier.cpp \ + $(curdir)/VTable.cpp \ + $(curdir)/XMLClass.cpp \ + $(curdir)/XMLListClass.cpp \ + $(curdir)/XMLListObject.cpp \ + $(curdir)/XMLObject.cpp \ + $(curdir)/XMLParser16.cpp \ + $(curdir)/Date.cpp \ + $(curdir)/AbcData.cpp \ + $(curdir)/AvmPlusScriptableObject.cpp \ + $(NULL) + +# $(curdir)/avmplus.cpp \ +# $(curdir)/AtomConstants.cpp \ diff --git a/js/tamarin/manifest.mk b/js/tamarin/manifest.mk new file mode 100644 index 000000000000..04c2f2d33956 --- /dev/null +++ b/js/tamarin/manifest.mk @@ -0,0 +1,22 @@ +INCLUDES += \ + -I$(topsrcdir) \ + -I$(topsrcdir)/MMGC \ + -I$(topsrcdir)/core \ + -I$(topsrcdir)/codegen \ + -I$(topsrcdir)/pcre \ + $(NULL) + +$(call RECURSE_DIRS,MMgc core pcre codegen) + +ifeq (darwin,$(TARGET_OS)) +$(call RECURSE_DIRS,platform/mac) +endif + +$(call RECURSE_DIRS,shell) + +echo: + @echo avmplus_CXXFLAGS = $(avmplus_CXXFLAGS) + @echo avmplus_CXXSRCS = $(avmplus_CXXSRCS) + @echo avmplus_CXXOBJS = $(avmplus_CXXOBJS) + @echo avmplus_OBJS = $(avmplus_OBJS) + @echo avmplus_NAME = $(avmplus_NAME) diff --git a/js/tamarin/pcre/manifest.mk b/js/tamarin/pcre/manifest.mk new file mode 100644 index 000000000000..92e0b6046b15 --- /dev/null +++ b/js/tamarin/pcre/manifest.mk @@ -0,0 +1,18 @@ +avmplus_CXXSRCS := $(avmplus_CXXSRCS) \ + $(curdir)/pcre_chartables.cpp \ + $(curdir)/pcre_compile.cpp \ + $(curdir)/pcre_config.cpp \ + $(curdir)/pcre_exec.cpp \ + $(curdir)/pcre_fullinfo.cpp \ + $(curdir)/pcre_get.cpp \ + $(curdir)/pcre_globals.cpp \ + $(curdir)/pcre_info.cpp \ + $(curdir)/pcre_ord2utf8.cpp \ + $(curdir)/pcre_refcount.cpp \ + $(curdir)/pcre_study.cpp \ + $(curdir)/pcre_tables.cpp \ + $(curdir)/pcre_try_flipped.cpp \ + $(curdir)/pcre_valid_utf8.cpp \ + $(curdir)/pcre_version.cpp \ + $(curdir)/pcre_xclass.cpp \ + $(NULL) diff --git a/js/tamarin/platform/mac/manifest.mk b/js/tamarin/platform/mac/manifest.mk new file mode 100644 index 000000000000..790301f1eacb --- /dev/null +++ b/js/tamarin/platform/mac/manifest.mk @@ -0,0 +1,7 @@ +avmplus_CXXSRCS := $(avmplus_CXXSRCS) \ + $(curdir)/AvmDebugMac.cpp \ + $(curdir)/../unix/DateUnix.cpp \ + $(curdir)/../unix/MathUtilsUnix.cpp \ + $(curdir)/NativeFunctionMac.cpp \ + $(curdir)/../unix/OSDepUnix.cpp \ + $(NULL) diff --git a/js/tamarin/shell/manifest.mk b/js/tamarin/shell/manifest.mk new file mode 100644 index 000000000000..7398969fbddf --- /dev/null +++ b/js/tamarin/shell/manifest.mk @@ -0,0 +1,27 @@ +PROGRAMS += shell + +shell_BASENAME = avmshell +shell_INCLUDES = -I$(srcdir) -I$(topsrcdir)/extensions +shell_DEFINES = -DAVMPLUS_SHELL +shell_STATIC_LIBRARIES = MMgc avmplus +shell_DIR := $(curdir)/ + +ifdef ENABLE_SHELL +shell_BUILD_ALL = 1 +endif + +shell_CXXSRCS := $(shell_CXXSRCS) \ + $(curdir)/avmshell.cpp \ + $(curdir)/ByteArrayGlue.cpp \ + $(curdir)/ConsoleOutputStream.cpp \ + $(curdir)/DataIO.cpp \ + $(curdir)/DebugCLI.cpp \ + $(curdir)/DomainClass.cpp \ + $(curdir)/FileClass.cpp \ + $(curdir)/FileInputStream.cpp \ + $(curdir)/StringBuilderClass.cpp \ + $(curdir)/SystemClass.cpp \ + $(curdir)/TypedArrayClass.cpp \ + $(curdir)/../extensions/DictionaryGlue.cpp \ + $(curdir)/../extensions/JavaGlue.cpp \ + $(NULL)