# FileName [ Makefile.in ] # # PackageName [ vis ] # # Synopsis [ Package-wide Makefile ] # # Description [ This file requires GNU's make program. # Run "configure" to generate the Makefile, or use # "config.status" (created by configure) to regenerate the # Makefile after modifying this file. # # Type "gmake help" for help about valid targets. # ] # # SeeAlso [ configure.in ] # # Author [ Stephen Edwards # Tom Shiple ] # # Copyright [ # Copyright (c) 1994-1996 The Regents of the Univ. of California. # All rights reserved. # # Permission is hereby granted, without written agreement and without license # or royalty fees, to use, copy, modify, and distribute this software and its # documentation for any purpose, provided that the above copyright notice and # the following two paragraphs appear in all copies of this software. # # IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR # DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT # OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF # CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND # FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN # "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE # MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # ] # # Revision [$Id: Makefile.in,v 1.127 2010/04/09 23:06:15 hsv Exp $] # Default target: .PHONY : default default : all #---------------------------------------------------------------------- # The list of packages to compile. Change this if you are only compiling # part of VIS #---------------------------------------------------------------------- #PKGS = tst PKGS = $(ALL_PKGS) # The name of the BDD package to use BDDPKG = @BDDLIB@ #---------------------------------------------------------------------- # This Makefile is designed for three different situations: # # 1. Single platform build (the default) # # All packages listed in the PKGS variable # local_srcdir = master_srcdir = . # # 2. Multi-platform build # # All packages listed in the PKGS variable # local_srcdir = master_srcdir = /where/source/files/reside # # 3. Multi-platform development (used at Berkeley) # # Packages under development listed in the PKGS variable # local_srcdir = ../common # master_srcdir = /projects/vis/vis-devel/common # # User has a directory structure that looks like # # vis/common/src/ Subdirectory with package source files # under development. # # vis/$PLATFORM/ Subdirectory with this Makefile. # Compilation is invoked here. # # $PLATFORM is something like "alpha-g" (DEC Alpha, debug version) # #---------------------------------------------------------------------- #---------------------------------------------------------------------- # Information about all the packages #---------------------------------------------------------------------- ALL_PKGS = abs amc baig bmc cmd ctlp ctlsp eqv fsm rob grab hrc imc img io ltl \ maig mark mc mvf mvfaig ntk ntm ntmaig ord part puresat rst res restr \ rt sat sim spfd synth tbl truesim tst debug var vm # Generate the list of all packages NOT in the PKGS list MISSING_PKGS = $(filter-out $(PKGS), $(ALL_PKGS)) # All the BDD packages BDDPKGS = cu cmu cal #---------------------------------------------------------------------- # For safety #---------------------------------------------------------------------- SHELL = /bin/sh .SUFFIXES: #---------------------------------------------------------------------- # The name of the product and its version #---------------------------------------------------------------------- PRODUCT = vis VERSION = 2.3 # Compile and version information # # CUR_DATE and CUR_VER are strings surrounded by double quotes that contain # spaces, e.g., "vis release 2.0" VERDATE := -DCUR_DATE="\"$(shell date)\"" -DCUR_VER="\"$(PRODUCT) release $(VERSION)\"" #---------------------------------------------------------------------- # Source directories #---------------------------------------------------------------------- # Directory containing master source files. This directory is searched # for packages NOT listed in the PKGS variable. Defaults to "." # Override with ./configure --srcdir= master_srcdir = @srcdir@ # Directory containing local source files. This directory is searched # for packages listed in the PKGS variable. Defaults to the master source # directory (see above). # Override with ./configure --with-local-srcdir= local_srcdir = @local_srcdir@ #---------------------------------------------------------------------- # Directories used while building #---------------------------------------------------------------------- # Directories to search for glu .h files (space-separated) gluincdir1 = @gluincdir@ # Directories to search for libglu.a (space-separated) glulibdir1 = @glulibdir@ # Directory where object files will be placed during the build objectdir = obj # Directory where links to header files will be placed during the build headerdir = $(local_srcdir)/include # Directories where documentation will be placed during the build docdir = $(master_srcdir)/doc htmldocdir = $(docdir)/html txtdocdir = $(docdir)/txt helpdir = $(master_srcdir)/share/help # Directories to search for VIS library files # Set by ./configure --with-vis-libdir= vislibdir = @vislibdir@ # Full path of platform-independent library files during the build. # Using this variable as an environment variable allows VIS to work # before it is installed. # # Note: This is NOT where they will be installed VIS_LIBRARY_PATH = $(shell cd $(master_srcdir)/share ; pwd) #---------------------------------------------------------------------- # Defaults for GLU library and header files #---------------------------------------------------------------------- ifndef gluincdir1 gluincdir = ../glu-$(VERSION)/include ../../glu-$(VERSION)/include else gluincdir = $(gluincdir1) $(gluincdir1)/../src/cudd endif ifndef glulibdir1 glulibdir = ../glu-$(VERSION) ../../glu-$(VERSION) else glulibdir = $(glulibdir1) endif #---------------------------------------------------------------------- # Installation names and directories #---------------------------------------------------------------------- # Name of the library to create LIBRARY = lib$(PRODUCT).a # Name of the man page MANPAGE = vis.1 # Directory in which to install architecture-independent files # Set by ./configure --prefix=... prefix = @prefix@ # Directory in which to install architecture-dependent files # Set by ./configure --exec-prefix=... exec_prefix = @exec_prefix@ # Directory in which to install binaries bindir = $(exec_prefix)/bin # Directory in which to install libraries libdir = $(exec_prefix)/lib # Directory in which to install headers includedir = $(prefix)/include # Directory in which to install architecture-independent library files datadir = $(prefix)/share/vis # Directory for the man page mandir = $(prefix)/man/man1 #---------------------------------------------------------------------- # The following are set by the configure script #---------------------------------------------------------------------- AC_FLAGS = @DEFS@ LIBDIRS = @LIBDIRS@ RANLIB = @RANLIB@ CC = @CC@ LINKER = @LINKER@ LDFLAGS = @LDFLAGS@ # # Define the linker for the executable with "memory_profile" activated # PLINKER = @PLINKER@ CFLAGS = @CFLAGS@ OTHERLIBS = -lm @LIBS@ @LEXLIB@ YACC = @YACC@ LEX = @LEX@ NAWK = @AWK@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ AR = @AR@ ZCHAFF= @ZCHAFF@ #---------------------------------------------------------------------- # Examples included in the distribution #---------------------------------------------------------------------- # Each example is declared only once. If some checking through is done # make check, then it is declared in one of CHECK_COMMON_EXAMPLES, # CHECK_EXAMPLES_cu, CHECK_EXAMPLES_cmu or CHECK_EXAMPLES_cu. If the example # is just being added to the examples directory in VIS, then add it here. EXAMPLES = $(CHECK_COMMON_EXAMPLES) $(CHECK_EXAMPLES_cu) \ $(CHECK_EXAMPLES_cmu) $(CHECK_EXAMPLES_cal) \ bpb eight_queens minmax ping_pong_new rcnum # The "interesting" example files are anything in the examples subdirectories # except the RCS subdirectories # # This is a rather messy way to look for filenames in the local_srcdir, # then remove the local_srcdir prefix EXAMPLEFILES = $(patsubst $(local_srcdir)/%, %, \ $(filter-out %RCS, $(foreach example, $(EXAMPLES), \ $(wildcard $(local_srcdir)/examples/$(example)/*)))) # $(pathsubst $(local_srcdir)/%, %, \ # $(filter-out %/RCS, $(foreach example, $(EXAMPLES), \ #---------------------------------------------------------------------- # Distributed files in the doc directory #---------------------------------------------------------------------- DOCUMENTATION = blifmv.ps ctl.ps vis_user.ps two_phase.ps #---------------------------------------------------------------------- # Files in the share directory #---------------------------------------------------------------------- SHAREFILES = master.visrc ioBlifToMv.nawk ioBlifToMvForIncremental.nawk\ script_compute_reach.simple script_compute_reach.robust\ script_model_check.simple script_model_check.robust\ script_fair_model_check.simple script_fair_model_check.robust\ script_lang_empty_check.simple script_lang_empty_check.robust\ script_generic.simple script_generic.robust\ sislib.mv createfunctionmap memoryaccount visdbgpp HELPFILES = $(notdir $(wildcard $(helpdir)/*.txt)) #---------------------------------------------------------------------- # Include the make templates from all the packages # # Each of these templates (e.g., array/array.make) should contains lines # of the form # # CSRC += source1.c source2.c # HEADERS += header1.h header2.h # LEXSRC += file1.l # YACCSRC += file2.y # GENERATEDCSRC += ctlpLex.c ctlpRead.c #---------------------------------------------------------------------- MAKEINCLUDES = $(foreach package, $(PKGS), \ $(local_srcdir)/src/$(package)/$(package).make) include $(MAKEINCLUDES) OBJECTS = $(addprefix $(objectdir)/,$(GENERATEDCSRC:.c=.o) $(CSRC:.c=.o)) #---------------------------------------------------------------------- # Include the dependency files from each package directory. # A missing dependency file does not produce an error. #---------------------------------------------------------------------- DEPENDENCIES = $(foreach package, $(PKGS), \ $(local_srcdir)/src/$(package)/$(package).d) -include $(DEPENDENCIES) #---------------------------------------------------------------------- # Header files and library search paths and names # # INCLUDEDIRS looks like "-I/projects/glu/ -I/projects/vis/ ..." # LIBRARYDIRS looks like "-L/projects/glu/ -L/projects/vis/ ..." # LIBS looks like "-lm -lglu -lvis" #---------------------------------------------------------------------- INCLUDEDIRS = $(addprefix -I,$(gluincdir)) \ $(foreach package, $(PKGS), -I$(local_srcdir)/src/$(package)) \ $(foreach package, $(MISSING_PKGS), \ -I$(master_srcdir)/src/$(package)) \ -I$(objectdir) LIBRARYDIRS = $(addprefix -L,$(vislibdir)) $(addprefix -L,$(glulibdir)) \ $(LIBDIRS) # Link against the VIS library only if some packages are missing # (i.e., we are compiling only a few packages locally) ifneq ($(strip $(MISSING_PKGS)),) VISLIBS = -l$(PRODUCT) else VISLIBS = endif GLULIBS = -l$(BDDPKG) -lglu # g++ on Linux RH requires -lstdc++ ifeq ($(CC),g++) OTHERLIBS += -lstdc++ endif LIBS = $(VISLIBS) $(GLULIBS) $(OTHERLIBS) #---------------------------------------------------------------------- # Form the the list of directories to search for header files. # # VPATH looks like /projects/vis:/projects/glu/: ... #---------------------------------------------------------------------- VPATH = $(local_srcdir): \ $(master_srcdir): \ $(addprefix :$(local_srcdir)/src/,$(PKGS)): \ $(addprefix :$(master_srcdir)/src/,$(MISSING_PKGS)): \ $(objectdir): \ $(local_srcdir)/share #---------------------------------------------------------------------- # Definitions for the distribution file #---------------------------------------------------------------------- DISTRIBUTION = $(PRODUCT)-$(VERSION) # Directories to include in the distribution file DISTDIRS = src helpers share share/help obj doc examples \ $(addprefix examples/,$(EXAMPLES)) $(addprefix src/,$(PKGS)) # Build/install helper files HELPERS = $(addprefix helpers/, \ install-sh mkinstalldirs config.guess config.sub dependency.make) # Files to include in the distribution file DISTFILES = \ README INSTALL NEWS \ configure configure.in Makefile.in $(HELPERS) \ vis.1 \ xsimv \ $(CSRC) $(HEADERS) $(LEXSRC) $(YACCSRC) $(MAKEINCLUDES) \ $(EXAMPLEFILES) \ $(addprefix doc/,$(DOCUMENTATION)) \ $(addprefix share/,$(SHAREFILES)) \ $(addprefix share/help/,$(HELPFILES)) #---------------------------------------------------------------------- # Variables used by for Revision Control #---------------------------------------------------------------------- # The root RCS directory rcs_rootdir = /projects/vis/rcsRoot/common RCSFILES = $(CSRC) $(HEADERS) $(LEXSRC) $(YACCSRC) $(MAKEINCLUDES) RCSMISCFILES = Makefile.in configure.in localconfigure \ masterconfigure README INSTALL NEWS xsimv $(addprefix helpers/, mkinstalldirs install-sh \ config.guess config.sub dependency.make ) RCSSHAREFILES = $(SHAREFILES) #---------------------------------------------------------------------- # Implicit rules #---------------------------------------------------------------------- ALLCFLAGS = $(CFLAGS) $(AC_FLAGS) $(VERDATE) \ -DNAWK=\"$(NAWK)\" -DLIBRARY=\"$(datadir)\" # For compiling a source file into the object directory $(objectdir)/%.o : %.c umask 2 ; $(CC) -c $(ALLCFLAGS) $(INCLUDEDIRS) -o $@ $< # Place object files into an archive %.a : rm -f $@ umask 2; $(AR) cq $@ $^ $(RANLIB) $@ ###################################################################### # RULES # ###################################################################### #: #: Useful targets: #: #---------------------------------------------------------------------- # Rule for getting help #---------------------------------------------------------------------- .PHONY : help #: help -- Print a list of targets # This prints all lines in this Makefile that begin with #: help : @sed -n "s/^#://p" Makefile #---------------------------------------------------------------------- # Always executed once when the Makefile is run #---------------------------------------------------------------------- # Make sure the directory in which to place the objects exists ignored := $(shell umask 2; test -d $(objectdir) || mkdir $(objectdir)) #---------------------------------------------------------------------- # Rules to compile and build libraries and executables #---------------------------------------------------------------------- .PHONY : all allprods library allprods-mp exe-mp compile-version delete-version #: #: all (the default) -- Compile the main executable # (force the version to be recompiled) all : ALLCFLAGS += -DBDD$(BDDPKG) all : compile-version $(PRODUCT) # Create the main executable $(PRODUCT) : $(OBJECTS) $(glulibdir)/libglu.a $(glulibdir)/lib$(BDDPKG).a umask 2 ; $(LINKER) -o $(PRODUCT) $(LDFLAGS) \ $(OBJECTS) $(LIBRARYDIRS) $(LIBS) #: allprods -- Compile an executable linked with each BDD package allprods : $(OBJECTS) $(glulibdir)/libglu.a $(foreach bddpkg, $(BDDPKGS), \ $(glulibdir)/lib$(bddpkg).a) @for bddpkg in $(BDDPKGS) ; \ do \ rm -f $(objectdir)/satBDD.o; \ umask 2 ; $(CC) -c $(ALLCFLAGS) -DBDD$$bddpkg $(INCLUDEDIRS) -o $(objectdir)/satBDD.o $(master_srcdir)/src/sat/satBDD.c; \ echo "Creating vis-$$bddpkg";\ umask 2 ; $(LINKER) -o $(PRODUCT)-$$bddpkg $(LDFLAGS) $(OBJECTS) \ $(LIBRARYDIRS) $(VISLIBS) -l$$bddpkg -lglu $(OTHERLIBS); \ done # Force the "version" information to be recompiled compile-version : delete-version $(objectdir)/vmVers.o $(objectdir)/satBDD.o # Delete the object file related to the version delete-version : rm -f $(objectdir)/vmVers.o $(objectdir)/satBDD.o # Build a library containing all the objects #: library -- Create a library of all the objects (useful in a central area) library : $(LIBRARY) $(LIBRARY) : $(OBJECTS) ifdef PLINKER $(PRODUCT)-mp : $(LIBRARY) $(glulibdir)/libglu.a \ $(foreach bddpkg, $(BDDPKGS), \ $(glulibdir)/lib$(bddpkg).a) umask 2 ; $(PLINKER) -o $(PRODUCT)-mp $(OBJECTS) \ `purify -printhomedir`/libpurify_stubs.a \ $(LIBRARYDIRS) $(LIBS) allprods-mp : $(LIBRARY) $(glulibdir)/libglu.a \ $(foreach bddpkg, $(BDDPKGS), \ $(glulibdir)/lib$(bddpkg).a) @for bddpkg in $(BDDPKGS) ; \ do \ echo "Creating vis-$$bddpkg";\ umask 2 ; $(PLINKER) -o $(PRODUCT)-$$bddpkg-mp $(OBJECTS) \ `purify -printhomedir`/libpurify_stubs.a \ $(LIBRARYDIRS) $(VISLIBS) -l$$bddpkg -lglu $(OTHERLIBS) ; \ done exe-mp : $(OBJECTS) $(PLINKER) -o $(PRODUCT)-mp $(OBJECTS) \ `purify -printhomedir`/libpurify_stubs.a \ $(LIBRARYDIRS) $(LIBS) endif #---------------------------------------------------------------------- # Rule to produce the function map for the memory_profile command #---------------------------------------------------------------------- .PHONY : functionmap FMAPFILE = .fmap functionmap: $(CSRC) $(VIS)/common/share/createfunctionmap $^ >$(FMAPFILE) #---------------------------------------------------------------------- # Rules for installation #---------------------------------------------------------------------- .PHONY : install uninstall installdirs #: #: install -- Install the product and libraries in bindir, libdir, #: datadir, etc. install : $(PRODUCT) $(LIBRARY) installdirs @echo "Installing $(bindir)/$(PRODUCT)" @$(INSTALL_PROGRAM) $(PRODUCT) $(bindir)/$(PRODUCT) @echo "Installing $(libdir)/$(LIBRARY)" @$(INSTALL_DATA) $(LIBRARY) $(libdir)/$(LIBRARY) @for file in $(SHAREFILES) ; do \ echo "Installing $(datadir)/$$file"; \ $(INSTALL_DATA) $(master_srcdir)/share/$$file \ $(datadir)/$$file; \ done @for file in $(HELPFILES) ; do \ echo "Installing $(datadir)/help/$$file"; \ $(INSTALL_DATA) $(master_srcdir)/share/help/$$file \ $(datadir)/help/$$file; \ done @echo "Installing $(mandir)/vis.1" @$(INSTALL_DATA) vis.1 $(mandir)/vis.1 @for header in $(HEADERS); do \ echo "Installing $(includedir)/$$header"; \ $(INSTALL_DATA) $(master_srcdir)/src/*/$$header \ $(includedir)/$$header; \ done #: uninstall -- Reverse the effects of "install" uninstall : rm -f $(bindir)/$(PRODUCT) rm -f $(libdir)/$(LIBRARY) @for file in $(SHAREFILES) ; \ do \ echo "Removing $(datadir)/$$file"; \ rm -f $(datadir)/$$file; \ done @for file in $(HELPFILES) ; \ do \ echo "Removing $(datadir)/help/$$file"; \ rm -f $(datadir)/help/$$file; \ done @for header in $(HEADERS); \ do \ echo "Removing $(includedir)/$$header"; \ rm -f $(includedir)/$$header; \ done installdirs : $(master_srcdir)/helpers/mkinstalldirs \ $(bindir) $(libdir) $(includedir) $(datadir) $(datadir)/help \ $(mandir) #---------------------------------------------------------------------- # Rules for checking the build #---------------------------------------------------------------------- .PHONY : check check-examples # This is a lengthy sed command used to filter out the irrelevant VIS # output that appears when the examples are running. # # Sed does not permit space between the trailing p ("print matching # lines") and the semicolon (end of command). Hashes are escaped -- # otherwise they are Makefile comments. This was once a long egrep # expression, but the string was too long for Ultrix's egrep. SED_CMD = \ /^FSM depth/p; \ /^computation depth/p; \ /^reachable states =/p; \ /^\# MC: formula passed/p; \ /^\# MC: formula failed/p; \ /^\# MC: the number of non-trivial forced segments/p; \ /^\# MC: Vacuous/p; \ /^\# MC: No vacuous/p; \ /[sS]tates covered/p; \ /covered states/p; \ /Percentage of coverage/p; \ /^\# LTL_MC: formula passed/p; \ /^\# LTL_MC: formula failed/p; \ /^\# INV: formula passed/p; \ /^\# INV: formula failed/p; \ /^\# LE: language is not empty/p; \ /^\# LE: language emptiness check passes/p; \ /^\# ABS: formula passed/p; \ /^\# ABS: formula failed/p; \ /^\# BMC: formula failed/p;\ /^\# BMC: no counterexample found/p; \ /Residue/p; \ /^\# AMC: Verified formula TRUE/p; \ /^\# AMC: Verified formula FALSE/p; \ /Equivalence Classes/p; \ /Total number of literals/p; \ /Networks are combinationally equivalent\./p; \ /Networks are sequentially equivalent\./p; \ /;.*;/p; CHECK_EXAMPLES_cu = daio_receiver mult6x6 s1269 fpmpy restruct synthesis \ production_cell CHECK_EXAMPLES_cmu = CHECK_EXAMPLES_cal = # List of all examples to check (A subset of EXAMPLES) CHECK_COMMON_EXAMPLES = abp amp arbiter bakery coherence counter crd ctlp3 \ dcnew eisenberg elevator ethernet exampleS gcd gigamax ping_pong \ scheduler short slider tbl_one_bug tcp tlc treearbiter CHECK_EXAMPLES = $(CHECK_COMMON_EXAMPLES) $(CHECK_EXAMPLES_$(BDDPKG)) # Determine the absolute executable path # # Starting from the current directory, change directory to the directory # part of the product name, then tack on the filename part of EXECUTABLE EXECUTABLE = $(PRODUCT) EXECUTABLEPATH := \ $(shell cd $(dir $(EXECUTABLE)) ; pwd)/$(notdir $(EXECUTABLE)) # Determine the rootname of the examples # EXAMPLEPATH = $(master_srcdir)/examples FULLEXAMPLEPATH := $(shell cd $(EXAMPLEPATH) ; pwd) #: #: check -- Test the locally-built executable (runs check-examples) check : check-examples # Run check on each of the bdd versions (named e.g., vis-cmu) #: check-allprods -- Test each of the BDD executables (see allprods) check-allprods : @for bddpkg in $(BDDPKGS) ; \ do \ echo "Checking $(PRODUCT)-$$bddpkg";\ $(MAKE) PRODUCT=$(PRODUCT)-$$bddpkg BDDPKG=$$bddpkg check ; \ done #: check-examples -- Test each of the examples listed in CHECK_EXAMPLES #: You may want to invoke this with #: gmake "CHECK_EXAMPLES=abp bakery" check-examples #: gmake EXECUTABLE=vis-cmu check-examples #: gmake EXECUTABLE=/projects/vis/vis-devel/alpha-g/vis \ #: check-examples #: gmake EXAMPLEPATH=/projects/vis/vis-devel/common/examples \ #: check-examples #: gmake EXAMPLEPATH=../common/examples check-examples #: gmake VIS_LIBRARY_PATH=/projects/vis/vis-devel/share # For each example, # # 1) create the directory checkresults/ # 2) enter that directory # 3) create "check_script" by prepending a "set open_path" command # to the example's check_script in the master source directory. This # makes VIS look in the master source directory for example files # 4) run VIS on that script, producing "result.raw" # 5) filter out relevant lines in the result, producing "result.filtered" # and compare this with the "check_result" file in the master source # directory. Differences are written to "result.differences" check-examples : @test -d checkresults || mkdir checkresults @echo "Checking examples. Results will be in checkresults//result.raw" @echo "Running executable $(EXECUTABLEPATH)" @echo " (change with EXECUTABLE=...)" @echo "Taking examples from $(FULLEXAMPLEPATH)" @echo " (change with EXAMPLEPATH=...)" @cwd=`pwd` ; \ VIS_LIBRARY_PATH=$(VIS_LIBRARY_PATH) ; \ export VIS_LIBRARY_PATH ; \ for example in $(CHECK_EXAMPLES) ; \ do \ echo -n "Checking $$example ... " ; \ cd $$cwd ; \ test -d checkresults/$$example || \ mkdir checkresults/$$example ; \ cd checkresults/$$example ; \ rm -f check_script ; \ echo "set open_path $(FULLEXAMPLEPATH)/$$example" > check_script ; \ cat $(FULLEXAMPLEPATH)/$$example/check_script >> check_script ; \ $(EXECUTABLEPATH) -f check_script -x > result.raw 2> result.stderr ; \ sed -n '$(SED_CMD)' result.raw > result.filtered ; \ if diff result.filtered \ $(FULLEXAMPLEPATH)/$$example/check_result > result.differences ; \ then \ echo "passed" ; \ rm result.differences ; \ else \ echo "failed (more checkresults/$$example/result.differences)" ; \ fi ; \ done # egrep '$(KEY_WORDS)' result.raw > result.filtered ; \ #---------------------------------------------------------------------- # Rules that produce/delete the dependency file for every package #---------------------------------------------------------------------- .PHONY : dependencies cleandependencies #: #: dependencies -- Create a list of dependency files. #: Useful when modifying header files. # Invoke the "dependency.make" Makefile on each package subdirectory, # passing the path, etc. to it. # # There's a strange feature in autoconf where lines of the form " VPATH=" # are removed from the Makefile. Thus, a flag is placed before the # VPATH= argument below. dependencies: ifneq ($(findstring <$(CC)>, ),) for pkg in $(PKGS) ; \ do \ $(MAKE) --no-print-directory \ -f $(master_srcdir)/helpers/dependency.make \ CC="$(CC)" \ CFLAGS="$(CFLAGS)" VPATH="$(local_srcdir)/src/$$pkg" \ AC_FLAGS="$(AC_FLAGS)" \ INCLUDEDIRS="$(INCLUDEDIRS)" objectdir=$(objectdir) \ PKGNAME=$(local_srcdir)/src/$$pkg/$$pkg \ $(local_srcdir)/src/$$pkg/$$pkg.d ; \ done else @echo "dependency requires gcc, g++, icc, or icpc" @echo "Reconfigure with gcc, g++, icc, or icpc" endif cleandependencies: rm -f $(local_srcdir)/src/*/*.d #---------------------------------------------------------------------- # Rules for making a distribution file #---------------------------------------------------------------------- .PHONY : dist #: #: dist -- Create a tarred, gzipped distribution file # Warning: "tar" under Digital Unix (on DEC Alphas) writes directories # that don't work under SunOS tar dist : $(DISTRIBUTION).tar.gz $(DISTRIBUTION).tar.gz : $(DISTFILES) ifeq ($(strip $(FULL_MISSING_PKGS)),) rm -rf $(DISTRIBUTION) umask 022; mkdir $(DISTRIBUTION) for dir in $(DISTDIRS); \ do \ umask 022; mkdir $(DISTRIBUTION)/$$dir; \ done @echo "Copying distribution files" @for file in $(patsubst $(local_srcdir)/%, %, $^); \ do \ echo " $$file"; \ cp -p $(local_srcdir)/$$file $(DISTRIBUTION)/$$file; \ done - chmod -R a+r $(DISTRIBUTION) - chmod -R u+w $(DISTRIBUTION) tar cf - $(DISTRIBUTION) | gzip -9 > $(DISTRIBUTION).tar.gz rm -rf $(DISTRIBUTION) else @echo "Missing packages: $(FULL_MISSING_PKGS)" @echo "Make sure PKGS lists all the packages" @exit 1 endif #---------------------------------------------------------------------- # Rules for rebuilding the configure file and Makefile #---------------------------------------------------------------------- ${master_srcdir}/configure : configure.in cd ${master_srcdir} && autoconf chmod 0775 ${master_srcdir}/config* config.status : configure ./config.status --recheck Makefile : Makefile.in config.status @echo "The master Makefile.in has been changed:" @echo "run config.status" @echo "Warning: This will overwrite any local Makefile modifications" @exit 1 #---------------------------------------------------------------------- # Rules for cleaning #---------------------------------------------------------------------- .PHONY : clean mostlyclean distclean #: #: clean -- Remove every file created by building clean mostlyclean : rm -rf $(objectdir)/* $(LIBRARY) $(PRODUCT) \ $(foreach bddpkg, $(BDDPKGS), $(PRODUCT)-$(bddpkg)) \ checkresults include #: distclean -- Remove every file created by building or configuring distclean : clean cleandependencies rm -f Makefile config.status config.cache config.log #---------------------------------------------------------------------- # Rule for performing a lint-like check on the source code # # Note: This requires gcc or g++ #---------------------------------------------------------------------- .PHONY : check-code #: #: check-code -- Run a lint-like check on the source code. #: (useful for development) CHECK_FLAGS := -Wall -pedantic -DBDD$(BDDPKG) ifeq ($(CC),gcc) CHECK_FLAGS += -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations endif check-code : $(CSRC) $(BDD_CSRC) $(MDD_CSRC) ifneq ($(findstring <$(CC)>, ),) @rm -f *.o_checkcode @for file in $^; \ do \ echo "------------------------ Checking $$file"; \ $(CC) -c $(CFLAGS) $(AC_FLAGS) $(CHECK_FLAGS) \ $(VERDATE) $(INCLUDEDIRS) \ -o $(objectdir)/checkcode_output.o $$file; \ rm -f $(objectdir)/checkcode_output.o; \ done @rm -f *.o_checkcode else @echo "check-code requires gcc or g++" @echo "Reconfigure with gcc or g++" endif #---------------------------------------------------------------------- # Rule for generating function prototypes for all the # source and header files in all the PKGS # # Note: This requires "extproto," part of the ext package available from # ftp://ic.eecs.berkeley.edu/pub/Ext #---------------------------------------------------------------------- .PHONY : proto #: #: proto -- Regenerate all the function prototypes in the packages #: Useful during development. You may want to invoke it with #: gmake "PKGS=tst tbl" proto proto : @cd $(local_srcdir)/src ; \ for pkg in $(PKGS); \ do \ cd $$pkg ; \ extproto *.h *.c ; \ cd .. ; \ done #---------------------------------------------------------------------- # Rules for generating the documentation and command help files # for all the packages # # Note: This requires "extdoc," part of the ext package, and # lynx, a textual WWW browser #---------------------------------------------------------------------- .PHONY : allDoc doc indices helpfiles cleandoc #: #: allDoc -- Extract all the documentation (runs doc, indices, and helpfiles) allDoc : cleandoc doc indices helpfiles #: doc -- Extract HTML and text documentation on all the functions doc : $(htmldocdir) $(txtdocdir) for pkg in $(PKGS); \ do \ umask 2 ; extdoc --html=$(htmldocdir) --text=$(txtdocdir) \ $(local_srcdir)/src/$$pkg/$$pkg; \ done #: indices -- Generate function and command indices for the HTML documentation indices : $(htmldocdir) umask 2 ; extindex $(htmldocdir) #: helpfiles -- Generate the help files from the HTML documentation helpfiles : $(helpdir) for file in $(htmldocdir)/*Cmd.html ; \ do \ echo Converting $$file ; \ umask 2 ; lynx -dump $$file > $(helpdir)/`basename $$file .html`.txt ; \ done #: cleandoc -- Remove all the documentation generated by "allDoc" cleandoc : -rm -f $(htmldocdir)/*.html -rm -f $(txtdocdir)/*.txt -rm -f $(helpdir)/*Cmd.txt $(htmldocdir) : - umask 2 ; mkdir $(htmldocdir) $(txtdocdir) : - umask 2 ; mkdir $(txtdocdir) $(helpdir) : - umask 2 ; mkdir $(helpdir) #---------------------------------------------------------------------- # Revision control rules # # May be invoked with command-line overrides, e.g., # gmake RCSFILES=foo.c rcs_co # gmake PKGS=array rcs_ci #---------------------------------------------------------------------- .PHONY: rcs_ci rcs_co rcs_diff rcs_ident rcs_status #: #: You may want to invoke the RCS rules with #: gmake "PKGS=tst tbl" rcs_ci #: gmake "RCSFILES=tstMain.c" rcs_co #: #: rcs_ci -- check in user-modified files and put an updated copy #: in the central area rcs_ci: $(RCSFILES) @for file in $(patsubst $(local_srcdir)/%, %, $^); \ do \ ci -u $(RCSFLAGS) $(local_srcdir)/$$file $(rcs_rootdir)/$$file,v; \ co -u $(RCSFLAGS) $(master_srcdir)/$$file $(rcs_rootdir)/$$file,v; \ done #: rcs_co -- check out files for modification rcs_co: $(RCSFILES) @for file in $(patsubst $(local_srcdir)/%, %, $^); \ do \ co -l $(RCSFLAGS) $(local_srcdir)/$$file $(rcs_rootdir)/$$file,v; \ done #: rcs_diff -- Report differences between local files and checked-in versions rcs_diff: $(RCSFILES) @for file in $(patsubst $(local_srcdir)/%, %, $^); \ do \ rcsdiff $(RCSFLAGS) $(local_srcdir)/$$file $(rcs_rootdir)/$$file,v; \ done #: rcs_ident -- Print the RCS identifier in each file rcs_ident: $(RCSFILES) @for file in $(patsubst $(local_srcdir)/%, %, $^); \ do \ ident $(RCSFLAGS) $(local_srcdir)/$$file; \ done #: rcs_status -- Report who has checked out files rcs_status: $(RCSFILES) @for file in $(patsubst $(local_srcdir)/%, %, $^); \ do \ rlog -L -h $(RCSFLAGS) $(rcs_rootdir)/$$file,v; \ done #---------------------------------------------------------------------- # RCS rules for common/{Makefile.in, configure.in, localconfigure, # masterconfigure, mkinstalldirs, install-sh} #---------------------------------------------------------------------- .PHONY : rcs_ci_misc rcs_co_misc rcs_diff_misc #: rcs_ci_misc -- Check in miscellaneous files, updating central area rcs_ci_misc: $(RCSMISCFILES) @for file in $(patsubst $(local_srcdir)/%, %, $^); \ do \ ci -u $(RCSFLAGS) $(local_srcdir)/$$file $(rcs_rootdir)/$$file,v; \ co -u $(RCSFLAGS) $(master_srcdir)/$$file $(rcs_rootdir)/$$file,v; \ done #: rcs_co_misc -- Check out miscellaneous files rcs_co_misc: $(RCSMISCFILES) @for file in $(patsubst $(local_srcdir)/%, %, $^); \ do \ co -l $(RCSFLAGS) $(local_srcdir)/$$file $(rcs_rootdir)/$$file,v; \ done #: rcs_diff_misc -- Report differences in miscellaneous files rcs_diff_misc: $(RCSMISCFILES) @for file in $(patsubst $(local_srcdir)/%, %, $^); \ do \ rcsdiff $(RCSFLAGS) $(local_srcdir)/$$file $(rcs_rootdir)/$$file,v; \ done #: rcs_ident_misc -- Report RCS identifiers rcs_ident_misc: $(RCSMISCFILES) @for file in $(patsubst $(local_srcdir)/%, %, $^); \ do \ ident $(RCSFLAGS) $(local_srcdir)/$$file; \ done #: rcs_status_misc -- Report checked in/out status, ownership rcs_status_misc: $(RCSMISCFILES) @for file in $(patsubst $(local_srcdir)/%, %, $^); \ do \ rlog -L -h $(RCSFLAGS) $(rcs_rootdir)/$$file,v; \ done #---------------------------------------------------------------------- # RCS rules for files in common/share #---------------------------------------------------------------------- .PHONY : rcs_ci_share rcs_co_share rcs_diff_share #: rcs_ci_share -- Check in files in the share/ directory rcs_ci_share: $(RCSSHAREFILES) @for file in $(patsubst $(local_srcdir)/%, %, $^); \ do \ ci -u $(RCSFLAGS) $(local_srcdir)/$$file $(rcs_rootdir)/$$file,v; \ co -u $(RCSFLAGS) $(master_srcdir)/$$file $(rcs_rootdir)/$$file,v; \ done #: rcs_co_share -- Check out share files rcs_co_share: $(RCSSHAREFILES) @for file in $(patsubst $(local_srcdir)/%, %, $^); \ do \ co -l $(RCSFLAGS) $(local_srcdir)/$$file $(rcs_rootdir)/$$file,v; \ done #: rcs_diff_share -- Report differences in share files rcs_diff_share: $(RCSSHAREFILES) @for file in $(patsubst $(local_srcdir)/%, %, $^); \ do \ rcsdiff $(RCSFLAGS) $(local_srcdir)/$$file $(rcs_rootdir)/$$file,v; \ done #: rcs_ident_share -- Report RCS identifiers rcs_ident_share: $(RCSSHAREFILES) @for file in $(patsubst $(local_srcdir)/%, %, $^); \ do \ ident $(RCSFLAGS) $(local_srcdir)/$$file; \ done #: rcs_status_share -- Report checked in/out status, ownership rcs_status_share: $(RCSSHAREFILES) @for file in $(patsubst $(local_srcdir)/%, %, $^); \ do \ rlog -L -h $(RCSFLAGS) $(rcs_rootdir)/$$file,v; \ done #---------------------------------------------------------------------- # Rules for debugging the Makefile #---------------------------------------------------------------------- .PHONY : debug-make DEBUG_VARS = ALL_PKGS \ PKGS \ MISSING_PKGS \ VPATH \ INCLUDEDIRS \ CSRC \ OBJECTS \ HEADERS \ MAKEINCLUDES \ CFLAGS \ AC_FLAGS \ master_srcdir \ local_srcdir \ RCSFILES \ RCSDIR \ LIBS \ VISLIBS \ DISTFILES \ EXAMPLEFILES #: #: debug-make -- Print a list of Makefile variables debug-make: @$(foreach var, $(DEBUG_VARS), echo $(var)=$($(var)) ; )