You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import os
  2. import sys
  3. import platform as _platform
  4. #
  5. # Command line options and help
  6. #
  7. opts = Variables('build.conf')
  8. opts.AddVariables(('CONF_DIR', """Directory where the Netsukuku configuration files will be installed""", '/etc/netsukuku'),
  9. ('DATA_DIR', 'Directory to install data files', '/usr/share/netsukuku'),
  10. ('MAN_DIR', 'Where the manuals will be installed', '/usr/man'),
  11. ('BIN_DIR' , 'Directory to install the binaries', '/usr/bin'),
  12. ('PID_DIR', 'Specify location of ntkd.pid file', '/var/run'),
  13. ('destdir', 'SCons will copy all the files under destdir during installation', '/'),
  14. EnumVariable('debug', 'build the debug code', 'no',
  15. allowed_values=('yes', 'no', '1', '0'), map={},
  16. ignorecase=0),
  17. EnumVariable('static', 'build statically the binaries', 'no',
  18. allowed_values=('yes', 'no', '1', '0'), map={},
  19. ignorecase=0))
  20. opts.Add('CC', 'The C compiler.')
  21. opts.Add('CXX', 'The C++ compiler.')
  22. env = Environment(options = opts, ENV = os.environ, CCFLAGS = ' -Wall')
  23. env['platform'] = _platform.system().lower();
  24. env["CC"] = os.getenv("CC") or env["CC"]
  25. env["CXX"] = os.getenv("CXX") or env["CXX"]
  26. env["ENV"].update(x for x in os.environ.items() if x[0].startswith("CCC_"))
  27. env.Append(CPPPATH = ['#src'])
  28. env.Append(LIBPATH = ['#src'])
  29. env.Append(CFLAGS = ['-g'])
  30. opts.Save('build.conf', env)
  31. Help("""
  32. *** Usage
  33. 'scons' to build the ntkd binary,
  34. 'scons debug=yes' to build the debug version.
  35. 'scons install' to install it in the system.
  36. *** General options
  37. """ + opts.GenerateHelpText(env))
  38. print "===================================================="
  39. print "Compiling Netsukuku for " + env['platform']
  40. print "===================================================="
  41. Export("env")
  42. # Main Sources
  43. SConscript("#src/SConscript")