diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2011-01-25 15:05:11 -0500 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2011-01-25 15:05:11 -0500 |
commit | 78ae60302b58a40a3ad27084cf8ba0f77b8dcbfd (patch) | |
tree | e713062096f8f85c0b8e20423ea688fc8a069fac | |
parent | a466077f928892d2bd28bd13ef39c92ef8553780 (diff) |
switch ft_tools to liblitmus-generated Makefile
The liblitmus Makefile generates a config.inc makefile that makes the
liblitmus configuration available to third-party projects. This commit
switches ft_tools from the old SConstruct (which did all the
configuration itself to a much simpler Makefile based on including
config.inc.
As a new feature, this automatically picks up all compiler options
from liblitmus and thus automatically supports cross-compilation.
-rw-r--r-- | Makefile | 40 | ||||
-rw-r--r-- | SConstruct | 52 |
2 files changed, 40 insertions, 52 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..afff4dc --- /dev/null +++ b/Makefile | |||
@@ -0,0 +1,40 @@ | |||
1 | # ############################################################################## | ||
2 | # User variables | ||
3 | |||
4 | # user variables can be specified in the environment or in a .config file | ||
5 | -include .config | ||
6 | |||
7 | # Where is the LITMUS^RT userspace library source tree? | ||
8 | LIBLITMUS ?= ../liblitmus2010 | ||
9 | |||
10 | # Include default configuration from liblitmus | ||
11 | # Liblitmus must have been built before ft_tools can be built. | ||
12 | include ${LIBLITMUS}/inc/config.makefile | ||
13 | |||
14 | # all sources | ||
15 | vpath %.c src/ | ||
16 | |||
17 | # local include files | ||
18 | CPPFLAGS += -Iinclude/ | ||
19 | |||
20 | # ############################################################################## | ||
21 | # Targets | ||
22 | |||
23 | all = ftcat ft2csv ftdump | ||
24 | |||
25 | .PHONY: all clean | ||
26 | all: ${all} | ||
27 | clean: | ||
28 | rm -f ${all} *.o *.d | ||
29 | |||
30 | obj-ftcat = ftcat.o timestamp.o | ||
31 | ftcat: ${obj-ftcat} | ||
32 | |||
33 | obj-ft2csv = ft2csv.o timestamp.o mapping.o | ||
34 | ft2csv: ${obj-ft2csv} | ||
35 | |||
36 | obj-ftdump = ftdump.o timestamp.o mapping.o | ||
37 | ftdump: ${obj-ftdump} | ||
38 | |||
39 | # dependency discovery | ||
40 | include ${LIBLITMUS}/inc/depend.makefile | ||
diff --git a/SConstruct b/SConstruct deleted file mode 100644 index 97b5761..0000000 --- a/SConstruct +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | # ##################################################################### | ||
2 | # User configuration: Nothing to configure in this version. | ||
3 | |||
4 | # ##################################################################### | ||
5 | # Internal configuration. | ||
6 | DEBUG_FLAGS = '-Wall -g -Wdeclaration-after-statement' | ||
7 | INCLUDE_DIRS = 'include/' | ||
8 | X86_32_FLAGS = '-m32' | ||
9 | X86_64_FLAGS = '-m64' | ||
10 | V9_FLAGS = '-mcpu=v9 -m64' | ||
11 | SUPPORTED_ARCHS = { | ||
12 | 'sparc64' : V9_FLAGS, | ||
13 | 'i686' : X86_32_FLAGS, | ||
14 | 'i386' : X86_32_FLAGS, | ||
15 | 'x86_64' : X86_64_FLAGS, | ||
16 | } | ||
17 | # ##################################################################### | ||
18 | # Build configuration. | ||
19 | from os import uname, environ | ||
20 | |||
21 | # sanity check | ||
22 | (os, _, _, _, arch) = uname() | ||
23 | if os != 'Linux': | ||
24 | print 'Error: Building ft_tools is only supported on Linux.' | ||
25 | Exit(1) | ||
26 | |||
27 | # override arch if ARCH is set in environment or command line | ||
28 | if 'ARCH' in ARGUMENTS: | ||
29 | arch = ARGUMENTS['ARCH'] | ||
30 | elif 'ARCH' in environ: | ||
31 | arch = environ['ARCH'] | ||
32 | |||
33 | if arch not in SUPPORTED_ARCHS: | ||
34 | print 'Error: Building ft_tools is only supported for the following', \ | ||
35 | 'architectures: %s.' % ', '.join(sorted(SUPPORTED_ARCHS)) | ||
36 | Exit(1) | ||
37 | else: | ||
38 | print 'Building %s binaries.' % arch | ||
39 | arch_flags = Split(SUPPORTED_ARCHS[arch]) | ||
40 | |||
41 | env = Environment( | ||
42 | CC = 'gcc', | ||
43 | CPPPATH = Split(INCLUDE_DIRS), | ||
44 | CCFLAGS = Split(DEBUG_FLAGS) + arch_flags, | ||
45 | LINKFLAGS = arch_flags, | ||
46 | ) | ||
47 | |||
48 | # ##################################################################### | ||
49 | # Targets: | ||
50 | env.Program('ftcat', ['src/ftcat.c', 'src/timestamp.c']) | ||
51 | env.Program('ft2csv', ['src/ft2csv.c', 'src/timestamp.c', 'src/mapping.c']) | ||
52 | env.Program('ftdump', ['src/ftdump.c', 'src/timestamp.c', 'src/mapping.c']) | ||