Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / env / common / pli / monitor / loadpli / linux / Makefile.nc
CommitLineData
86530b38
AT
1# include $(INSTALL_DIR)/tools.lnx86/inca/files/Makefile.nc.defines
2include Makefile.nc.defines
3# Uncomment the following line to use the GCC compiler
4USE_COMPILER = gcc
5# Uncomment the following line to use the C++ compiler to link shared libs
6USE_LINKER = gcc
7# include $(INSTALL_DIR)/tools.lnx86/inca/files/Makefile.nc.$(ARCH)
8include Makefile.nc.$(ARCH)
9################# PUT ALL USER MACROS AFTER THIS LINE #################
10
11#
12# Makefile.nc
13#
14# This makefile can be used as a template makefile for statically or
15# dynamically linking PLI/VPI, LMSI, or SWIFT code into the NC-Verilog tools
16# For C++ Rules and Macros refer to 'C++ HOWTO' in this file.
17#
18# All of the defines in this Makefile also exist in
19# $(INSTALL_DIR)/tools.lnx86/inca/files/Makefile.nc.defines
20# By modifying them here, you will override the default values there.
21#
22# Any targets that you do not need can be safely deleted from this file.
23#
24
25#
26# The TARGETDIR macro should be set to the directory where the resulting
27# executables should be placed. This defaults to the current directory.
28#
29TARGETDIR=.
30
31# Shared libraries
32VPILIB = $(TARGETDIR)/libvpi.$(SHARED_LIB_POSTFIX)
33# PLILIB = $(TARGETDIR)/libpli.$(SHARED_LIB_POSTFIX)
34PLILIB = $(TARGETDIR)/libmonitorpli.$(SHARED_LIB_POSTFIX)
35VHPILIB = $(TARGETDIR)/libvhpi.$(SHARED_LIB_POSTFIX)
36CFCLIB = $(TARGETDIR)/libcfc.$(SHARED_LIB_POSTFIX)
37FMILIB = $(TARGETDIR)/libfmi.$(SHARED_LIB_POSTFIX)
38DPILIB = $(TARGETDIR)/libdpi.$(SHARED_LIB_POSTFIX)
39
40#
41# Set this to the set of targets that you want executed. For example, if
42# you want to create a libpli.so file, then set it to:
43#
44FIRST_TARGET = $(PLILIB)
45
46#
47# Specify any defines that you want set by uncommenting the USR_DEFINES
48# Macro below. All defines should have a '-D' prefix to work properly
49# e.g. INCA, INCA_test, MYTEST and ETC are defined below.
50#
51# USR_DEFINES = -DINCA -DINCA_test -DMYTEST -DETC
52
53#
54# The VPI_USER_C macro should be set to the vpi_user.c file containing any
55# user defined 'C' routines for use with VPI (PLI 2.0).
56# vpi_user.c can be copied from $(INSTALL_DIR)/tools.lnx86/inca/src/vpi_user.c
57#
58VPI_USER_C = ./vpi_user.c
59VPI_USER_O = $(TARGETDIR)/vpi_user.$(OBJ_POSTFIX)
60
61#
62# The VPI_OBJECTS_SAFE macro should be set to the object files which you do
63# not want deleted in "clean" target.
64#
65VPI_OBJECTS_SAFE =
66
67#
68# Add any VPI objects which need to be compiled, and can be deleted using the
69# "clean" target here:
70#
71VPI_OBJECTS =
72
73#
74# Add any library linking options needed to resolve external references for
75# the VPILIB shared library
76#
77VPI_EXTERN_LIBS =
78
79#
80# The VERIUSER_C macro should be set to the veriuser.c file containing any
81# user defined 'C' routines for use with PLI 1.0.
82# veriuser.c can be copied from $(INSTALL_DIR)/tools.lnx86/inca/src/veriuser.c
83#
84VERIUSER_C = ./veriuser.c
85VERIUSER_O = $(TARGETDIR)/veriuser.$(OBJ_POSTFIX)
86
87#
88# The PLI_OBJECTS_SAFE macro should be set to the object files which you do
89# not want deleted in "clean" target.
90#
91PLI_OBJECTS_SAFE = $(DV_ROOT)/verif/env/common/pli/monitor/loadpli/linux/libmonitor_loadpli.a
92
93#
94# Add any PLI objects which need to be compiled, and can be deleted using the
95# "clean" target here:
96#
97PLI_OBJECTS =
98
99#
100# Add any library linking options needed to resolve external references for
101# the PLILIB shared library
102#
103PLI_EXTERN_LIBS =
104
105#
106# The VHPI_OBJECTS_SAFE macro should be set to the object files which you do
107# not want deleted in "clean" target.
108#
109VHPI_OBJECTS_SAFE =
110
111#
112# Add any VHPI objects which need to be compiled, and can be deleted using the
113# "clean" target here:
114#
115VHPI_OBJECTS =
116
117#
118# Add any library linking options needed to resolve external references for
119# the VHPILIB shared library
120#
121VHPI_EXTERN_LIBS =
122
123#
124# The CFC_OBJECTS_SAFE macro should be set to the object files which you do
125# not want deleted in "clean" target.
126#
127CFC_OBJECTS_SAFE =
128
129#
130# Add any CFC objects which need to be compiled, and can be deleted using the
131# "clean" target here:
132#
133CFC_OBJECTS =
134
135#
136# Add any library linking options needed to resolve external references for
137# the CFCLIB shared library
138#
139CFC_EXTERN_LIBS =
140
141#
142# The FMI_OBJECTS_SAFE macro should be set to the object files which you do
143# not want deleted in "clean" target.
144#
145FMI_OBJECTS_SAFE =
146
147#
148# Add any FMI objects which need to be compiled, and can be deleted using the
149# "clean" target here:
150#
151FMI_OBJECTS =
152
153#
154# Add any library linking options needed to resolve external references for
155# the FMILIB shared library
156#
157FMI_EXTERN_LIBS =
158
159#
160# The DPI_OBJECTS_SAFE macro should be set to the object files which you do
161# not want deleted in "clean" target.
162#
163DPI_OBJECTS_SAFE =
164
165#
166# Add any DPI objects which need to be compiled, and can be deleted using the
167# "clean" target here:
168#
169DPI_OBJECTS =
170
171#
172# Add any library linking options needed to resolve external references for
173# the DPILIB shared library
174#
175DPI_EXTERN_LIBS =
176
177DPI_USER_C = ./_sv_export.c
178DPI_USER_O = $(TARGETDIR)/_sv_export.$(OBJ_POSTFIX)
179
180#
181# LMC_HOME is set to the swift installation
182# Shared library path environment variable should be set to include the
183# path of the swift shared library.
184#
185LMC_HOME =
186
187#
188# The SFI_ROOT macro should be set to the lmsi installation
189#
190SFI_ROOT =
191
192#
193# The NCELAB macro should be set to the name of the elaborator which should
194# be generated by the static link.
195#
196NCELAB = $(TARGETDIR)/ncelab
197
198#
199# The NCSIM macro should be set to the name of the simulator which should
200# be generated by the static link.
201#
202NCSIM = $(TARGETDIR)/ncsim
203
204#
205# The TARGETS macro should be set to pli/vpi objects/executables with statically
206# linked PLI/VPI objects
207#
208PLI_O_TARGETS = $(VERIUSER_O) $(PLI_OBJECTS) $(PLI_OBJECTS_SAFE)
209VPI_O_TARGETS = $(VPI_USER_O) $(VPI_OBJECTS) $(VPI_OBJECTS_SAFE)
210VHPI_O_TARGETS = $(VHPI_OBJECTS) $(VHPI_OBJECTS_SAFE)
211DPI_O_TARGETS = $(DPI_OBJECTS) $(DPI_OBJECTS_SAFE)
212
213# To add PLI 1.0 applications when linking statically, add $(PLI_O_TARGETS) to
214# the O_TARGETS list below.
215#
216# To add VPI applications when linking statically, add $(VPI_O_TARGETS) to
217# the O_TARGETS list below.
218#
219# To add VHPI applications when linking statically, add $(VHPI_O_TARGETS) to
220# the O_TARGETS list below.
221#
222#O_TARGETS = $(PLI_O_TARGETS) $(VPI_O_TARGETS) $(VHPI_O_TARGETS)
223
224O_TARGETS =
225
226# The CFC_O_TARGETS and FMI_O_TARGETS should be set to CFC/FMI objects/
227# executables with statically linked CFC/FMI objects respectively
228CFC_O_TARGETS = $(CFC_OBJECTS) $(CFC_OBJECTS_SAFE)
229FMI_O_TARGETS = $(FMI_OBJECTS) $(FMI_OBJECTS_SAFE)
230
231# To add CFC applications to ncsim when linking statically, add $(CFC_O_TARGETS)
232# to the NCSIM_O_TARGETS list below.
233#
234# To add FMI applications to ncsim when linking statically, add $(FMI_O_TARGETS)
235# to the NCSIM_O_TARGETS list below.
236
237NCSIM_O_TARGETS = \
238 $(CFC_OBJECTS) $(CFC_OBJECTS_SAFE) \
239 $(FMI_OBJECTS) $(FMI_OBJECTS_SAFE)
240
241TARGETS = $(NCELAB) $(NCSIM)
242
243# DYNAMIC LINKING
244
245# Begin targets for PLI/VPI dynamic linking
246# The dynamic target builds the NC executables for debugging with shared
247# libraries
248# The shared_libs target builds the VPI and PLI shared libraries.
249#
250
251DYN_TARGETS = $(NCELAB)_dynamic $(NCSIM)_dynamic
252
253#
254#
255#
256# C++ HOWTO
257#
258# History:
259# The Elaborator as well as the Simulator routines are written in C.
260# The supporting library routines are written in C too. However, there
261# are applications which have been written using C++. There are
262# some 3rd party vendors that have written their IP in C++ too. We
263# therefore need a way to integrate all of this into a single Elaborator
264# executable and a single Simulator executable.
265#
266# In order for C++ objects to be properly integrated with the ncelab and
267# ncsim objects (i.e. ncelab.$(OBJ_POSTFIX) and ncsim.$(OBJ_POSTFIX)) it
268# is required that the main() routine be compiled using C++. That was
269# the motivation for the following set of Rules and Macros.
270#
271# Gotchas:
272# There are some quirks that you should be aware of before integrating
273# the C++ routines.
274#
275# o You should ensure that the same C++ compiler is used to compile all
276# of the code, including the IP's provided by 3rd party vendor's.
277# It is not possible for a user.cc, compiled using CC and vendor.cc,
278# compiled using gcc, to be integrated together, due to name-mangling and
279# various other issues.
280#
281# o The routines and variables in your C++ code that are used in veriuser.c
282# and vpi_user.c, should be explicitly declared in your C++ code as an
283# 'extern "C"'. This tells the C++ compiler not to mangle the names that
284# will eventually be used in routines compiled using a C compiler. e.g.
285# File: veriuser.c
286# ----------------
287# extern int hello_world(int);
288# s_tfcell veriusertfs[TF_MAXARRAY] = {
289# {usertask, 0, 0, 0, (int (*)())hello_world, 0, "$hello_world", 1 },
290# 0
291# };
292#
293# File: user_code.cc
294# -------------------
295# extern "C" int hello_world(int);
296# extern "C" void io_printf(char*);
297# int hello_world(int foo) { io_printf("Hello World\n"); return(foo);}
298#
299# o If you intend on including some of the VPI/PLI include files, you
300# should ensure that proper defines are put in place. e.g.
301# File: user_code.cc
302# -------------------
303# #define PROTO_PARAMS(params) params
304# #define PLI_EXTERN extern "C"
305# #include <stdio.h>
306# #include "vpi_user.h"
307# #undef PROTO_PARAMS
308# #undef PLI_EXTERN
309# /* Other routines and declarations. */
310#
311# o '.cc' is the assumed extension of all the C++ files used here. You
312# should make appropriate corrections if you are using different
313# extensions, via the CC_EXTENSION macro.
314#
315# o You should copy over main.cc and veriuser.c and/or vpi_user.c from
316# $(INSTALL_DIR)/tools.lnx86/inca/src and make the appropriate changes before
317# using them.
318#
319# o You should remember to modify the following macros as appropriate.
320# CCC -> To specify the C++ compiler (Default: CC)
321# CCFLAGS -> Flags for the C++ compiler (Default: CFLAGS)
322# CC_EXTENSION -> Extensions for C++ files (Default: .cc)
323# TARGETDIR -> Directory where targets will be put (Default: .)
324# VPI_USER_C -> Your vpi_user.c file if any (Default: ./vpi_user.c)
325# VERIUSER_C -> Your veriuser.c file if any (Default: ./veriuser.c)
326# CCC_MAIN_CC -> main.cc copied from $(INSTALL_DIR)/tools.lnx86/inca/src
327# CCC_OBJECTS -> Objects created from your C++ files
328#
329
330
331#
332# The CCC_MAIN_CC macro should be set to the main.cc file containing the
333# main() routine. This topmost routine should be compiled using a C++
334# compiler. It can be copied from $(INSTALL_DIR)/tools.lnx86/inca/src/main.cc.
335# If copied to another location make appropriate changes to following macros.
336#
337CCC_MAIN_CC = $(INSTALL_DIR)/tools.lnx86/inca/src/main.$(CC_EXTENSION)
338CCC_MAIN_O = main.$(OBJ_POSTFIX)
339
340
341#
342# The CCC_OBJECTS macro should be populated with the names of your
343# C++ files' objects. For example:
344# If your sources are foo1.cc and foo2.cc then
345# CCC_OBJECTS = foo1.$(OBJ_POSTFIX) foo2.$(OBJ_POSTFIX)
346# These objects will be deleted by the 'clean' target.
347#
348CCC_OBJECTS =
349
350
351#
352# The CCC_OBJECTS_SAFE macro should be populated with the names of your
353# C++ files' objects. For example:
354# If your sources are foo1.cc and foo2.cc then
355# CCC_OBJECTS_SAFE = foo1.$(OBJ_POSTFIX) foo2.$(OBJ_POSTFIX)
356# These objects will *NOT* be deleted by the 'clean' target.
357#
358CCC_OBJECTS_SAFE =
359
360
361#
362# The OCCC_TARGETS macro should be set to pli/vpi objects
363# OCCC_TARGETS = $(VPI_USER_O) $(VERIUSER_O) $(CCC_OBJECTS) $(CCC_OBJECTS_SAFE)
364#
365OCCC_TARGETS =
366
367CCC_TARGETS = $(NCELAB)C $(NCSIM)C
368
369################# PUT ALL USER MACROS BEFORE THIS LINE #################
370include $(INSTALL_DIR)/tools.lnx86/inca/files/Makefile.nc.targets