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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269 | ###############################################################################
# Copyright (c) 2007-2024 by Altair Engineering, Inc.
# All rights reserved.
#
# Altair Engineering, Inc. makes this software available as part of the Vision
# tool platform. As long as you are a licensee of the Vision tool platform
# you may make copies of the software and modify it to be used within the
# Vision tool platform, but you must include all of this notice on any copy.
# Redistribution without written permission to any third party, with or
# without modification, is not permitted.
# Altair Engineering, Inc. does not warrant that this software is error free
# or fit for any purpose. Altair Engineering, Inc. disclaims any liability for
# all claims, expenses, losses, damages and costs any user may incur as a
# result of using, copying or modifying the software.
# =============================================================================
#
# This makefile can be used to build the C-API example files.
#
# You need (of course) a C compiler and a Tcl development environment which
# includes Tcl header files and the Tcl static library.
#
# On Linux you must at least set ZINC, ZOS_LIB and ZDB_LIB pointing to your
# *Vision installation directory containing the include and binary directories.
# Other platforms may need different settings in CC, LD and STDlibs.
#
# To specify the path to your Tcl installation you can pass the extra argument
# TCL_PREFIX to the makefile or you can edit this variable in the Makefile.
# Assuming you have installed Tcl with the prefix /usr/local the you can
# compile the examples with:
#
# $ make all TCL_PREFIX=/usr/local
# =============================================================================
#
# =============================================================================
# The following configuration assumes you're using a 64 bit GNU compiler.
# Please adjust it to your environment...
# =============================================================================
# Prefix to Tcl/Tk installation.
TCL_PREFIX = /usr/local/tcltk-8.6.10
ZINC = ../../../include
BINDIR = ../../../linux64
STARVISION = $(BINDIR)/starvisionpro
STARSH = $(BINDIR)/starsh
# CE_UTILITIES (aka ZOS) link libraries.
CE_UTILITIES_LIB = $(BINDIR)/ce_utilities.a
CE_UTILITIES_STUB = $(BINDIR)/ce_utilitiesstub.a
# UTIL link libraries.
UTIL_STUB = $(BINDIR)/zlicenseOEMstub.a
# ZDB link libraries.
ZDB_LIB = $(BINDIR)/zdb.a
ZDB_STUB = $(BINDIR)/zdbstub.a
TCL_INCL = $(TCL_PREFIX)/include
TCL_STUB = $(TCL_PREFIX)/lib/libtclstub8.6.a
STD_LIBS = -lm -lpthread -lrt
LINK_LIBS = $(ZDB_LIB) $(ZOS_LIB) $(CE_UTILITIES_LIB) $(STD_LIBS)
STUB_LIBS = $(ZDB_STUB) $(UTIL_STUB) $(CE_UTILITIES_STUB) \
$(TCL_STUB)
INC_DIRS = -I$(ZINC) -I$(TCL_INCL)
CC = gcc -Wall -Wextra -fPIC $(CFLAGS)
LD = $(CC) -Wl,-no-undefined
RM = @rm -rf
MKDIR = @mkdir
# =============================================================================
# Build everything.
# =============================================================================
#
all : createZdb_example zdbDump_example userware_example skeleton_example \
createFlat_example fillflat_example extract_example useOids_example
# =============================================================================
# Rules to make the Userware example.
# =============================================================================
#
userware_example : userware.so
userware.so : userware.o
$(LD) -o userware.so -shared userware.o $(STUB_LIBS)
userware.o : userware.c
$(CC) $(INC_DIRS) -c userware.c -o userware.o
run_userware_gui : userware.tcl test.zdb userware.so
$(STARVISION) -binfile test.zdb -userware userware.tcl
run_userware_sh : userware.tcl test.zdb userware.so
$(STARSH) userware.tcl test.zdb 2
test.zdb : createZdb.c
$(CC) $(INC_DIRS) createZdb.c -o createUserwareZdb $(LINK_LIBS)
./createUserwareZdb test.zdb
clean_userware :
$(RM) userware.o userware.so createUserwareZdb test.zdb
# =============================================================================
# Rules to make the createZdb example.
# =============================================================================
#
createZdb_example : createZdb
createZdb : createZdb.o
$(LD) -o createZdb createZdb.o $(LINK_LIBS)
createZdb.o : createZdb.c
$(CC) $(INC_DIRS) -c createZdb.c -o createZdb.o
clean_createZdb :
$(RM) createZdb createZdb.o
# =============================================================================
# Rules to make the zdbDump example.
# =============================================================================
#
zdbDump_example : zdbDump
zdbDump : zdbDump.o
$(LD) -o zdbDump zdbDump.o $(LINK_LIBS)
zdbDump.o : zdbDump.c
$(CC) $(INC_DIRS) -c zdbDump.c -o zdbDump.o
clean_zdbDump :
$(RM) zdbDump zdbDump.o
# =============================================================================
# Rules to make the skeleton example.
# =============================================================================
#
skeleton_example : skeleton.o
skeleton.o : skeleton.c
$(CC) $(INC_DIRS) -c skeleton.c -o skeleton.o
clean_skeleton :
$(RM) skeleton.o
# =============================================================================
# Rules to make the createFlat example.
# =============================================================================
#
createFlat_example : createFlat
run_createFlat : createFlat
./createFlat test.zdb
createFlat : createFlat.o
$(LD) -o createFlat createFlat.o $(LINK_LIBS)
createFlat.o : createFlat.c
$(CC) $(INC_DIRS) -c createFlat.c -o createFlat.o
clean_createFlat :
$(RM) createFlat createFlat.o
# =============================================================================
# Rules to make the fillflat example.
# =============================================================================
#
fillflat_example : fillflat.so
fillflat.so : fillflat.o
$(LD) -o fillflat.so -shared fillflat.o $(STUB_LIBS)
fillflat.o : fillflat.c
$(CC) $(INC_DIRS) -c fillflat.c -o fillflat.o
run_fillflat_sh : fillflat.tcl test.zdb fillflat.so fillflat.txt
$(STARSH) fillflat.tcl test.zdb fillflat.txt
clean_fillflat :
$(RM) fillflat.o fillflat.so createUserwareZdb test.zdb
# =============================================================================
# Rules to make the extract example.
# =============================================================================
#
extract_example : extract
run_extract : extract test.zdb
$(RM) outdir
$(MKDIR) outdir
./extract test.zdb outdir A i2.y
run_extract_sh : extract.tcl run_extract
$(STARSH) extract.tcl outdir 1
run_extract_gui : extract.tcl run_extract
$(STARVISION) -binfile outdir/out.zdb -userware2 extract.tcl outdir
extract : extract.o
$(LD) -o extract extract.o $(LINK_LIBS)
extract.o : extract.c
$(CC) $(INC_DIRS) -c extract.c -o extract.o
clean_extract :
$(RM) extract extract.o test.zdb outdir
# =============================================================================
# Rules to make the debugZdb example.
# =============================================================================
#
debugZdb_example : debugZdb
run_debugZdb : debugZdb test.zdb
./debugZdb test.zdb -logfile debugZdb.log -timesteps on -debugflag all
run_debugZdb_sh : debugZdb.tcl run_debugZdb
$(STARSH) debugZdb.tcl outdir 1
debugZdb : debugZdb.o
$(LD) -o debugZdb debugZdb.o $(LINK_LIBS)
debugZdb.o : debugZdb.c
$(CC) $(INC_DIRS) -c debugZdb.c -o debugZdb.o
clean_debugZdb :
$(RM) debugZdb debugZdb.o test.zdb debugZdb.log
# =============================================================================
# Rules to make the useOids example.
# =============================================================================
#
useOids_example : useOids
run_useOids : useOids
./useOids
run_useOids_sh : useOids.tcl run_useOids
$(STARSH) useOids.tcl outdir 1
useOids : useOids.o
$(LD) -o useOids useOids.o $(LINK_LIBS)
useOids.o : useOids.c
$(CC) $(INC_DIRS) -c useOids.c -o useOids.o
clean_useOids :
$(RM) useOids useOids.o
# =============================================================================
# Clean everything.
# =============================================================================
#
clean : clean_userware clean_createZdb clean_zdbDump clean_skeleton \
clean_createFlat clean_extract clean_useOids
|