Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hammer
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sven M. Hallberg
hammer
Commits
64b5e307
Commit
64b5e307
authored
11 years ago
by
Dan Hirsch
Browse files
Options
Downloads
Patches
Plain Diff
Added install target
parent
cccb5f09
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
SConstruct
+31
-1
31 additions, 1 deletion
SConstruct
src/SConscript
+9
-2
9 additions, 2 deletions
src/SConscript
with
40 additions
and
3 deletions
SConstruct
+
31
−
1
View file @
64b5e307
# -*- python -*-
# -*- python -*-
import
os
import
os
import
os.path
import
os.path
import
sys
env
=
Environment
(
ENV
=
{
'
PATH
'
:
os
.
environ
[
'
PATH
'
]})
env
=
Environment
(
ENV
=
{
'
PATH
'
:
os
.
environ
[
'
PATH
'
]})
vars
=
Variables
(
None
,
ARGUMENTS
)
vars
.
Add
(
PathVariable
(
'
DESTDIR
'
,
"
Root directory to install in (useful for packaging scripts)
"
,
None
,
PathVariable
.
PathIsDirCreate
))
vars
.
Add
(
PathVariable
(
'
prefix
'
,
"
Where to install in the FHS
"
,
"
/usr/local
"
,
PathVariable
.
PathAccept
))
env
=
Environment
(
variables
=
vars
)
def
calcInstallPath
(
*
elements
):
path
=
os
.
path
.
abspath
(
os
.
path
.
join
(
*
map
(
env
.
subst
,
elements
)))
if
'
DESTDIR
'
in
env
:
path
=
os
.
path
.
join
(
env
[
'
DESTDIR
'
],
os
.
path
.
relpath
(
path
,
start
=
"
/
"
))
return
path
rel_prefix
=
not
os
.
path
.
isabs
(
env
[
'
prefix
'
])
env
[
'
prefix
'
]
=
os
.
path
.
abspath
(
env
[
'
prefix
'
])
if
'
DESTDIR
'
in
env
:
env
[
'
DESTDIR
'
]
=
os
.
path
.
abspath
(
env
[
'
DESTDIR
'
])
if
rel_prefix
:
print
>>
sys
.
stderr
,
"
--!!-- You used a relative prefix with a DESTDIR. This is probably not what you
"
print
>>
sys
.
stderr
,
"
--!!-- you want; files will be installed in
"
print
>>
sys
.
stderr
,
"
--!!-- %s
"
%
(
calcInstallPath
(
"
$prefix
"
),)
env
[
'
libpath
'
]
=
calcInstallPath
(
"
$prefix
"
,
"
lib
"
)
env
[
'
incpath
'
]
=
calcInstallPath
(
"
$prefix
"
,
"
include
"
,
"
hammer
"
)
# TODO: Add pkgconfig
env
.
MergeFlags
(
"
-std=gnu99 -Wall -Wextra -Werror -Wno-unused-parameter -Wno-attributes -lrt
"
)
env
.
MergeFlags
(
"
-std=gnu99 -Wall -Wextra -Werror -Wno-unused-parameter -Wno-attributes -lrt
"
)
AddOption
(
"
--variant
"
,
AddOption
(
"
--variant
"
,
...
@@ -35,8 +63,10 @@ if os.getenv("CC") == "clang":
...
@@ -35,8 +63,10 @@ if os.getenv("CC") == "clang":
Export
(
'
env
'
)
Export
(
'
env
'
)
env
.
SConscript
([
"
src/SConscript
"
],
variant_dir
=
'
build/$VARIANT/src
'
)
env
.
SConscript
([
"
src/SConscript
"
],
variant_dir
=
'
build/$VARIANT/src
'
)
env
.
SConscript
([
"
examples/SConscript
"
],
variant_dir
=
'
build/$VARIANT/examples
'
)
env
.
SConscript
([
"
examples/SConscript
"
],
variant_dir
=
'
build/$VARIANT/examples
'
)
env
.
Command
(
'
test
'
,
'
build/$VARIANT/src/test_suite
'
,
'
env LD_LIBRARY_PATH=build/$VARIANT/src $SOURCE
'
)
env
.
Command
(
'
test
'
,
'
build/$VARIANT/src/test_suite
'
,
'
env LD_LIBRARY_PATH=build/$VARIANT/src $SOURCE
'
)
env
.
Alias
(
"
install
"
,
"
$libpath
"
)
env
.
Alias
(
"
install
"
,
"
$incpath
"
)
This diff is collapsed.
Click to expand it.
src/SConscript
+
9
−
2
View file @
64b5e307
...
@@ -3,6 +3,12 @@ Import('env')
...
@@ -3,6 +3,12 @@ Import('env')
bindings
=
[]
bindings
=
[]
dist_headers
=
[
"
hammer.h
"
,
"
allocator.h
"
,
"
glue.h
"
]
parsers
=
[
'
parsers/%s.c
'
%
s
for
s
in
parsers
=
[
'
parsers/%s.c
'
%
s
for
s
in
[
'
action
'
,
[
'
action
'
,
'
and
'
,
'
and
'
,
...
@@ -55,13 +61,14 @@ tests = ['t_benchmark.c',
...
@@ -55,13 +61,14 @@ tests = ['t_benchmark.c',
libhammer_shared
=
env
.
SharedLibrary
(
'
hammer
'
,
parsers
+
backends
+
misc_hammer_parts
)
libhammer_shared
=
env
.
SharedLibrary
(
'
hammer
'
,
parsers
+
backends
+
misc_hammer_parts
)
libhammer_static
=
env
.
StaticLibrary
(
'
hammer
'
,
parsers
+
backends
+
misc_hammer_parts
)
libhammer_static
=
env
.
StaticLibrary
(
'
hammer
'
,
parsers
+
backends
+
misc_hammer_parts
)
env
.
Install
(
"
$libpath
"
,
[
libhammer_static
,
libhammer_shared
])
env
.
Install
(
"
$incpath
"
,
dist_headers
)
testenv
=
env
.
Clone
()
testenv
=
env
.
Clone
()
testenv
.
ParseConfig
(
'
pkg-config --cflags --libs glib-2.0
'
)
testenv
.
ParseConfig
(
'
pkg-config --cflags --libs glib-2.0
'
)
testenv
.
Append
(
LIBS
=
[
'
hammer
'
],
LIBPATH
=
[
'
.
'
])
testenv
.
Append
(
LIBS
=
[
'
hammer
'
],
LIBPATH
=
[
'
.
'
])
testenv
.
Program
(
'
test_suite
'
,
tests
+
[
'
test_suite.c
'
])
testenv
.
Program
(
'
test_suite
'
,
tests
+
[
'
test_suite.c
'
])
Export
(
"
libhammer_static libhammer_shared
"
)
Export
(
"
libhammer_static libhammer_shared
"
)
for
b
in
bindings
:
for
b
in
bindings
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment