ROSE  0.11.145.0

Using a build system to build tools.

Once the ROSE library has been configured, built, and installed it can be used. Any program that uses ROSE will likely need to be compiled with the same switches and software components as ROSE itself. The easiest way to get this information is by running "rose-config --help".

Here's an example makefile:

1 # Sample makefile for programs that use the ROSE library.
2 #
3 # ROSE has a number of configuration details that must be present when
4 # compiling and linking a user program with ROSE, and some of these
5 # details are difficult to get right. The most foolproof way to get
6 # these details into your own makefile is to use the "rose-config"
7 # tool.
8 #
9 #
10 # This makefile assumes:
11 # 1. The ROSE library has been properly installed (refer to the
12 # documentation for configuring, building, and installing ROSE).
13 #
14 # 2. The top of the installation directory is $(ROSE_HOME). This
15 # is the same directory you specified for the "--prefix" argument
16 # of the "configure" script, or the "CMAKE_INSTALL_PREFIX" if using
17 # cmake. E.g., "/usr/local".
18 #
19 # The "rose-config" tool currently only works for ROSE configured with
20 # GNU auto tools (e.g., you ran "configure" when you built and
21 # installed ROSE). The "cmake" configuration is not currently
22 # supported by "rose-config" [September 2015].
23 ##############################################################################
24 
25 #If the ROSE bin directory is in your path, rose-config can be found automatically
26 ifndef ROSE_HOME
27 ROSE_HOME = $(shell rose-config prefix)
28 endif
29 
30 include $(ROSE_HOME)/lib/rose-config.cfg
31 
32 # Standard C++ compiler stuff (see rose-config --help)
33 ROSE_CXX = $(shell $(ROSE_HOME)/bin/rose-config ROSE_CXX)
34 ROSE_CPPFLAGS = $(shell $(ROSE_HOME)/bin/rose-config ROSE_CPPFLAGS)
35 ROSE_CXXFLAGS = $(shell $(ROSE_HOME)/bin/rose-config ROSE_CXXFLAGS)
36 ROSE_LDFLAGS = $(shell $(ROSE_HOME)/bin/rose-config ROSE_LDFLAGS)
37 ROSE_LIBDIRS = $(shell $(ROSE_HOME)/bin/rose-config ROSE_LIBDIRS)
38 ROSE_RPATHS = $(shell $(ROSE_HOME)/bin/rose-config ROSE_RPATHS)
39 ROSE_LINK_RPATHS = $(shell $(ROSE_HOME)/bin/rose-config ROSE_LINK_RPATHS)
40 
41 MOSTLYCLEANFILES =
42 
43 ##############################################################################
44 # Assuming your source code is "demo.C" to build an executable named "demo".
45 
46 all: demo
47 
48 demo.o: demo.C
49  $(ROSE_CXX) $(ROSE_CPPFLAGS) $(ROSE_CXXFLAGS) -o $@ -c $^
50 
51 demo: demo.o
52  $(ROSE_CXX) $(ROSE_CXXFLAGS) -o $@ $^ $(ROSE_LDFLAGS) $(ROSE_LINK_RPATHS) -Wl,-rpath=$(ROSE_HOME)/lib
53 
54 MOSTLYCLEANFILES += demo demo.o
55 
56 ##############################################################################
57 # Standard boilerplate
58 
59 .PHONY: clean
60 clean:
61  rm -f $(MOSTLYCLEANFILES)
Collaboration diagram for Build systems: