File: Construct

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 (135 lines) | stat: -rw-r--r-- 3,309 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/usr/bin/cons
#
# Atom-4 build script. Requires cons, in case you haven't clued in yet.
#
# 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)
#
# <obligatory Cons promotion>
# I *love* cons. Make is just an idiotic overly-bandaged contraption way past
# its lifetime. Everyone should use Cons for all new products! It will save
# you countless hours, days, weeks, of endless build frustrations. I swear
# I'll never, ever, use Make again. It's about time it died a long overdue
# death.
# </obligatory Cons promotion>
#
# $Id: Construct,v 1.16 2003/04/15 13:47:09 hsteoh Exp hsteoh $
#

#
# Useful routines
#

# abspath $relpath
sub abspath {
  my $path=shift;
  my $pwd=`pwd`;
  chomp $pwd;
  $path=~s#^#$pwd/# unless $path=~m#^/#;
  return $path;
}

#
# Cons setup
#

# Chdir while processing subdir Conscripts
Conscript_chdir 1;

Export qw(
	BINDIR DATADIR INCDIR LIBDIR MANDIR OBJDIR
	PROGLIB PROGLIBPATH NCURSESLIB X11LIB X11LIBPATH
	CONS COMPILER CFLAGS
);


# External configuration (can be overridden by running Cons with the
# appropriate X=Y W=Z ... options)
$DATADIR  = $ARG{DATADIR} || '#data';
$OPTIMIZE = defined $ARG{OPTIMIZE} ? $ARG{OPTIMIZE} : 2;
$PROFILE  = $ARG{PROFILE} || 0;

# Shared files
$BINDIR = $ARG{BINDIR} || '#bin';
$INCDIR = '#include';
$MANDIR = $ARG{MANDIR} || '#man';
$LIBDIR = '#lib';
$OBJDIR = '#obj';

# Locations of required libs
$PROGLIB     = '-lt++';
$PROGLIBPATH = $ARG{PROGLIBPATH} || '#../lib';
$NCURSESLIB  = '-lpanel -lncurses';
$X11LIB      = '-lX11 -lXpm';
$X11LIBPATH  = $ARG{X11LIBPATH} || '/usr/X11R6/lib';

# Global configuration
$COMPILER = $ARG{COMPILER} || 'g++';
$REALDATADIR = $ARG{REALDATADIR} || abspath(DirPath($DATADIR));
$CFLAGS   = "-pedantic -DDATADIR=\\\"$REALDATADIR\\\"";
$CFLAGS  .= " -g3" if $ARG{DEBUG};
$CFLAGS  .= " -O$OPTIMIZE" if $OPTIMIZE;
$CFLAGS  .= " -pg -DPROFILE" if $PROFILE;

# Local configuration
$INCPATH  = "$INCDIR:$PROGLIBPATH/include";
$LIBPATH  = "$PROGLIBPATH/lib:$LIBDIR:$X11LIBPATH";
$LIBS     = "$PROGLIB -lxatom4 -latom4 $NCURSESLIB $X11LIB";
$LIBS    .= " -pg" if $PROFILE;

$CONS = new cons(
  CC      => $COMPILER,
  CFLAGS  => $CFLAGS,
  CPPPATH => $INCPATH,
  LIBS    => $LIBS,
  LIBPATH => $LIBPATH
);

# Build tree
Build qw(
	engine/Conscript
	general/Conscript
	ncurses/Conscript
	net/Conscript
	x/Conscript
);


#
# Headers
#

Install $CONS $INCDIR,
	'interface.h';

#
# Main program
#

Install $CONS $BINDIR, 'atom4';
Program $CONS 'atom4',
	'atom4.cc',
	'interface.cc',
	"$OBJDIR/event.o",
	"$OBJDIR/textui.o";

#
# Auxilliary stuff
#

Install $CONS "$MANDIR/man6", 'atom4.6';