ROSE  0.9.9.94
Developing ROSE-based Tools

Using the library

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_INSTALLED). 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 # Standard C++ compiler stuff (see rose-config --help)
26 CXX = $(shell $(ROSE_INSTALLED)/bin/rose-config cxx)
27 CPPFLAGS = $(shell $(ROSE_INSTALLED)/bin/rose-config cppflags)
28 CXXFLAGS = $(shell $(ROSE_INSTALLED)/bin/rose-config cxxflags)
29 LDFLAGS = $(shell $(ROSE_INSTALLED)/bin/rose-config ldflags)
30 LIBDIRS = $(shell $(ROSE_INSTALLED)/bin/rose-config libdirs)
31 
32 MOSTLYCLEANFILES =
33 
34 ##############################################################################
35 # Assuming your source code is "demo.C" to build an executable named "demo".
36 
37 all: demo
38 
39 demo.o: demo.C
40  $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ -c $^
41 
42 demo: demo.o
43  $(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)
44  @echo "Remember to set:"
45  @echo " LD_LIBRARY_PATH=$(LIBDIRS):$$LD_LIBRARY_PATH"
46 
47 MOSTLYCLEANFILES += demo demo.o
48 
49 ##############################################################################
50 # Standard boilerplate
51 
52 .PHONY: clean
53 clean:
54  rm -f $(MOSTLYCLEANFILES)

Next steps

If you're interested in source code analysis or source-to-source translation, read the ROSE tutorial. If you're interested in binary analysis try Binary analysis tutorial.

This page is generated from $ROSE/docs/Rose/ToolDevelopment/GettingStarted.dox