File: SConstruct

package info (click to toggle)
atom4 4.1-9
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 836 kB
  • ctags: 1,222
  • sloc: cpp: 4,451; makefile: 46; perl: 6
file content (115 lines) | stat: -rw-r--r-- 2,781 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/usr/bin/scons
#
# Replacement Atom-4 build script.
#
# Configurable parameters: (run with 'cons $VARNAME=$VALUE ...')
#
# BINDIR=$dir		Where to install Atom-4 binaries
# COMPILER=$binary	Compiler to use (default: g++)
# DATADIR=$dir		Where data files should be installed
# MANDIR=$dir		Directory to store manpages
# REALDATADIR=$dir	Where Atom-4 should look for data files (default
#			is $DATADIR; this option is mainly for packaging
#			builds where the build-time dir is different from
#			the run-time dir)
# PROGLIBPATH=$dir	Path to prog/lib libraries (default: #../lib)
# X11LIBPATH=$dir	Where to find X11 libraries (default: /usr/X11R6/lib)
# DEBUG=1		Build with debugging symbols
# OPTIMIZE=$n		Optimize to level $n. Set to 0 to disable.
#			(Default: 2)
# PROFILE=1		Build with profiling code (for development use only)
#

# External configuration (can be overridden by running SCons with the
# appropriate X=Y W=Z ... options)
datadir  = ARGUMENTS.get('DATADIR', '#data')
optimize = ARGUMENTS.get('OPTIMIZE', 2)
profile  = ARGUMENTS.get('PROFILE', 0)

# Shared files
bindir = ARGUMENTS.get('BINDIR', '#bin')
incdir = ARGUMENTS.get('INCDIR', '#include')
mandir = ARGUMENTS.get('MANDIR', '#man')
libdir = '#lib'
objdir = '#obj'

# Locations of required libs
proglib     = '-lt++'
proglibpath = ARGUMENTS.get('PROGLIBPATH', '../lib')
ncurseslib  = ['-lpanel', '-lncurses']
x11lib      = ['-lX11', '-lXpm']
x11libpath  = ARGUMENTS.get('X11LIBPATH', '/usr/X11R6/lib')

# Global configuration
compiler = ARGUMENTS.get('COMPILER', 'g++')
realdatadir = ARGUMENTS.get('REALDATADIR', datadir)
cflags = [
	'-pedantic',
	'-DDATADIR=\\"' + Dir(realdatadir).path + '\\"'
]
if ARGUMENTS.get('DEBUG', 0):
	cflags += ['-g3']
if optimize:
	cflags += ['-O%d' % optimize]
if profile:
	cflags = cflags + [ '-pg', '-DPROFILE' ]

# Local configuration
incpath  = [ incdir, proglibpath + '/include' ]
libpath  = [ proglibpath + '/lib', libdir, x11libpath ]
libs     = [ proglib, '-lxatom4', '-latom4', ncurseslib, x11lib ];
if profile:
	libs += '-pg'

env = Environment(
	CC = compiler,
	CFLAGS = cflags,
	CXXFLAGS = cflags,
	CPPPATH = incpath,
	LIBS = libs,
	LIBPATH = libpath
)
env.Decider('content')

Export('env', 'compiler', 'cflags', 'bindir', 'datadir', 'incdir', 'libdir',
	'objdir', 'proglibpath', 'ncurseslib')

# Build tree
SConscript(Split("""
	engine/SConscript
	general/SConscript
	ncurses/SConscript
	net/SConscript
	x/SConscript
"""))


#
# Headers
#

env.Install(incdir, 'interface.h')


#
# Main program
#

env.Install(bindir, 'atom4')
env.Program('atom4', [
	'atom4.cc',
	'interface.cc',
	objdir + '/event.o',
	objdir + '/textui.o'
])
env.Depends('atom4', Split("""
	lib/libatom4.a
	lib/libxatom4.a
"""))

#
# Auxilliary stuff
#

env.Install(mandir + '/man6', 'atom4.6');