]> andersk Git - splint.git/commitdiff
*** empty log message ***
authordrl7x <drl7x>
Thu, 1 Mar 2001 23:31:35 +0000 (23:31 +0000)
committerdrl7x <drl7x>
Thu, 1 Mar 2001 23:31:35 +0000 (23:31 +0000)
src/Makefile

index 00fcbbc14afc6527f84939c4cb92a72e45bf7bba..e36acf3e54331f0a893157876ab1381dc3e16ed4 100644 (file)
-##################################################
-###                                         
-### Makefile for LCLint                     
-###                                         
-### designed for use with gmake (GNU make)  
-###                                         
-### original version based on LCL Makefile  
-### completely revised December 1993        
-### revised for 1.4a, November 1994         
-### revised for 2.0, February 1996
-### revised for 2.2, August 1996
-###                                         
-### This file should not need to be edited. 
+# Generated automatically from Makefile.in by configure.
 ###
-### Compilers and tools set using the top-level Makefile override settings
-### in this file when make is run from the top directory.
+### Makefile for building and installing LCLint 2.5
 ###
-### Commands:
+### Updated for LCLint 2.5:  23 May 2000
+### Updated for LCLint 2.4:  12 April 1998
+### Updated for LCLint 2.2:  25 August 1996
+### Updated for LCLint 2.1a: 17 April 1996
+### Updated for LCLint 2.0:  24 February 1996
+### Updated for LCLint 1.4:  29 January 1995
+### Original for LCLint 1.0: 20 February 1994
 ###
-### make all 
-###    builds a release version of lclint from scratch using optimizations
+
 ###
-### make quick
-###    builds a local version of lclint (no optimizations)
-###    (does not remake files)
+### This makefile assumes the gnu version of make is available.
 ###
-### make test
-###    runs the test suite 
-###    (must have installed test suite from lclint.test.tar.Z)
+### Run: make          to build LCLint.
+###      make install   to install.
 ###
-
-.SUFFIXES : .h .c .o .l .check
-.PHONY    : all dorerelease retest rerelease homeversion
-.IGNORE   : dorerelease retest rerelease
-
 ###
-### system information (compilers, flags, directories, etc.)
+### These constants will be compiled into the lclint binary.  
+###
+### They may be overridden by environment variables, but these
+### constants set the default values when no environment variables
+### are set.
 ###
 
-include Makefile.sys
+### Command to run C preprocessor:
 
-###
-### check files before compiling
-### (can't be 1 unless you have lclint already!)
-###
+DEFAULT_CPPCMD  = gcc -E
+
+### Directory containing system include files:
 
-CHECK = 0 ### set to 1
+SYSTEM_LIBDIR   = "/usr/include"
 
 ###
-### source files
+### Select installation directories:
 ###
+### The LIBDIR and IMPORTSDIR are compiled into the binary to 
+### select the default LARCH_PATH and LCLIMPORTDIR, which can 
+### also be overridden by environment variables.
+### 
 
-include Makefile.sources
+### directory for lclint libraries
+LIBDIR     = /a/apollo.cs.Virginia.EDU/af9/drl7x/re/LCLintDev/lib
 
-###
-### top level
-### 
+### directory for lclint standard imports
+IMPORTSDIR = /a/apollo.cs.Virginia.EDU/af9/drl7x/re/LCLintDev/imports
 
-all : dorelease
+### directory for lclint binary
+INSTALLDIR = /a/apollo.cs.Virginia.EDU/af9/drl7x/re/LCLintDev/bin
 
-quick: lclint
+### this should be the complete path for the directory where this
+### Makefile is, with no trailing / or spaces.
 
-lclint : $(OBJ) 
-       @echo '// '
-       @echo '//  Linking:'
-       @echo '// '
-       $(CC) -o lclint $(OBJ) $(LINKFLAGS)
+BASEDIR = /a/apollo.cs.Virginia.EDU/af9/drl7x/re/LCLintDev
 
-object: $(OBJ)
+###
+### Then, run:
+###
+###    make
+###
+### I recommend doing this in an emacs shell (or buffered terminal) so
+### you can scroll through the output.
+###
+### This should (hopefully) work on most systems without further changes.
+###
+### If you do not have gcc, set CC = cc (or some other compiler)
+### later in this file. 
+###
+### It should:
+###     o build lclint
+###     o put lclint in BASEDIR/bin/lclint
+###
+### If you have installed the test suite, then do:
+###
+###    make test
+###
+### to verify lclint.
+###
 
-mylint:
-       CC="$(LCLINT)" ; export CC ; $(MAKE) -e object
 ###
-### grammars
+### shell --- should work with /bin/sh or similar shells too.
 ###
 
+SHELL  = /bin/csh
+
+###
+### If you wish to install lclint in some other directory, set these 
+### variables, and do 
 ###
-### -p xx flag to bison renames yyparse ==> xxparse, xxlex ==> xxlex
-### this is probably NOT compatible with yacc.
+###    make install
 ###
 
-signature.c : signature.c.der signature.y
-ifdef BISON
-       @$(BISON) $(YFLAGS) -p lsl signature.y
-       @$(CAT) bison.head signature.tab.c > signature.c
-       @$(MV) Headers/signature_gen.h Headers/signature_gen.bak
-       @$(CAT) bison.head signature.tab.h > Headers/signature_gen.h
-else
-       $(CP) signature.c.der signature.c
-endif
+### installation command
+INSTALL      = /usr/bin/install -c
+INSTALLFLAGS =           
 
-cgrammar.c : cgrammar.c.der cgrammar.y
-ifdef BISON
-       $(BISON) $(YFLAGS) cgrammar.y
-       @echo '//           Expect 119 shift/reduce conflicts and 114 reduce/reduce conflicts.'
-       @echo '//           (see cgrammar.y for explanation)'
-       @$(CAT) bison.head cgrammar.tab.c > cgrammar.c
-       @$(MV) Headers/cgrammar_tokens.h Headers/cgrammar_tokens.bak
-       @$(CAT) bison.head cgrammar.tab.h > Headers/cgrammar_tokens.h
-else
-       $(CP) cgrammar.c.der cgrammar.c
-endif
+### this works with nfs, change to whatever is needed to make
+### a file executable on your system
 
-### llgrammar2.h is necessary so +singleinclude may be used
-
-llgrammar.c  : llgrammar.c.der llgrammar.y
-ifdef BISON
-       $(BISON) $(YFLAGS) -p yl llgrammar.y
-       @echo '//            Expect 2 shift/reduce conflicts.'
-       @$(CAT) bison.head llgrammar.tab.c > llgrammar.c
-       @$(MV) Headers/llgrammar_gen2.h Headers/llgrammar_gen2.bak
-       @$(CAT) bison.head llgrammar.tab.h > Headers/llgrammar_gen2.h
-       @$(MV) Headers/llgrammar_gen.h Headers/llgrammar_gen.bak
-       @$(CAT) bison.head llgrammar.tab.h > Headers/llgrammar_gen.h
-else
-       $(CP) llgrammar.c.der llgrammar.c
-endif
+MAKEEXE = chmod 755
 
-cscanner.c : cscanner.c.der cscanner.l
-ifdef FLEX                             
-       $(FLEX) $(LFLAGS) cscanner.l 
-       $(CAT) flex.head lex.yy.c > cscanner.c
-else
-       $(CP) cscanner.c.der cscanner.c
-endif
+###
+### end of installation variables
+###
 
 ###
-### compile without warnings
-### 
+### compiler --- gcc is recommended, but lclint has been compiled
+###              without changes using cc on several platforms.
+###
 
-signature.o : signature.c
-       $(CC) $(CPPFLAGS) -c $*.c
+CC = gcc  -DSTDC_HEADERS=1
+
+###
+### optimizing compiler --- add optimization flags here
+### 
 
-cgrammar.o : cgrammar.c
-       $(CC) $(CPPFLAGS) -c $*.c
+CCOPT = $(CC) -O2
 
-llgrammar.o : llgrammar.c
-       $(CC) $(CPPFLAGS) -c $*.c
+###
+### link flags --- this links the lex or flex library
+###
 
-cscanner.o : cscanner.c
-       $(CC) $(CPPFLAGS) -c $*.c
+LINKFLAGS = -ll
 
 ###
-### header files dependant on grammars
+### do you have bison and/or flex?
+### (Note: yacc will probably not work; lex might work but is not recommended.)
 ###
 
-Headers/signature2.h : signature.c
-Headers/cgrammar2.h : cgrammar.c
-Headers/llgrammar.h : llgrammar.c
+BISON     = /usr/bin/bison
+FLEX      = /usr/bin/flex
 
 ###
-### defaults
+### is the test suite available? (must be full path here)
 ###
 
-### Flags for checking a single file
-SINGLEFLAGS = +neverinclude -supcounts +partial -showsummary -load lclint.lcd
+TESTDIR   = $(BASEDIR)/test
 
-.c.check: lclint.lcd lclint
-       $(LCLINT) $(LINTFLAGS) $(SINGLEFLAGS) $*.c
+### 
+### if this Makefile is used with one of the
+### standard installation packages, no changes should be 
+### necessary below this line.
+###
 
-.c.o:
-ifeq ($(CHECK), 1)
-       $(LCLINT) $(LINTFLAGS) $(SINGLEFLAGS) $*.c
-endif
-       @echo '//  Compiling '$*.c' / compiled: '`$(OFILES)`'  (of 120 files)'
-       @$(CC) $(CFLAGS) -c $*.c
+.PHONY: install dobinaries dolibraries doimports test 
 
 ###
-### alternatives (tests, releases, backups, etc.)
+### set this to a different directory
+### to install binaries elsewhere
 ###
 
-### -e option makes environment variables take precedence
+RELEASEDIR      = $(BASEDIR)/bin
 
-.PHONY : test quicktest opt up 
+all: bin/lclint 
+lclint: bin/lclint
 
-opt :
-ifneq (,$(findstring csh, $(SHELL)))
-       setenv CC '$(CCOPT)' ; $(MAKE) -e lclint
+bin/lclint: 
+       @echo 'Building lclint from source'
+ifeq ($(SHELL), /bin/csh)
+       cd src ; setenv CC '$(CC)' ; setenv CCOPT '$(CCOPT)'; \
+        setenv BISON '$(BISON)' ; setenv FLEX '$(FLEX)' ; \
+        setenv DEFAULT_CPPCMD '"$(DEFAULT_CPPCMD)"' ; \
+       setenv SYSTEM_LIBDIR '$(SYSTEM_LIBDIR)' ; \
+       setenv LINKFLAGS '$(LINKFLAGS)' ; \
+       setenv DEFAULT_LARCHPATH '".:$(LIBDIR)"' ; \
+       setenv DEFAULT_LCLIMPORTDIR '"$(IMPORTSDIR)"' ; \
+       $(MAKE) -e
 else
-       CC="$(CCOPT)" ; export CC ; $(MAKE) -e lclint
+       cd src ; CC='$(CC)'; export CC; CCOPT='$(CCOPT)'; \
+       BISON='$(BISON)' ; export BISON; FLEX='$(FLEX)'; export FLEX; \
+        DEFAULT_CPPCMD='$(DEFAULT_CPPCMD)' ; export DEFAULT_CPPCMD ;\
+       SYSTEM_LIBDIR='$(SYSTEM_LIBDIR)' ; export SYSTEM_LIBDIR ;\
+       DEFAULT_LARCHPATH='".:$(LIBDIR)/"' ; export DEFAULT_LARCHPATH ;\
+       LINKFLAGS='$(LINKFLAGS)'; export LINK_FLAGS; \
+       DEFAULT_LCLIMPORTDIR='"$(IMPORTSDIR)"' ; export DEFAULT_LCLIMPORTDIR ;\
+       $(MAKE) -e 
 endif
-
-updateversion:
-       @$(MV) Headers/herald.h Headers/herald.last
-       @echo '/* herald.h - created automatically by gmake updateversion */' > Headers/herald.h
-       @echo '/*@constant observer char *LCL_VERSION;@*/' >> Headers/herald.h
-       @echo '# define LCL_VERSION "LCLint '`cat $(VERSION_NUMBER)`' --- '`cat DATE`'"' \
-              >> Headers/herald.h
-       @echo '/*@constant observer char *LCL_PARSE_VERSION;@*/' >> Headers/herald.h
-       @echo '# define LCL_PARSE_VERSION "LCLint '`cat $(VERSION_NUMBER)`'"' \
-              >> Headers/herald.h
-       @echo '/*@constant observer char *LCL_COMPILE;@*/' >> Headers/herald.h
-       @echo '# define LCL_COMPILE "Compiled using '$(CC)' on '`uname -a`' by '`whoami`'"' >> Headers/herald.h
-
-localconstants:
-       @$(MV) Headers/local_constants.h Headers/local_constants.last
-       @echo '/* local_constants.h - created automatically by gmake localconstants */' \
-                > Headers/local_constants.h
-ifndef SYSTEM_LIBDIR
-       @echo '*** Fatal Error: SYSTEM_LIBDIR not defined.'
-else
-       @echo '/*@constant observer char *SYSTEM_LIBDIR;@*/' >> Headers/local_constants.h
-       @echo '# define SYSTEM_LIBDIR $(SYSTEM_LIBDIR)' >> Headers/local_constants.h
-ifndef DEFAULT_LARCHPATH
-       @echo '*** Fatal Error: DEFAULT_LARCHPATH not defined.'
-else
-       @echo '/*@constant observer char *DEFAULT_LARCHPATH;@*/' >> Headers/local_constants.h
-       @echo '# define DEFAULT_LARCHPATH $(DEFAULT_LARCHPATH)' >> Headers/local_constants.h
-ifndef DEFAULT_LCLIMPORTDIR
-       @echo '*** Fatal Error: DEFAULT_LARCHPATH not defined.'
-else
-       @echo '/*@constant observer char *DEFAULT_LCLIMPORTDIR;@*/' >> Headers/local_constants.h
-       @echo '# define DEFAULT_LCLIMPORTDIR $(DEFAULT_LCLIMPORTDIR)' >> Headers/local_constants.h
-endif
-endif
-endif
-
-dorelease: 
        @echo '// '
-       @echo '//  Making LCLint'
-       @echo '//  Version '`cat $(VERSION_NUMBER)`
+       @echo '//  Run: '$(MAKE)' test to check'
        @echo '// '
-       @echo '//  Compiler: '$(CCOPT)
-ifdef BISON
-       @echo '//  Bison: '$(BISON)
-else
-       @echo '//  Use derived bison files'
-endif
-ifdef FLEX
-       @echo '//  Flex: '$(FLEX)
+       mv src/lclint bin/lclint
+
+test:
+ifeq ($(SHELL), /bin/csh)
+       cd $(TESTDIR) ; setenv LCLINT $(RELEASEDIR)/lclint ; $(MAKE) -e
 else
-       @echo '//  Use derived flex files'
+       cd $(TESTDIR) ; LCLINT=$(RELEASEDIR)/lclint ; export LCLINT ; $(MAKE) -e
 endif
-       @echo '//  Default cpp command: '$(DEFAULT_CPPCMD)
-       @echo '//  System include directory: '$(SYSTEM_LIBDIR)
-       @echo '//  Default Larch path: '$(DEFAULT_LARCHPATH)
-       @echo '//  Default imports directory: '$(DEFAULT_LCLIMPORTDIR)
-       @echo '// '
-       @echo 'Making tags'
-       ./maketags
-       @echo '// '
-       @echo '//  Updating version information'
-       @$(MAKE) -e updateversion
-       @echo '//  Updating local constants'
-###    @$(MAKE) -e localconstants
-       @echo '// '
-       @echo '//  Compiling:'
-       @echo '// '
-       @$(MAKE) -e opt
-       @echo '//  Done Release '`cat $(VERSION_NUMBER)`
-
 
-flags: flags.def
-       grep "FLG_" flags.def > Headers/flag_codes.gen
+clean:
+       cd src; $(MAKE) clean
+       rm bin/lclint   
 
 ###
-### cleaning
+### locations of standard LCLint files
 ###
-### Standard entries to remove files from the directories
-###    up       --- remove .o files and grammar derivatives
-###    tidy     --- eliminate unwanted files
-###    clean    --- delete derived files, except for spec-derived files
-###    pristine --- delete all derived files
-###
-
-.PHONY .IGNORE : up tidy clean pristine
+### this should NOT have to be edited if you use the standard
+###    installation package
 
-pristine: clean
-       -$(RM) -f *.lcs *.lslo
+CP  = cp
 
-clean: tidy
-       -$(RM) core lclint 
-       -$(RM) *.out *.output *.bib *.dvi *.idx *.log *.o *.toc
-       -$(RM) cgrammar.c cscanner.c
-       -$(RM) test* Headers/*~ Headers/#* 
+LCLINTBINDIR = $(BASEDIR)/bin
+LCLINTBIN  = lclint
 
-tidy:
-       -$(RM) ,* .,* *.CKP *.BAK .emacs_[0-9]* core a.out *.*~
-
-up: 
-       -$(RM) cgrammar.c llgrammar.c signature.c cscanner.c 
-       -$(RM) *.o
+LCLINTLIB = $(BASEDIR)/lib
+LCLINTIMPORTS = $(BASEDIR)/imports
 
 ###
-### dependancies
+### uses recursive make calls directly, so installation
+### will continue even if there are errors!
 ###
 
-depend:
-       $(MAKEDEPEND) $(CINCLUDES) $(CFLAGS) -f Makefile.depend $(SRC) $(GRAMS)
+install: 
+       @echo '// '
+       @echo '// Doing lclint installation'
+       @echo '// '
+       @echo ' '
+       -@$(MAKE) dobinaries 
+       @echo ' '
+       -@$(MAKE) dolibraries 
+       @echo ' '
+       -@$(MAKE) doimports 
+       @echo ' '
+       @echo '// Installation complete.'
+
+dobinaries:
+       @echo '//  Installing binaries in '$(INSTALLDIR)
+       cd $(LCLINTBINDIR); $(INSTALL) $(INSTALLFLAGS) lclint $(INSTALLDIR)
+       @echo '//  Installed: lclint in '$(INSTALLDIR) 
+
+dolibraries:
+       @echo '//  Installing libraries in '$(LIBDIR)
+       @echo "    (This will complain if the directory already exists, don't worry about it.)"
+       -mkdir $(LIBDIR)
+       $(CP) $(LCLINTLIB)/* $(LIBDIR)
+       @echo '//  Installed libraries.'
+
+doimports:
+       @echo '//  Installing imports in '$(IMPORTSDIR)
+       @echo "    (This will complain if the directory already exists, don't worry about it.)"
+       -mkdir $(IMPORTSDIR)
+       $(CP) $(LCLINTIMPORTS)/* $(IMPORTSDIR)
+       @echo '//  Installed imports.'
 
-###
-### analysing dependancies takes a long time and doesn't work terribly
-### well, so the are NOT included here.  NOTE carefully, this means if a
-### header file is changed manual recompilation may be necessary.
-###
 
-### include Makefile.depend
 
-###
-### LCLint checking
-###
 
-### 
-### A library is used for the specifications
-###
 
-$(CHECKS): lclint.lcd
 
-###
-### other flags are in .lclintrc file
-### 
 
-lint: 
-       $(LCLINT) -f lclint.lclintrc $(CPPFLAGS) +singleinclude -mustfree -namechecks -abstract -boolops -protoparammatch  $(ALLSRC) -dump lclint
 
 
 
This page took 0.058315 seconds and 5 git commands to generate.