]> pd.if.org Git - pccts/blob - NOTES.OS2
auto commit for import
[pccts] / NOTES.OS2
1 14 April 94
2 Version 1.20 of pccts
3
4 At the moment this help file is available via anonymous FTP at
5
6         Node: marvin.ecn.purdue.edu
7         File: pub/pccts/1.20/NOTES.OS2
8
9 Mail corrections or additions to Steve Robenalt <steve@molly.dny.rockwell.com>
10 ===============================================================================
11 Notes on building PCCTS under OS/2 2.X with the C Set compilers.
12
13 The supplied makefiles can be used to build PCCTS under OS/2 with minimal
14 trouble. First you need to edit the makefiles such that the Unix specific
15 defaults are commented out, then uncomment the lines which are specific
16 to OS/2 and C Set/2 compilers as originally set up by Ed Harfmann. Note
17 also that you need to use the target list which reflects the appropriate
18 naming conventions. Some of the lines now need to be changed to reflect
19 differences in conventions between the operating systems: 1) change forward
20 slashes in directories to backslashes, 2) change command line parameters
21 from -option to /option (note that this applies to C Set, not ANTLR and DLG
22 options), and 3) change rm to del for clean and scrub targets.
23
24 To build ANTLR for the first time:
25
26 note: I tried various combinations of "touch"ing files to try to prevent nmake
27       from using ANTLR to rebuild itself, and was unsuccessful.
28
29 In the section labelled "Target list of PC machines", comment out the
30 scan.c and antlr.c dependencies. This prevents nmake from trying to invoke
31 ANTLR to build itself. After you have built ANTLR successfully for the first
32 time, you can uncomment these lines and it will build itself normally. (If you
33 had a working 1.10 installation before, you can also use the older binaries
34 when building the new ones.)
35
36 An example of the resulting makefile, with all the extra baggage for Unix, DOS,
37 and OS/2 1.X is shown here:
38
39 ----- cut here -----
40
41 #
42 # Makefile for ANTLR 1.20
43 #
44 # SOFTWARE RIGHTS
45 #
46 # We reserve no LEGAL rights to the Purdue Compiler Construction Tool
47 # Set (PCCTS) -- PCCTS is in the public domain.  An individual or
48 # company may do whatever they wish with source code distributed with
49 # PCCTS or the code generated by PCCTS, including the incorporation of
50 # PCCTS, or its output, into commerical software.
51
52 # We encourage users to develop software with PCCTS.  However, we do ask
53 # that credit is given to us for developing PCCTS.  By "credit",
54 # we mean that if you incorporate our source code into one of your
55 # programs (commercial product, research project, or otherwise) that you
56 # acknowledge this fact somewhere in the documentation, research report,
57 # etc...  If you like PCCTS and have developed a nice tool with the
58 # output, please mention that you developed it using PCCTS.  In
59 # addition, we ask that this header remain intact in our source code.
60 # As long as these guidelines are kept, we expect to continue enhancing
61 # this system and expect to make other tools available as they are
62 # completed.
63 #
64 # ANTLR 1.20
65 # Terence Parr
66 # Purdue University
67 # With AHPCRC, University of Minnesota
68 # 1989-1994
69 #
70 # Ported to Borland C++, IBM C-Set/2 and Microsoft 6.0 by
71 # Ed Harfmann
72 # Micro Data Base Systems
73 # Lafayette, Indiana
74 # - With updates by Steve Robenalt 4/94
75 #
76 SET=..\support\set
77 PCCTS_H=..\h
78
79 #
80 # C-Set/2 for OS/2
81 #
82 CC=icc
83 CFLAGS= /I. /I$(SET) /I$(PCCTS_H) /Sa /W3 /DUSER_ZZSYN
84 OUT_OBJ = /Fo
85 LIBS=
86 ANTLR=..\bin\antlr
87 DLG=..\bin\dlg
88 OBJ_EXT = obj
89
90 antlr.exe: antlr.obj scan.obj err.obj bits.obj build.obj fset2.obj \
91         fset.obj gen.obj globals.obj hash.obj lex.obj main.obj \
92         misc.obj set.obj pred.obj dialog.obj
93         link386 @<<
94 $** /NOI
95 $@ /STACK:32768
96
97 $(LIBS: = +^
98 )
99 $(DEF_FILE) $(LFLAGS) ;
100 <<
101         copy *.exe ..\bin
102
103 #
104 # *********** Target list of PC machines ***********
105 #
106 # Don't worry about the ambiguity messages coming from antlr
107 # for making antlr.c etc...  [should be 10 of them, I think]
108 #
109 #antlr.c stdpccts.h parser.dlg tokens.h err.c : antlr.g
110 #       $(ANTLR) antlr.g
111
112 antlr.$(OBJ_EXT): antlr.c mode.h tokens.h
113
114 scan.$(OBJ_EXT): scan.c mode.h tokens.h
115
116 #scan.c mode.h: parser.dlg
117 #       $(DLG) -C2 parser.dlg scan.c
118
119 set.$(OBJ_EXT): $(SET)\set.c
120         $(CC) $(CFLAGS) /C $(OUT_OBJ)set.$(OBJ_EXT) $(SET)\set.c
121
122 #
123 # what files does PCCTS generate (both ANTLR and DLG)
124 #
125
126 PCCTS_GEN=antlr.c scan.c err.c tokens.h mode.h parser.dlg stdpccts.h remap.h
127
128 SRC=antlr.c scan.c err.c bits.c build.c fset2.c fset.c gen.c globals.c \
129         hash.c lex.c main.c misc.c $(SET)\set.c pred.c dialog.c
130
131 #
132 # ****** These next targets are common to UNIX and PC world ********
133 #
134
135 #clean up all the intermediate files
136 clean:
137         del *.$(OBJ_EXT) 
138
139 #remove everything in clean plus the PCCTS files generated
140 scrub:
141         del $(PCCTS_GEN) *.$(OBJ_EXT) 
142
143 ----- cut here -----
144
145 To build DLG for the first time:
146
147 Follow the same steps as were used to build ANTLR, changing the slashes and
148 commands, targets, and extensions for OS/2. Comment out the dependencies for
149 dlg_p.c and dlg_a.c to prevent nmake from trying to invoke ANTLR and DLG to
150 build DLG (unless you have 1.10 binaries).
151
152 An example of the resulting makefile, with all the extra baggage for Unix, DOS,
153 and OS/2 1.X is shown here:
154
155 ----- cut here -----
156
157 #
158 # Makefile for DLG 1.20
159 # Terence Parr
160 # Purdue University
161 # 1989-1993
162 #
163 # Ported to IBM C-Set/2 and Microsoft 6.0 by
164 # Ed Harfmann
165 # Micro Data Base Systems
166 # Lafayette, Indiana
167 # - With updates by Steve Robenalt 4/94
168 #
169 SET=..\support\set
170 PCCTS_H=..\h
171
172 #
173 # C-Set/2 for OS/2
174 #
175 CC=icc
176 CFLAGS= /I. /I$(SET) /I$(PCCTS_H) /Sa /W3
177 OUT_OBJ = /Fo
178 LIBS=
179 ANTLR=..\bin\antlr
180 DLG=..\bin\dlg
181 OBJ_EXT=obj
182
183 dlg.exe : dlg_p.obj dlg_a.obj main.obj err.obj set.obj support.obj \
184         output.obj relabel.obj automata.obj
185         link386 @<<
186 $** /NOI
187 $@ /STACK:32768
188
189 $(LIBS: = +^
190 )
191 $(DEF_FILE) $(LFLAGS) ;
192 <<
193         copy *.exe ..\bin
194
195 SRC = dlg_p.c dlg_a.c main.c err.c $(SET)\set.c support.c output.c \
196         relabel.c automata.c
197
198 #dlg_p.c parser.dlg err.c tokens.h : dlg_p.g
199 #       $(ANTLR) dlg_p.g
200
201 #dlg_a.c mode.h : parser.dlg
202 #       $(DLG) -C2 parser.dlg dlg_a.c
203
204 dlg_p.$(OBJ_EXT) : dlg_p.c dlg.h tokens.h mode.h
205         $(CC) $(CFLAGS) /c dlg_p.c
206
207 dlg_a.$(OBJ_EXT) : dlg_a.c dlg.h tokens.h mode.h
208         $(CC) $(CFLAGS) /c dlg_a.c
209
210 main.$(OBJ_EXT) : main.c dlg.h
211         $(CC) $(CFLAGS) /c main.c
212
213 set.$(OBJ_EXT) : $(SET)\set.c
214         $(CC) /c $(CFLAGS) $(SET)\set.c
215
216 lint:
217         lint *.c
218
219 #clean up all the intermediate files
220 clean:
221         del *.$(OBJ_EXT) 
222
223 ----- cut here -----
224
225 Once you have built ANTLR and DLG successfully, you will also want to build
226 the genmk utility, located at ~\pccts\support\genmk. The makefile in this 
227 directory is relatively simple to modify, so I won't repeat it here.
228
229 At this point, you can test the executables by building one of the sample
230 programs, such as the Pascal or C example under ~pccts\lang. The prototype
231 makefile which is in these directories will work fine as a base, with OS/2
232 specific modifications as noted above. Note that the /Sa flag defines the
233 ANSI C mode of the compiler which is not the default. The default mode
234 does not define __STDC__ and will lead to lots of errors.
235
236 A sample pascal makefile is shown below:
237
238 ----- cut here -----
239
240 GRM =pascal.g
241 LEX_FILE =pscan.dlg
242 GSRC=pascal.c err.c pscan.c ttree.c adebug.c
243 GOBJ=pascal.obj err.obj pscan.obj ttree.obj adebug.obj
244
245 PCCTS_GEN= pascal.c err.c $(LEX_FILE) pscan.c mode.h tokens.h
246
247 SRC =$(GSRC) pmain.c sym.c
248 OBJ =$(GOBJ) pmain.obj sym.obj
249 INCL = ..\..\h
250 SYM = ..\..\support\sym
251 ANTLR = ..\..\bin\antlr
252 DLG = ..\..\bin\dlg
253
254 CFLAGS=/I. /I$(INCL) /Sa
255 AFLAGS= -fl $(LEX_FILE) -gh
256
257 pascal.exe : $(OBJ)
258         $(CC) $(CFLAGS) /Fopascal.exe $(OBJ)
259
260 pascal.c $(LEX_FILE) : $(GRM)
261         $(ANTLR) $(AFLAGS) $(GRM)
262
263 mode.h pscan.c : $(LEX_FILE)
264         $(DLG) -C2 $(LEX_FILE) pscan.c
265
266 pmain.obj : pmain.c pascal.h
267
268 pascal.obj : pascal.c mode.h tokens.h
269
270 sym.obj : $(SYM)\sym.c
271         icc /c /Fo sym.obj $(CFLAGS) $(SYM)\sym.c
272
273 err.obj : err.c
274
275 clean:
276         del $(PCCTS_GEN) *.obj
277
278
279 ----- cut here -----
280
281 The C example can be built in much the same way.
282
283 If you have problems compiling anything, I would appreciate hearing about
284 it. I was able to get everything built and working without changing any
285 of the supplied or generated C code, so if you find that you need to make
286 changes to any code, I've probably written something up incorrectly.
287
288 Please post comments to the mailing list for PCCTS at:
289
290         pccts-users@ahpcrc.umn.edu
291
292 since I am most likely to see them there.
293
294 - Steve Robenalt
295
296