4 At the moment this help file is available via anonymous FTP at
6 Node: marvin.ecn.purdue.edu
7 File: pub/pccts/1.20/NOTES.OS2
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.
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.
24 To build ANTLR for the first time:
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.
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.)
36 An example of the resulting makefile, with all the extra baggage for Unix, DOS,
37 and OS/2 1.X is shown here:
42 # Makefile for ANTLR 1.20
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.
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
67 # With AHPCRC, University of Minnesota
70 # Ported to Borland C++, IBM C-Set/2 and Microsoft 6.0 by
72 # Micro Data Base Systems
74 # - With updates by Steve Robenalt 4/94
83 CFLAGS= /I. /I$(SET) /I$(PCCTS_H) /Sa /W3 /DUSER_ZZSYN
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
99 $(DEF_FILE) $(LFLAGS) ;
104 # *********** Target list of PC machines ***********
106 # Don't worry about the ambiguity messages coming from antlr
107 # for making antlr.c etc... [should be 10 of them, I think]
109 #antlr.c stdpccts.h parser.dlg tokens.h err.c : antlr.g
112 antlr.$(OBJ_EXT): antlr.c mode.h tokens.h
114 scan.$(OBJ_EXT): scan.c mode.h tokens.h
116 #scan.c mode.h: parser.dlg
117 # $(DLG) -C2 parser.dlg scan.c
119 set.$(OBJ_EXT): $(SET)\set.c
120 $(CC) $(CFLAGS) /C $(OUT_OBJ)set.$(OBJ_EXT) $(SET)\set.c
123 # what files does PCCTS generate (both ANTLR and DLG)
126 PCCTS_GEN=antlr.c scan.c err.c tokens.h mode.h parser.dlg stdpccts.h remap.h
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
132 # ****** These next targets are common to UNIX and PC world ********
135 #clean up all the intermediate files
139 #remove everything in clean plus the PCCTS files generated
141 del $(PCCTS_GEN) *.$(OBJ_EXT)
145 To build DLG for the first time:
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).
152 An example of the resulting makefile, with all the extra baggage for Unix, DOS,
153 and OS/2 1.X is shown here:
158 # Makefile for DLG 1.20
163 # Ported to IBM C-Set/2 and Microsoft 6.0 by
165 # Micro Data Base Systems
167 # - With updates by Steve Robenalt 4/94
176 CFLAGS= /I. /I$(SET) /I$(PCCTS_H) /Sa /W3
183 dlg.exe : dlg_p.obj dlg_a.obj main.obj err.obj set.obj support.obj \
184 output.obj relabel.obj automata.obj
191 $(DEF_FILE) $(LFLAGS) ;
195 SRC = dlg_p.c dlg_a.c main.c err.c $(SET)\set.c support.c output.c \
198 #dlg_p.c parser.dlg err.c tokens.h : dlg_p.g
201 #dlg_a.c mode.h : parser.dlg
202 # $(DLG) -C2 parser.dlg dlg_a.c
204 dlg_p.$(OBJ_EXT) : dlg_p.c dlg.h tokens.h mode.h
205 $(CC) $(CFLAGS) /c dlg_p.c
207 dlg_a.$(OBJ_EXT) : dlg_a.c dlg.h tokens.h mode.h
208 $(CC) $(CFLAGS) /c dlg_a.c
210 main.$(OBJ_EXT) : main.c dlg.h
211 $(CC) $(CFLAGS) /c main.c
213 set.$(OBJ_EXT) : $(SET)\set.c
214 $(CC) /c $(CFLAGS) $(SET)\set.c
219 #clean up all the intermediate files
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.
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.
236 A sample pascal makefile is shown below:
242 GSRC=pascal.c err.c pscan.c ttree.c adebug.c
243 GOBJ=pascal.obj err.obj pscan.obj ttree.obj adebug.obj
245 PCCTS_GEN= pascal.c err.c $(LEX_FILE) pscan.c mode.h tokens.h
247 SRC =$(GSRC) pmain.c sym.c
248 OBJ =$(GOBJ) pmain.obj sym.obj
250 SYM = ..\..\support\sym
251 ANTLR = ..\..\bin\antlr
254 CFLAGS=/I. /I$(INCL) /Sa
255 AFLAGS= -fl $(LEX_FILE) -gh
258 $(CC) $(CFLAGS) /Fopascal.exe $(OBJ)
260 pascal.c $(LEX_FILE) : $(GRM)
261 $(ANTLR) $(AFLAGS) $(GRM)
263 mode.h pscan.c : $(LEX_FILE)
264 $(DLG) -C2 $(LEX_FILE) pscan.c
266 pmain.obj : pmain.c pascal.h
268 pascal.obj : pascal.c mode.h tokens.h
270 sym.obj : $(SYM)\sym.c
271 icc /c /Fo sym.obj $(CFLAGS) $(SYM)\sym.c
276 del $(PCCTS_GEN) *.obj
281 The C example can be built in much the same way.
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.
288 Please post comments to the mailing list for PCCTS at:
290 pccts-users@ahpcrc.umn.edu
292 since I am most likely to see them there.