-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
38 lines (29 loc) · 1.36 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# specify where the installed copy of ROSE is located.
# Essentially the --prefix path used with configure
ROSE_INSTALL=/opt/rose/installDebug
## Your Plugin source files
Plugin=PrintNamesPlugin
Plugin_SOURCE=$(Plugin).cpp
## Input testcode for your plugin
TESTCODE=test1.cpp
# Standard C++ compiler stuff (see rose-config --help)
comma := ,
CXX = $(shell $(ROSE_INSTALL)/bin/rose-config cxx)
CPPFLAGS = $(shell $(ROSE_INSTALL)/bin/rose-config cppflags) -I.
CXXFLAGS = $(shell $(ROSE_INSTALL)/bin/rose-config cxxflags)
LIBDIRS = $(shell $(ROSE_INSTALL)/bin/rose-config libdirs)
LDFLAGS = $(shell $(ROSE_INSTALL)/bin/rose-config ldflags) -L. \
$(addprefix -Wl$(comma)-rpath -Wl$(comma), $(subst :, , $(LIBDIRS)))
#-------------------------------------------------------------
# Makefile Targets
#-------------------------------------------------------------
all: $(Plugin).so
# compile the plugin and generate a shared library
# -g is recommended to be used by default to enable debugging your code
$(Plugin).so: $(Plugin_SOURCE)
$(CXX) -g $(Plugin_SOURCE) -fpic -shared $(CPPFLAGS) $(LDFLAGS) -o $@
# test the plugin
check: $(Plugin).so
$(ROSE_INSTALL)/bin/rose-compiler -c -rose:plugin_lib $(Plugin).so -rose:plugin_action print-names -rose:plugin_arg_print-names op1 -I. -I$(ROSE_INSTALL)/include $(TESTCODE)
clean:
rm -rf $(Plugin).so *.o rose_* *.dot