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