(Answer) (Category) CGEN Faq-O-Matic :
How does one build and run cgen?
Quick answer: one doesn't.

CGEN is written in Scheme, and is usually run via a Scheme interpreter such as Guile. Therefore, no explicit configure/compile step is required for cgen itself.
Normally, the interpreted cgen sources, as well as files generated by cgen, all sit within in a common source tree that also includes the cgen-generated tools (the opcodes library and the various simulators). In a build tree configured from such a source tree, cgen rarely needs to be run: only when its inputs (.cpu/.opc description files, or .scm cgen sources) are changed. Even in such cases, cgen is rarely run by hand: instead, cgen is invoked via the make program in the generated tools directories.

See also:

    http://www.airs.com/ian/configure
    http://www.fsf.org/software/guile
    http://sources.redhat.com/fom/cgen?file=7

fche@redhat.com
I am currently trying to install CGEN. However, after running the ./configure in the top-directory I try to run make and basically nothing happens (no compilation or anything - it just says 'nothing to do'). A following make install command doesn't (of course) result in anything. I have looked in the generated Makefile and can see nothing wrong (but I am not a Makefile expert). I am very anxious to get CGEN up running since I am currently working with the design of our next generation Ultra-low power DSP and need a tool like CGEN to describe/verify it. I use Caldera open Linux v2.3, kernel 2.2.13.
 
Thanks.
 
Jakob Nielsen
 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  Jakob Nielsen                 jakob.nielsen@dspfactory.com
  Senior DSP Engineer
  Dspfactory Ltd.                Tel: +1-519-884-9696 x252
  80 King Street S., Suite 206   Fax: +1-519-884-0228
  Waterloo, ONT, CANADA          http://www.dspfactory.com/
 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

jakob.nielsen@dspfactory.com
cgen manual in cgen doc area explains how to debug using dev.scm.
But for the impatient beginner, here are some hints to get started quick.
If you want to run cgen scripts in a different directory other than binutils/opcodes (GNU binutils),
copy binutils/opcodes/cgen.sh to the new directory, and create a makefile (Makefile) as follows:
####### Makefile begin srcdir=. cgendir = ./cgen/src/cgen CGEN = "guile -L $(cgendir) -l ${cgendir}/guile.scm -s" # directory where all cgen .scm files are CGENDIR = `pwd`/cgen/src/cgen CGENFLAGS = -v arch=tp01 prefix = tp01 archfile = `pwd`/tp01.cpu opcfile = `pwd`/tp01.opc extrafiles = options =
# remember to use use tab where necessary run-cgen:
       $(SHELL) $(srcdir)/cgen.sh opcodes $(srcdir) $(CGEN) \
         $(CGENDIR) "$(CGENFLAGS)" $(arch) $(prefix) $(archfile) $(opcfile) \
         "$(options)" "$(extrafiles)"
         touch stamp-${prefix} 
###### Makefile end
and run make. This example assumes that your cgen inputs are tp01.cpu, and tp01.opc.
Following text shows how cgen is called from binutils.
If you have gnu binutils downloaded and configured, cd to opcodes directory run
make -n stamp-m32r or make stamp-m32r
to see how m32r related files are generated using cgen.
opcodes directory contains a shell script "cgen.sh". If you insert set -x in this file, at the top, and run "make stamp-m32r", you will see how cgen guile scripts are called.
v2george@gmail.com
From George Varughese:

If you want to run cgen scripts in a different directory other than
binutils/opcodes (GNU binutils),

copy binutils/opcodes/cgen.sh to the new directory, and create a makefile
(Makefile) as follows:

####### Makefile begin
srcdir=.
cgendir = ./cgen/src/cgen
CGEN = "guile -L $(cgendir) -l ${cgendir}/guile.scm -s"
# directory where all cgen .scm files are
CGENDIR = `pwd`/cgen/src/cgen
CGENFLAGS = -v
arch=tp01
prefix = tp01
archfile = `pwd`/tp01.cpu
opcfile = `pwd`/tp01.opc
extrafiles =
options =

# remember to use use tab where necessary
run-cgen:
       $(SHELL) $(srcdir)/cgen.sh opcodes $(srcdir) $(CGEN) \
         $(CGENDIR) "$(CGENFLAGS)" $(arch) $(prefix) $(archfile) $(opcfile) \
         "$(options)" "$(extrafiles)"
         touch stamp-${prefix}

###### Makefile end

and run make. This example assumes that your cgen inputs are tp01.cpu, and
tp01.opc.

Following text shows how cgen is called from binutils.
   
If you have gnu binutils downloaded and configured, cd to opcodes directory
run
   
make -n stamp-m32r
or
make stamp-m32r
   
to see how m32r related files  are generated using cgen.

opcodes directory contains a shell script "cgen.sh". If you insert
set -x
in this file, at the top, and run "make stamp-m32r", you will see how cgen guile
scripts are called.
fche@redhat.com
[Append to This Answer]
Next: (Answer) How does one regenerate the CGEN-related parts of a toolchain?
This document is: http://sourceware.org/fom/cgen?file=8
[Search] [Appearance]
This is a Faq-O-Matic 2.719.
This FAQ administered by ...