tooldev_makefile
Build systems
Synopsis
Declared in <src/docs/mrdocs/rose/tooldev_makefile.h>
struct tooldev_makefile;
Description
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:
```makefile # Sample makefile for programs that use the ROSE library. # # ROSE has a number of configuration details that must be present when # compiling and linking a user program with ROSE, and some of these # details are difficult to get right. The most foolproof way to get # these details into your own makefile is to use the "rose‐config" # tool. # # # This makefile assumes: # 1. The ROSE library has been properly installed (refer to the # documentation for configuring, building, and installing ROSE). # # 2. The top of the installation directory is $(ROSE_PREFIX). This # is the same directory you specified for "CMAKE_INSTALL_PREFIX". # ##############################################################################
# If the ROSE bin directory is in your PATH, rose‐config can be found # automatically. ifndef ROSE_PREFIX ROSE_PREFIX = $(shell rose‐config prefix) endif
ROSE_CONFIG = $(ROSE_PREFIX)/bin/rose‐config
include $(ROSE_PREFIX)/lib/rose‐config.cfg
# Standard C++ compiler stuff (see rose‐config ‐‐help) ROSE_CXX = _(shell _(ROSE_CONFIG) ROSE_CXX) ROSE_CPPFLAGS = _(shell _(ROSE_CONFIG) ROSE_CPPFLAGS) ROSE_CXXFLAGS = _(shell _(ROSE_CONFIG) ROSE_CXXFLAGS) ROSE_LDFLAGS = _(shell _(ROSE_CONFIG) ROSE_LDFLAGS) ROSE_LIBDIRS = _(shell _(ROSE_CONFIG) ROSE_LIBDIRS) ROSE_RPATHS = _(shell _(ROSE_CONFIG) ROSE_RPATHS) ROSE_LINK_RPATHS = _(shell _(ROSE_CONFIG) ROSE_LINK_RPATHS)
MOSTLYCLEANFILES =
############################################################################## # Assuming your source code is "demo.C" to build an executable named "demo".
all: demo
demo.o: demo.C _(ROSE_CXX) _(ROSE_CPPFLAGS) _(ROSE_CXXFLAGS) ‐o _@ ‐c $ˆ
demo: demo.o _(ROSE_CXX) _(ROSE_CXXFLAGS) ‐o _@ _ˆ _(ROSE_LDFLAGS) _(ROSE_LINK_RPATHS) ‐Wl,‐rpath=$(ROSE_PREFIX)/lib
MOSTLYCLEANFILES += demo demo.o
############################################################################## # Standard boilerplate
.PHONY: clean clean: rm ‐f $(MOSTLYCLEANFILES) ```
See tooldev.
Created with MrDocs