2006-08-26 11:35:28 +00:00
# $Id$
#*****************************************************************************
# DESCRIPTION: Verilator top level: Makefile pre-configure version
#
# This file is part of Verilator.
#
2007-07-18 15:01:39 +00:00
# Author: Wilson Snyder <wsnyder@wsnyder.org>
2006-08-26 11:35:28 +00:00
#
2008-04-25 12:14:27 +00:00
# Code available from: http://www.veripool.org/verilator
2006-08-26 11:35:28 +00:00
#
#*****************************************************************************
#
2008-01-15 14:29:08 +00:00
# Copyright 2003-2008 by Wilson Snyder. This program is free software; you can
2006-08-26 11:35:28 +00:00
# redistribute it and/or modify it under the terms of either the GNU
# General Public License or the Perl Artistic License.
#
# Verilator is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#****************************************************************************/
#
# make all to compile and build Verilator.
# make install to install it.
# make TAGS to update tags tables.
#
# make clean or make mostlyclean
# Delete all files from the current directory that are normally
# created by building the program. Don't delete the files that
# record the configuration. Also preserve files that could be made
# by building, but normally aren't because the distribution comes
# with them.
#
# make distclean
# Delete all files from the current directory that are created by
# configuring or building the program. If you have unpacked the
# source and built the program without creating any other files,
# `make distclean' should leave only the files that were in the
# distribution.
#
# make maintainer-clean
# Delete everything from the current directory that can be
# reconstructed with this Makefile. This typically includes
# everything deleted by distclean, plus more: C source files
# produced by Bison, tags tables, info files, and so on.
#
# make extraclean
# Still more severe - delete backup and autosave files, too.
#### Start of system configuration section. ####
srcdir = @srcdir@
VPATH = @srcdir@
HOST = @HOST@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
MAKEINFO = makeinfo
TEXI2DVI = texi2dvi
PERL = @PERL@
#### Don't edit: You're much better using configure switches to set these
prefix = @prefix@
exec_prefix = @exec_prefix@
# Directory in which to install scripts.
bindir = @bindir@
# Directory in which to install scripts.
mandir = @mandir@
# Directory in which to install library files.
datadir = @datadir@
# Directory in which to install documentation info files.
infodir = @infodir@
# Directory in which to install package specific files
2008-03-18 20:26:37 +00:00
# Generally ${prefix}/share/verilator
2006-08-26 11:35:28 +00:00
pkgdatadir = @pkgdatadir@
#### End of system configuration section. ####
######################################################################
SHELL = /bin/sh
SUBDIRS = src test_verilated test_c test_sc test_sp test_regress test_vcs
INFOS = README verilator.txt verilator.html verilator.1 verilator.pdf
# Files that can be generated, but should be up to date for a distribution.
2006-09-25 15:58:17 +00:00
DISTDEP = info Makefile
2006-08-26 11:35:28 +00:00
# Files to distribute.
DISTBIN = $( wildcard bin/verilator-*)
2006-12-20 01:11:25 +00:00
DISTFILES_INC = $( INFOS) .cvsignore COPYING *.in *.ac \
2006-08-26 11:35:28 +00:00
Changes README TODO \
bin/* \
install-sh configure mkinstalldirs *.texi \
include/verilated.[ chv] * \
include/verilatedos.[ chv] * \
include/*.in \
src/.cvsignore src/*.in src/*.cpp src/*.[ chly] src/astgen src/flexfix \
src/*.pl \
test_*/.cvsignore test_*/Makefile* test_*/*.cpp \
test_*/*.pl test_*/*.v test_*/*.vc test_*/vlint \
test_verilated/vgen*.pl \
test_regress/t/*.v* \
test_regress/t/*.pl \
test_regress/t/*.out \
verilator.* \
INST_PROJ_FILES = \
bin/verilator \
bin/verilator_includer \
include/verilated.[ chv] * \
include/verilated.mk \
include/verilatedos.[ chv] * \
INST_PROJ_BIN_FILES = \
verilator_bin \
verilator_bin_dbg \
DISTFILES := $( DISTFILES_INC)
all : all_nomsg msg_test
2006-09-25 15:58:17 +00:00
all_nomsg : verilator_exe
2006-08-26 11:35:28 +00:00
.PHONY : verilator_exe
verilator_exe verilator_bin verilator_bin_dbg :
@echo ------------------------------------------------------------
@echo "making verilator in src" ; \
( cd src && $( MAKE) )
.PHONY : msg_test
msg_test :
@echo "Build complete!"
@echo
@echo "Type 'make test' to test."
@echo
2008-03-19 00:44:54 +00:00
.PHONY : test
2006-08-26 11:35:28 +00:00
i f e q ( $( VERILATOR_AUTHOR_SITE ) , 1 ) # Local... Else don't burden users
test : test_vcs test_c test_sc test_sp test_verilated test_regress
e l s e
test : test_c test_sc test_sp
e n d i f
@echo "Tests passed!"
@echo
@echo "Type 'make install' to install documentation."
@echo
test_vcs : all_nomsg
@( cd test_vcs && $( MAKE) )
test_c : all_nomsg
@( cd test_c && $( MAKE) )
test_c_debug : all_nomsg
2006-12-21 21:53:51 +00:00
@( cd test_c && $( MAKE) test_debug)
2006-08-26 11:35:28 +00:00
test_sc : all_nomsg
@( cd test_sc && $( MAKE) )
test_sc_debug : all_nomsg
2006-12-21 21:53:51 +00:00
@( cd test_sc && $( MAKE) test_debug)
2006-08-26 11:35:28 +00:00
test_sp : all_nomsg
@( cd test_sp && $( MAKE) )
test_sp_debug : all_nomsg
2006-12-21 21:53:51 +00:00
@( cd test_sp && $( MAKE) test_debug)
2006-08-26 11:35:28 +00:00
test_verilated : all_nomsg
@( cd test_verilated && $( MAKE) )
test_regress : all_nomsg
@( cd test_regress && $( MAKE) )
info : $( INFOS )
# Use --no-split to avoid creating filenames > 14 chars.
verilator.1 : bin /verilator
pod2man $< $@
verilator.txt : bin /verilator
pod2text $< $@
verilator.html : bin /verilator
pod2html $< >$@
verilator.pdf : bin /verilator $( DISTCONFIG )
pod2latex --full --out verilator.tex bin/verilator
cat < verilator.tex \
2008-04-16 21:52:23 +00:00
| sed 's/\\begin{document}/\\usepackage[left=1.7in,right=1.7in,top=1.3in,bottom=1.3in]{geometry}\n\\begin{document}/' \
| sed 's/\\begin{document}/\\usepackage[pdftex,bookmarks=true,bookmarksnumbered=true,hypertexnames=false,breaklinks=true,linkbordercolor={0 0 1}]{hyperref}\n\\begin{document}/' \
2006-08-26 11:35:28 +00:00
| sed 's/\\begin{document}/\\usepackage{fancyhdr} \\pagestyle{fancy}\n\\begin{document}/' \
| sed 's/\\begin{document}/\\setlength{\\parindent}{0pt} \\setlength{\\parskip}{\\baselineskip}\n\\begin{document}/' \
2008-04-25 12:14:27 +00:00
| sed 's/\\begin{document}/\\title{$(DISTTITLE)} \\date{${DISTDATE}} \\author{Wilson Snyder\\\\ http:\/\/www.veripool.org}\n\\begin{document}/' \
2006-08-26 11:35:28 +00:00
| sed 's/\\begin{document}/\\lhead[$(DISTTITLE)]{$(DISTTITLE)}\n\\begin{document}/' \
| sed 's/\\tableofcontents/\\begin{titlepage} \\maketitle \\end{titlepage}\n\\tableofcontents/' \
> verilator2.tex
mv verilator2.tex verilator.tex
pdflatex verilator.tex
pdflatex verilator.tex
-rm -f verilator.toc verilator.aux verilator.idx
INSTALL : install .texi
$( MAKEINFO) -I$( srcdir) $( srcdir) /install.texi --output= $@ \
--no-headers --no-validate
README : readme .texi
$( MAKEINFO) -I$( srcdir) $( srcdir) /readme.texi --output= $@ \
--no-headers --no-validate
# See uninstall also
2008-03-18 20:26:37 +00:00
VL_INST_BIN_FILES = verilator verilator_bin verilator_bin_dbg
2006-08-26 11:35:28 +00:00
installbin :
2008-03-18 20:26:37 +00:00
$( SHELL) ${ srcdir } /mkinstalldirs $( bindir)
2006-08-26 11:35:28 +00:00
( cd bin ; $( INSTALL_PROGRAM) verilator $( bindir) /verilator )
2008-03-18 20:26:37 +00:00
( $( INSTALL_PROGRAM) verilator_bin $( bindir) /verilator_bin )
( $( INSTALL_PROGRAM) verilator_bin_dbg $( bindir) /verilator_bin_dbg )
2006-08-26 11:35:28 +00:00
VL_INST_MAN_FILES = verilator.1
installman :
2008-03-18 20:26:37 +00:00
$( SHELL) ${ srcdir } /mkinstalldirs $( mandir)
2006-08-26 11:35:28 +00:00
for p in $( VL_INST_MAN_FILES) ; do \
$( INSTALL_PROGRAM) $$ p $( mandir) /man1/$$ p; \
done
2008-03-18 20:26:37 +00:00
installdata :
$( SHELL) ${ srcdir } /mkinstalldirs $( pkgdatadir) /examples
cp -r include $( pkgdatadir)
cp -r src $( pkgdatadir)
cp -r test_c $( pkgdatadir) /examples
cp -r test_sc $( pkgdatadir) /examples
cp -r test_sp $( pkgdatadir) /examples
2008-03-28 19:42:14 +00:00
cp -r test_v $( pkgdatadir) /examples
2008-03-18 20:26:37 +00:00
VL_INST_DATA_FILES = verilator.1
install : all_nomsg installbin installman installdata install -msg
2006-08-26 11:35:28 +00:00
install-here : installman ftp
i f e q ( $( VERILATOR_AUTHOR_SITE ) , 1 ) # Local... Else don't burden users
DIRPROJECT := $( shell project_dir --project)
INST_PROJ_CVS = cp_if_cvs_diff
install-project : dist
@echo " Install-project to $( DIRPROJECT) "
strip verilator_bin*
$( MAKE) install-project-quick
for p in verilator.1 ; do \
$( INSTALL_PROGRAM) -m 0666 $$ p $( DIRPROJECT_PREFIX) /man/man1/$$ p; \
done
$( INST_PROJ_CVS) $( DISTNAME) .tar.gz $( DIRPROJECT) /hw/utils/verilator/verilator.tgz
rm $( DISTNAME) .tar.gz
install-project-quick :
@echo " Install-project-quick (no strip) to $( DIRPROJECT) "
for p in $( INST_PROJ_FILES) ; do \
$( INST_PROJ_CVS) $$ p $( DIRPROJECT) /hw/utils/verilator/$$ p; \
done
for p in $( INST_PROJ_BIN_FILES) ; do \
$( INST_PROJ_CVS) $$ p $( DIRPROJECT) /hw/utils/verilator/$$ p-$( DIRPROJECT_ARCH) ; \
done
e n d i f
ftp : info
install-msg :
@echo "Installed!"
@echo
@echo "Add to your startup file (for bash or csh, as appropriate):"
@echo " export VERILATOR_ROOT=" ` pwd `
@echo " setenv VERILATOR_ROOT " ` pwd ` " ; export VERILATOR_ROOT "
@echo
@echo "See 'verilator.txt' for documentation."
@echo
uninstall :
-cd $( mandir) /man1 && rm -f $( VL_INST_MAN_FILES)
-cd $( bindir) && rm -f $( VL_INST_BIN_FILES)
2008-03-18 20:26:37 +00:00
-rm -f $( pkgdatadir)
2006-08-26 11:35:28 +00:00
2006-12-18 19:20:45 +00:00
# autoheader might not change config_build.h.in, so touch a stamp file.
2006-08-26 11:35:28 +00:00
IN_WILD := ${ srcdir } /*.in ${ srcdir } /*/*.in ${ srcdir } /*/*/*.in \
*.in */*.in */*.in
2006-12-18 19:20:45 +00:00
${srcdir}/config_build.h.in : stamp -h .in
2006-12-15 21:18:41 +00:00
${srcdir}/stamp-h.in : configure .ac $( wildcard $ ( IN_WILD ) )
2006-08-26 11:35:28 +00:00
cd ${ srcdir } && autoheader
echo timestamp > ${ srcdir } /stamp-h.in
2006-12-18 19:20:45 +00:00
config_build.h : stamp -h
stamp-h : config_build .h .in config .status
2006-08-26 11:35:28 +00:00
./config.status
Makefile : Makefile .in config .status
./config.status
src/Makefile : src /Makefile .in config .status
./config.status
config.status : configure
./config.status --recheck
2006-12-15 21:18:41 +00:00
configure : configure .ac
2006-08-26 11:35:28 +00:00
autoconf
maintainer-clean ::
@echo "This command is intended for maintainers to use;"
@echo "rebuilding the deleted files requires makeinfo."
2008-04-25 12:16:55 +00:00
rm -f *.info* $( INFOS) faq.html verilator.html configure
2006-08-26 11:35:28 +00:00
clean mostlyclean distclean maintainer-clean maintainer-copy ::
for dir in $( SUBDIRS) ; do \
echo making $@ in $$ dir ; \
( cd $$ dir && $( MAKE) $@ ) ; \
done
clean mostlyclean distclean maintainer-clean ::
rm -f $( SCRIPTS) *.tmp
rm -f *.aux *.cp *.cps *.dvi *.fn *.fns *.ky *.kys *.log
rm -f *.pg *.pgs *.toc *.tp *.tps *.vr *.vrs *.idx
rm -f *.ev *.evs *.ov *.ovs *.cv *.cvs *.ma *.mas
rm -f *.tex
distclean maintainer-clean ::
rm -f Makefile config.status config.cache config.log verilator_bin* TAGS
rm -f include/verilated.mk
TAGFILES = ${ srcdir } /*/*.cpp ${ srcdir } /*/*.h ${ srcdir } /*/[ a-z] *.in \
${ srcdir } /[ a-z] *.in ${ srcdir } /*.texi
TAGS : $( TAGFILES )
etags $( TAGFILES)
######################################################################
# Distributions
2006-12-18 19:20:45 +00:00
DISTCONFIG = src/config_build.h.in
2006-08-26 11:35:28 +00:00
DISTTITLE := $( shell sed -e '/DTVERSION/!d' -e 's/[^0-9]*\([0-9.a-z]*\).*/verilator-\1/' -e 's/v/V/' -e q $( DISTCONFIG) )
DISTNAME := $( shell sed -e '/DTVERSION/!d' -e 's/[^0-9]*\([0-9.a-z]*\).*/verilator-\1/' -e q $( DISTCONFIG) )
2008-04-16 21:52:23 +00:00
DISTDATEPRE := $( shell sed -e '/DTVERSION/!d' -e 's/.*\([1-2][0-9][0-9][0-9].[0-9]*[0-9].[0-9]*[0-9]\).*/\1/' -e q $( DISTCONFIG) )
2006-08-26 11:35:28 +00:00
DISTTAGNAME := $( subst .,_,$( subst -,_,$( DISTNAME) ) )
DISTDATE := $( subst /,-,$( DISTDATEPRE) )
tag :
svnorcvs tag $( DISTTAGNAME)
# Don't depend on DISTFILES because there's no rule for "standards.info*".
dist : $( DISTDEP ) maintainer -copy
-rm -fr $( DISTNAME)
for file in $( DISTFILES) ; do \
mkdir -p ` dirname $( DISTNAME) /$$ file` >/dev/null ; \
ln $$ file $( DISTNAME) /$$ file \
|| { echo copying $$ file instead; cp -p $$ file $( DISTNAME) /$$ file; } ; \
done ; true;
chmod -R a+r $( DISTNAME)
tar chf $( DISTNAME) .tar $( DISTNAME)
gzip --force --best $( DISTNAME) .tar
rm -fr $( DISTNAME)
maintainer-diff :
svnorcvs diff $( DISTTAGNAME)
preexist :
test ! -r ~/src/kits/$( DISTNAME) .tar.gz
maintainer-dist : preexist dist tag
cp *.gz ~/backpack
cp *.gz ~/src/kits