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