home *** CD-ROM | disk | FTP | other *** search
Makefile | 1996-09-28 | 7.5 KB | 282 lines |
- #
- #
- # (c) Copyright 1990, 1991, 1992 Conor P. Cahill (uunet!virtech!cpcahil).
- #
- # This software may be distributed freely as long as the following conditions
- # are met:
- # * the distribution, or any derivative thereof, may not be
- # included as part of a commercial product
- # * full source code is provided including this copyright
- # * there is no charge for the software itself (there may be
- # a minimal charge for the copying or distribution effort)
- # * this copyright notice is not modified or removed from any
- # source file
- #
- #
- # $Id: Makefile,v 1.39 1992/08/22 16:27:13 cpcahil Exp $
- #
- # This is the Makefile for the malloc debugging library
- #
- # NOTE: while most porting changes are made here, the malloc.h file
- # may require hand editing (mostly the DATATYPE and SIZETYPE
- # typedefs) because of system wierdities.
- #
- # Useful targets:
- #
- # all make all programs/libs in the local directory
- # install install updated programs/libs
- # frcinstall install all programs/libs
- # tests build tests
- # runtests build and run all tests
- # clean clean up after yourself
- # fullclean clean up everything (including configure stuff)
- #
- # NOTE: there are several other targets used by myself for souce code
- # maintenance related functions. These are probably specific to my system
- # and may not do what they are supposed to do in a different environment.
- # Therefore, unless you know what you are doing, I would suggest not running
- # them (hence why they are not documented here).
- #
- # And now, onto a few definitions that you may need to alter
- #
- # The following defines may be added as necessary to the CFLAGS definition:
- #
- # -DANSI_NULLS if you want to allow passing of NULL pointers to realloc
- # and/or free (as ANSI does) even if the library is
- # compiled by a non-ANSI compiler.
- # -DNO_ANSI_NULLS if you DON'T want to allow passing of NULL pointers to
- # realloc and/or free, even if the library is compiled by
- # an ANSI conforming compiler.
- # -DDONT_USE_ASM don't use ASM speedups when replacing system memcpy
- # and/or memset routines
- # -DCTYPE_SUPPORT=x where x is one of the following
- #
- # 1 - use plain-jane ctype.h which is only valid
- # for the ansii character set (DEFAULT)
- # 2 - use POSIX setlocal() to setup the character
- # set definitions
- # 3 - use C library islower() & toupper()
- # functions
- #
- # NOTE: if you add any flags other than the above to the CFLAGS, you might want
- # to add a similar arguement in the Config.flags file. However, you
- # should remember that the malloc.h configuration will depend upon these
- # settings and you could have a problem if you attempt to use the file
- # in a compile session that doesn't include these flags.
- #
-
- srcdir = @srcdir@
- VPATH = @srcdir@
-
- prefix = @prefix@
- exec_prefix = @exec_prefix@
-
- bindir = $(exec_prefix)/bin
- libdir = $(exec_prefix)/lib
- incdir = $(prefix)/include/dbmalloc
- infodir = $(prefix)/info
- mandir = $(prefix)/man/man3
-
- INSTALL = @INSTALL@
- INSTALL_PROGRAM = @INSTALL_PROGRAM@
- INSTALL_DATA = @INSTALL_DATA@
-
- SHELL = /bin/sh
- CC = @CC@
- AR = ar
- RM = rm
- RANLIB = @RANLIB@
- DEFS = @DEFS@
- LIBS = @LIBS@
- CFLAGS = @CFLAGS@
- LDFLAGS = @LDFLAGS@
-
- INCLUDES = -I. -I$(srcdir)
- OUR_CFLAGS = $(DEFS) $(INCLUDES) $(CFLAGS)
-
- .c.o:
- $(CC) -c $(OUR_CFLAGS) $<
- #
- # miscellaneous commands
- #
- # NOTE: if you change CC to a non-K&R compiler be sure to read the
- # PROBLEMS file first.
- #
- CPROTO=/ade/bin/cproto
- LINT=lint
- NROFF=nroff
- SHARCMD=makekit -p -m -nmallocshar.
-
- LIB = libdbmalloc.a
- LINTLIB = llib-ldbmal.ln
-
- #
- # You shouldn't have to modify anything below this line
- #
-
- LIBSRCS= malloc.c datamc.c datams.c dgmalloc.c fill.c free.c realloc.c \
- calloc.c string.c mcheck.c mchain.c memory.c tostring.c \
- m_perror.c m_init.c mallopt.c dump.c stack.c xmalloc.c \
- xheap.c malign.c size.c abort.c leak.c sbrk.c
-
- LIBOBJS= $(LIBSRCS:.c=.o)
-
-
- SRCS = $(LIBSRCS) testmalloc.c testmem.c testerr.c teststack.c cctest.c
- HDRS = malloc.h.org mallocin.h debug.h tostring.h
-
- BUILDFILES = malloc.man prototypes.h
-
- MANSRCFILES = patchlevel README PROBLEMS CHANGES Buildpatch minipatch Makefile \
- malloc.3 malloc.man $(SRCS) $(HDRS) prototypes.h \
- Configure Config.flags Runtests testerr.base
-
- SRCFILES = MANIFEST $(MANSRCFILES)
-
- TESTS = testmalloc testmem testerr teststack
-
- all : $(LIB) tests
-
- install :
- $(INSTALL_DATA) $(LIB) $(libdir)/$(LIB)
- $(RANLIB) $(libdir)/$(LIB)
- $(INSTALL_DATA) $(srcdir)/malloc.h $(incdir)/malloc.h
- $(INSTALL_DATA) $(srcdir)/malloc.3 $(mandir)/malloc.3
-
- rminstall:
- rm -f $(libdir)/$(LIB) $(incdir)/malloc.h $(mandir)/malloc.3
-
- tests: $(TESTS)
-
- #
- # runtests - target for building and running the tests. Note that we
- # run testmalloc with fill_area disabled. This is because testmalloc is
- # a malloc exerciser and we just want to see if we broke malloc, not verify
- # that the test doesn't overwrite memory (since it doesn't).
- #
-
- runtests : tests
- @echo "Running all of the test programs. This may take a while so"
- @echo "please be patient. Note that you won't see any output unless"
- @echo "a test fails....."
- ./Runtests
-
- clean :
- rm -f $(TESTS) pgm cctest $(LIB) *.o *.ln Runtests.out malloc.h \
- sysdefs.h
-
- fullclean : clean
- rm -f .configure .configure.[sO] *.O core cscope.out tags
-
- sharfile : $(SRCFILES) CHECKSUMS
- $(SHARCMD)
-
- CHECKSUMS : $(SRCFILES)
- echo "SYSV sums:\n" > CHECKSUMS
- sum $(SRCFILES) >> CHECKSUMS
- echo "\nBSD sums (generated using sum -r on SYSV system):\n" >>CHECKSUMS
- sum -r $(SRCFILES) >> CHECKSUMS
-
- MANIFEST : $(MANSRCFILES)
- $(SHARCMD) -x
- chmod -w MANIFEST
-
- $(LIB) : $(LIBOBJS)
- $(RM) -f $@
- $(AR) crv $@ $(LIBOBJS)
- $(RANLIB) $@
-
- $(LINTLIB) : $(LIBSRCS)
- $(LINT) -x -v -o dbmal $(LIBSRCS)
-
- #
- # stuff for building the nroffed version of the manual page
- #
-
- man : malloc.man
-
- malloc.man : malloc.3
- rm -f malloc.man
- $(NROFF) -man malloc.3 | col -b > malloc.man
-
- #
- # stuff for building the test programs
- #
-
- testmalloc : $(LIB) testmalloc.o
- $(CC) $(CFLAGS) -o $@ testmalloc.o $(LIB)
-
- testmem : $(LIB) testmem.o
- $(CC) $(CFLAGS) -o $@ testmem.o $(LIB)
-
- teststack : $(LIB) teststack.o
- $(CC) $(CFLAGS) -o $@ teststack.o $(LIB)
-
- testerr : $(LIB) testerr.o
- $(CC) $(CFLAGS) -o $@ testerr.o $(LIB)
-
- #
- # misc stuff for source code maintenance
- #
-
- lint :
- $(LINT) $(CFLAGS) $(SRCS)
-
- proto :
- rm -f prototypes.h
- make prototypes.h
-
- prototypes.h : $(LIBSRCS) $(HDRS) malloc.h
- @if [ ! -s $(CPROTO) ]; then \
- echo "Need cproto to rebuild prototypes file";\
- exit 1; \
- else \
- exit 0; \
- fi
- -rm -f prototypes.h
- cp /dev/null prototypes.h
- $(CPROTO) -Dforce_cproto_to_use_defines -D__STDC__ \
- -DDONT_USE_ASM -m__stdcargs -f4 $(LIBSRCS) \
- | sed -e "s/const/CONST/g" > prototypes.new
- mv prototypes.new prototypes.h
- chmod -w prototypes.h
-
- patch : $(SRCFILES)
- sh Buildpatch $(SRCFILES)
-
- srclist :
- @echo $(SRCFILES)
-
- rcsclean : $(BUILDFILES)
- -rcsclean -q $(SRCFILES)
- -ls $(SRCFILES) 2>/dev/null > files.list
- -rcs -i -t/dev/null `cat files.list` 2>/dev/null
- @set -e; \
- echo "files to be checked in: `cat files.list`"; \
- echo "\n\tMessage: \c"; \
- read message; \
- echo ""; \
- rcs -q -l `cat files.list`; \
- ci -m"$$message" `cat files.list`; \
- co -u $(SRCFILES)
-
- #
- # special rules for building datams.o and datamc.o
- #
-
- datams.o : datams.c malloc.h mallocin.h sysdefs.h
- datamc.o : datamc.c malloc.h mallocin.h sysdefs.h
-
- #
- # include file dependencies
- #
-
- $(LIBOBJS) : malloc.h mallocin.h sysdefs.h
-
- testerr.o : malloc.h sysdefs.h
- testmalloc.o : malloc.h sysdefs.h
- testmem.o : malloc.h sysdefs.h
- tostring.o : tostring.h sysdefs.h
- malloc.o : tostring.h sysdefs.h
- dump.o : tostring.h sysdefs.h
-