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