home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / dbmalloc.zip / Makefile.orig < prev    next >
Makefile  |  1993-01-04  |  9KB  |  355 lines

  1. #
  2. #  (c) Copyright 1990, 1991, 1992 Conor P. Cahill (uunet!virtech!cpcahil).  
  3. #  This software may be distributed freely as long as the following conditions
  4. #  are met:
  5. #          * the distribution, or any derivative thereof, may not be
  6. #           included as part of a commercial product
  7. #         * full source code is provided including this copyright
  8. #         * there is no charge for the software itself (there may be
  9. #           a minimal charge for the copying or distribution effort)
  10. #         * this copyright notice is not modified or removed from any
  11. #           source file
  12. #
  13. #
  14. # $Id: Makefile,v 1.39 1992/08/22 16:27:13 cpcahil Exp $
  15. #
  16. # This is the Makefile for the malloc debugging library
  17. #
  18. # NOTE: while most porting changes are made here, the malloc.h file
  19. #       may require hand editing (mostly the DATATYPE and SIZETYPE
  20. #    typedefs) because of system wierdities.
  21. #
  22. # Usefull targets:
  23. #
  24. #    all        make all programs/libs in the local directory
  25. #    install        install updated programs/libs
  26. #    frcinstall    install all programs/libs
  27. #    tests        build tests
  28. #    runtests    build and run all tests
  29. #    clean        clean up after yourself
  30. #    fullclean    clean up everything (including configure stuff)
  31. #
  32. # NOTE: there are several other targets used by myself for souce code
  33. # maintenance related functions.  These are probably specific to my system
  34. # and may not do what they are supposed to do in a different environment.
  35. # Therefore, unless you know what you are doing, I would suggest not running
  36. # them (hence why they are not documented here).
  37. #
  38. # And now, onto a few definitions that you may need to alter
  39. #
  40. # The following defines may be added as necessary to the CFLAGS definition:
  41. #
  42. # -DANSI_NULLS      if you want to allow passing of NULL pointers to realloc
  43. #            and/or free (as ANSI does) even if the library is
  44. #            compiled by a non-ANSI compiler.
  45. # -DNO_ANSI_NULLS     if you DON'T want to allow passing of NULL pointers to
  46. #            realloc and/or free, even if the library is compiled by
  47. #            an ANSI conforming compiler.
  48. # -DDONT_USE_ASM    don't use ASM speedups when replacing system memcpy
  49. #            and/or memset routines
  50. # -DCTYPE_SUPPORT=x    where x is one of the following
  51. #
  52. #                1 - use plain-jane ctype.h which is only valid
  53. #                    for the ansii character set (DEFAULT)
  54. #                2 - use POSIX setlocal() to setup the character
  55. #                    set definitions
  56. #                3 - use C library islower() & toupper()
  57. #                    functions
  58. #
  59. # NOTE: if you add any flags other than the above to the CFLAGS, you might want
  60. #    to add a similar arguement in the Config.flags file.  However, you
  61. #     should remember that the malloc.h configuration will depend upon these
  62. #    settings and you could have a problem if you attempt to use the file
  63. #    in a compile session that doesn't include these flags.
  64. #
  65. CFLAGS=-g
  66. #
  67. # Where the code will be installed
  68. #
  69. #    DESTDIR        root for installation directory
  70. #    INSTDIR     installation directory
  71. #    LIBINSTDIR    install directory for library
  72. #    INCINSTDIR    install directory for include files
  73. #    MANINSTDIR    manual installation directory
  74. #    MANINSTNAME    name to install the manual as
  75. #    MANINSTVER    manual install version (use malloc.3 for troff/nroff
  76. #            source and malloc.man for pre-formatted)
  77. #
  78. DESTDIR=
  79. INSTDIR=$(DESTDIR)/usr/local
  80. LIBINSTDIR=$(INSTDIR)/lib
  81. INCINSTDIR=$(INSTDIR)/debug_include
  82. MANINSTDIR=$(INSTDIR)/man/man3
  83. RANLIB=/usr/local/bin/ranlib
  84. MANINSTNAME=dbmalloc.3
  85. MANINSTVER=malloc.3
  86.  
  87. #
  88. # miscellaneous commands
  89. #
  90. # NOTE: if you change CC to a non-K&R compiler be sure to read the 
  91. #       PROBLEMS file first.
  92. #
  93. CC=cc
  94. CPROTO=/usr/local/bin/cproto
  95. LINT=lint
  96. NROFF=nroff
  97. SHARCMD=makekit -p -m -nmallocshar.
  98. SHELL=/bin/sh
  99.  
  100. LIB=libdbmalloc.a
  101. LINTLIB=llib-ldbmal.ln
  102.  
  103. #
  104. # You shouldn't have to modify anything below this line
  105. #
  106. LIBSRCS=    malloc.c    \
  107.         datamc.c    \
  108.         datams.c    \
  109.         dgmalloc.c    \
  110.         fill.c        \
  111.         free.c        \
  112.         realloc.c    \
  113.         calloc.c    \
  114.         string.c    \
  115.         mcheck.c    \
  116.         mchain.c    \
  117.         memory.c    \
  118.         tostring.c    \
  119.         m_perror.c    \
  120.         m_init.c    \
  121.         mallopt.c    \
  122.         dump.c         \
  123.         stack.c        \
  124.         xmalloc.c    \
  125.         xheap.c        \
  126.         malign.c    \
  127.         size.c        \
  128.         abort.c        \
  129.         leak.c    
  130.  
  131. LIBOBJS=    malloc.o    \
  132.         datamc.o    \
  133.         datams.o    \
  134.         dgmalloc.o    \
  135.         fill.o        \
  136.         free.o        \
  137.         realloc.o    \
  138.         calloc.o    \
  139.         string.o    \
  140.         mcheck.o    \
  141.         mchain.o    \
  142.         memory.o    \
  143.         tostring.o    \
  144.         m_perror.o    \
  145.         m_init.o    \
  146.         mallopt.o    \
  147.         dump.o         \
  148.         stack.o        \
  149.         xmalloc.o    \
  150.         xheap.o        \
  151.         malign.o    \
  152.         size.o        \
  153.         abort.o        \
  154.         leak.o    
  155.  
  156. SRCS=$(LIBSRCS) testmalloc.c testmem.c testerr.c teststack.c cctest.c
  157. HDRS= malloc.h.org mallocin.h debug.h tostring.h
  158.  
  159. BUILDFILES=malloc.man prototypes.h 
  160.  
  161. MANSRCFILES=patchlevel README PROBLEMS CHANGES Buildpatch minipatch Makefile \
  162.     malloc.3 malloc.man $(SRCS) $(HDRS) prototypes.h \
  163.     Configure Config.flags Runtests testerr.base
  164. SRCFILES=MANIFEST $(MANSRCFILES)
  165.  
  166. TESTS=testmalloc testmem testerr teststack
  167.  
  168. all:    $(LIB)
  169.  
  170. install: $(LIBINSTDIR)/$(LIB) $(INCINSTDIR)/malloc.h \
  171.     $(MANINSTDIR)/$(MANINSTNAME)
  172.  
  173. frcinstall: rminstall install
  174.  
  175. rminstall:
  176.     rm -f $(LIBINSTDIR)/$(LIB) $(INCINSTDIR)/malloc.h \
  177.     $(MANINSTDIR)/$(MANINSTNAME)
  178.  
  179. $(LIBINSTDIR)/$(LIB): $(LIB)
  180.     -rm -f $@.old
  181.     -mv -f $@ $@.old
  182.     cp $? $@
  183.     @-if test -s $(RANLIB); then $(RANLIB) $@; \
  184.          else if test -s /bin/ranlib; then /bin/ranlib $@; \
  185.      else if test -s /usr/bin/ranlib; then /usr/bin/ranlib $@; \
  186.      else exit 0; fi; fi; fi
  187.     -chmod 644 $@
  188.     -rm -f $@.old
  189.  
  190. $(INCINSTDIR)/malloc.h: malloc.h
  191.     -rm -f $@.old
  192.     -mv -f $@ $@.old
  193.     cp $? $@
  194.     -chmod 644 $@
  195.     -rm -f $@.old
  196.     
  197. $(MANINSTDIR)/$(MANINSTNAME): $(MANINSTVER)
  198.     -rm -f $@.old
  199.     -mv -f $@ $@.old
  200.     cp $? $@
  201.     -chmod 644 $@
  202.     -rm -f $@.old
  203.  
  204. tests:    $(TESTS)
  205.  
  206. #
  207. # runtests - target for building and running the tests.  Note that we 
  208. # run testmalloc with fill_area disabled.  This is because testmalloc is
  209. # a malloc exerciser and we just want to see if we broke malloc, not verify
  210. # that the test doesn't overwrite memory (since it doesn't).
  211. #
  212. runtests: tests
  213.     @echo "Running all of the test programs.  This may take a while so"
  214.     @echo "please be patient.  Note that you won't see any output unless"
  215.     @echo "a test fails....."
  216.     ./Runtests
  217.  
  218. clean:  
  219.     rm -f $(TESTS) pgm cctest $(LIB) *.o *.ln Runtests.out malloc.h \
  220.         sysdefs.h
  221.  
  222. fullclean: clean
  223.     rm -f .configure .configure.[sO] *.O core cscope.out tags
  224.  
  225. sharfile: $(SRCFILES) CHECKSUMS
  226.     $(SHARCMD)
  227.  
  228. CHECKSUMS: $(SRCFILES)
  229.     echo "SYSV sums:\n" > CHECKSUMS
  230.     sum $(SRCFILES) >> CHECKSUMS
  231.     echo "\nBSD sums (generated using sum -r on SYSV system):\n" >>CHECKSUMS
  232.     sum -r $(SRCFILES) >> CHECKSUMS
  233.  
  234. MANIFEST: $(MANSRCFILES)    
  235.     $(SHARCMD) -x
  236.     chmod -w MANIFEST
  237.     
  238. $(LIB): $(LIBOBJS)
  239.     ar ru $(LIB) $(LIBOBJS)
  240.     @-if test -s $(RANLIB); then $(RANLIB) $@; \
  241.          else if test -s /bin/ranlib; then /bin/ranlib $@; \
  242.      else if test -s /usr/bin/ranlib; then /usr/bin/ranlib $@; \
  243.      else exit 0; fi; fi; fi
  244.  
  245. $(LINTLIB): $(LIBSRCS)
  246.     $(LINT) -x -v -o dbmal $(LIBSRCS)
  247.  
  248. malloc.h: malloc.h.org Configure
  249.     ./Configure 
  250.  
  251. sysdefs.h: Configure
  252.     ./Configure 
  253.  
  254. #
  255. # stuff for building the nroffed version of the manual page
  256. #
  257. man:    malloc.man
  258.  
  259. malloc.man: malloc.3
  260.     rm -f malloc.man
  261.     $(NROFF) -man malloc.3 | col -b > malloc.man
  262.  
  263. #
  264. # stuff for building the test programs
  265. #
  266. testmalloc:    $(LIB) testmalloc.o
  267.     $(CC) $(CFLAGS) -o $@ testmalloc.o $(LIB)
  268.  
  269. testmem:    $(LIB) testmem.o
  270.     $(CC) $(CFLAGS) -o $@ testmem.o $(LIB)
  271.  
  272. teststack:    $(LIB) teststack.o
  273.     $(CC) $(CFLAGS) -o $@ teststack.o $(LIB)
  274.  
  275. testerr:    $(LIB) testerr.o
  276.     $(CC) $(CFLAGS) -o $@ testerr.o $(LIB)
  277.  
  278. #
  279. # misc stuff for source code maintenance
  280. #
  281. lint:    
  282.     $(LINT) $(CFLAGS) $(SRCS)
  283.  
  284. proto:
  285.     rm -f prototypes.h
  286.     make prototypes.h
  287.  
  288. prototypes.h: $(LIBSRCS) $(HDRS) malloc.h
  289.     @if [ ! -s $(CPROTO) ]; then \
  290.         echo "Need cproto to rebuild prototypes file";\
  291.         exit 1; \
  292.     else \
  293.         exit 0; \
  294.     fi
  295.     -rm -f prototypes.h
  296.     cp /dev/null prototypes.h
  297.     $(CPROTO) -Dforce_cproto_to_use_defines -D__STDC__ \
  298.          -DDONT_USE_ASM -m__stdcargs -f4 $(LIBSRCS) \
  299.          | sed -e "s/const/CONST/g" > prototypes.new
  300.     mv prototypes.new prototypes.h
  301.     chmod -w prototypes.h
  302.     
  303. patch: $(SRCFILES)
  304.     sh Buildpatch $(SRCFILES)
  305.  
  306. srclist:
  307.     @echo $(SRCFILES)
  308.  
  309. rcsclean: $(BUILDFILES)
  310.     -rcsclean -q $(SRCFILES)
  311.     -ls $(SRCFILES) 2>/dev/null > files.list
  312.     -rcs -i -t/dev/null `cat files.list` 2>/dev/null
  313.     @set -e; \
  314.     echo "files to be checked in: `cat files.list`"; \
  315.     echo "\n\tMessage: \c"; \
  316.     read message; \
  317.     echo ""; \
  318.     rcs -q -l `cat files.list`; \
  319.     ci -m"$$message" `cat files.list`; \
  320.     co -u $(SRCFILES)
  321.  
  322. #
  323. # special rules for building datams.o and datamc.o
  324. #
  325. datams.o: datams.c malloc.h mallocin.h sysdefs.h
  326.     @rm -f datams.o; \
  327.     if [ -s datams.O ]; then \
  328.         echo "        cp datams.O $@"; \
  329.         cp datams.O $@; \
  330.     else \
  331.         echo "        $(CC) $(CFLAGS) -c datams.c"; \
  332.         $(CC) $(CFLAGS) -c datams.c; \
  333.     fi
  334.  
  335. datamc.o: datamc.c malloc.h mallocin.h sysdefs.h
  336.     @rm -f datamc.o; \
  337.     if [ -s datamc.O ]; then \
  338.         echo "        cp datamc.O $@"; \
  339.         cp datamc.O $@; \
  340.     else \
  341.         echo "        $(CC) $(CFLAGS) -c datamc.c"; \
  342.         $(CC) $(CFLAGS) -c datamc.c; \
  343.     fi
  344.  
  345. #
  346. # include file dependencies
  347. #
  348. $(LIBOBJS):    malloc.h mallocin.h sysdefs.h
  349.  
  350. testerr.o testmalloc.o testmem.o:    malloc.h sysdefs.h
  351.  
  352. tostring.o malloc.o dump.o:    tostring.h sysdefs.h
  353.