| 1 | # Copyright (C) 1992 Free Software Foundation, Inc. |
| 2 | # This file is part of the GNU C Library. |
| 3 | |
| 4 | # The GNU C Library is free software; you can redistribute it and/or |
| 5 | # modify it under the terms of the GNU Library General Public License as |
| 6 | # published by the Free Software Foundation; either version 2 of the |
| 7 | # License, or (at your option) any later version. |
| 8 | |
| 9 | # The GNU C Library is distributed in the hope that it will be useful, |
| 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | # Library General Public License for more details. |
| 13 | |
| 14 | # You should have received a copy of the GNU Library General Public |
| 15 | # License along with the GNU C Library; see the file COPYING.LIB. If |
| 16 | # not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 17 | # Boston, MA 02111-1307, USA. |
| 18 | |
| 19 | # |
| 20 | # Makefile for mmalloc directory |
| 21 | # |
| 22 | |
| 23 | # Directory containing source files. Don't clean up the spacing, |
| 24 | # this exact string is matched for by the "configure" script. |
| 25 | |
| 26 | VPATH = @srcdir@ |
| 27 | srcdir = @srcdir@ |
| 28 | |
| 29 | prefix = @prefix@ |
| 30 | exec_prefix = @exec_prefix@ |
| 31 | |
| 32 | bindir = @bindir@ |
| 33 | libdir = @libdir@ |
| 34 | |
| 35 | datadir = @datadir@ |
| 36 | mandir = @mandir@ |
| 37 | man1dir = $(mandir)/man1 |
| 38 | man2dir = $(mandir)/man2 |
| 39 | man3dir = $(mandir)/man3 |
| 40 | man4dir = $(mandir)/man4 |
| 41 | man5dir = $(mandir)/man5 |
| 42 | man6dir = $(mandir)/man6 |
| 43 | man7dir = $(mandir)/man7 |
| 44 | man8dir = $(mandir)/man8 |
| 45 | man9dir = $(mandir)/man9 |
| 46 | infodir = @infodir@ |
| 47 | includedir = @includedir@ |
| 48 | |
| 49 | SHELL = @SHELL@ |
| 50 | |
| 51 | INSTALL = @INSTALL@ |
| 52 | INSTALL_PROGRAM=@INSTALL_PROGRAM@ |
| 53 | INSTALL_DATA = @INSTALL_DATA@ |
| 54 | |
| 55 | AR = @AR@ |
| 56 | AR_FLAGS = qv |
| 57 | CFLAGS = -g |
| 58 | MAKEINFO = makeinfo |
| 59 | RANLIB = @RANLIB@ |
| 60 | RM = rm |
| 61 | |
| 62 | # where to find makeinfo |
| 63 | MAKEINFO=makeinfo |
| 64 | |
| 65 | SET_TEXINPUTS = TEXINPUTS=${TEXIDIR}:.:$(srcdir):$(READLINE_DIR):$$TEXINPUTS |
| 66 | |
| 67 | # The TeX formatter |
| 68 | TEX = tex |
| 69 | |
| 70 | TARGETLIB = libmmalloc.a |
| 71 | |
| 72 | CFILES = mcalloc.c mfree.c mmalloc.c mmcheck.c mmemalign.c mmstats.c \ |
| 73 | mmtrace.c mrealloc.c mvalloc.c mmap-sup.c attach.c detach.c \ |
| 74 | keys.c sbrk-sup.c mm.c |
| 75 | |
| 76 | HFILES = mmalloc.h |
| 77 | |
| 78 | OFILES = mcalloc.o mfree.o mmalloc.o mmcheck.o mmemalign.o mmstats.o \ |
| 79 | mmtrace.o mrealloc.o mvalloc.o mmap-sup.o attach.o detach.o \ |
| 80 | keys.o sbrk-sup.o |
| 81 | |
| 82 | DEFS = @DEFS@ |
| 83 | |
| 84 | # The current default is to build a single object module with all the mmalloc |
| 85 | # functions. To build a more traditional library, flip this macro definition. |
| 86 | #TARGETOBJS = $(OFILES) |
| 87 | TARGETOBJS = mm.o |
| 88 | |
| 89 | .c.o: |
| 90 | $(CC) -c $(CFLAGS) $(DEFS) -I. -I$(srcdir)/../include $< |
| 91 | |
| 92 | # Do we want/need any config overrides? |
| 93 | # |
| 94 | |
| 95 | STAGESTUFF = $(TARGETLIB) *.o |
| 96 | |
| 97 | all: $(TARGETLIB) |
| 98 | |
| 99 | info: mmalloc.info |
| 100 | dvi: mmalloc.dvi |
| 101 | clean-info: |
| 102 | installcheck: |
| 103 | |
| 104 | mmalloc.info: mmalloc.texi |
| 105 | $(MAKEINFO) -I $(srcdir) -o ./mmalloc.info mmalloc.texi |
| 106 | |
| 107 | # This file doesn't need texindex currently. |
| 108 | mmalloc.dvi: mmalloc.texi |
| 109 | $(SET_TEXINPUTS) $(TEX) mmalloc.texi |
| 110 | rm -f mmalloc.?? mmalloc.??s mmalloc.log mmalloc.aux mmalloc.toc |
| 111 | |
| 112 | install-info: info |
| 113 | if test ! -f mmalloc.info ; then cd $(srcdir); fi; \ |
| 114 | $(INSTALL_DATA) mmalloc.info $(infodir)/mmalloc.info |
| 115 | |
| 116 | check: test1.c |
| 117 | # $(CC) -g $(srcdir)/test1.c libmmalloc.a |
| 118 | # This loses for Canadian cross (building mmalloc with a cross-compiler). |
| 119 | # There is probably some dejagnu-ish solution (such as what we are doing |
| 120 | # for gdb, perhaps). |
| 121 | # ./a.out |
| 122 | |
| 123 | install: all |
| 124 | $(INSTALL_DATA) $(TARGETLIB) $(libdir)/$(TARGETLIB)n |
| 125 | $(RANLIB) $(libdir)/$(TARGETLIB)n |
| 126 | mv -f $(libdir)/$(TARGETLIB)n $(libdir)/$(TARGETLIB) |
| 127 | |
| 128 | $(TARGETLIB): $(TARGETOBJS) |
| 129 | $(RM) -rf $@ |
| 130 | $(AR) $(AR_FLAGS) $@ $(TARGETOBJS) |
| 131 | $(RANLIB) $@ |
| 132 | |
| 133 | $(OFILES) : $(HFILES) Makefile |
| 134 | |
| 135 | mm.o: $(HFILES) $(CFILES) |
| 136 | $(CC) -c $(CFLAGS) $(DEFS) -I. -I$(srcdir)/../include $(srcdir)/mm.c |
| 137 | |
| 138 | .always.: |
| 139 | # Do nothing. |
| 140 | |
| 141 | .PHONEY: all etags tags ls clean stage1 stage2 .always. |
| 142 | |
| 143 | stage1: force |
| 144 | -mkdir stage1 |
| 145 | -mv -f $(STAGESTUFF) stage1 |
| 146 | |
| 147 | stage2: force |
| 148 | -mkdir stage2 |
| 149 | -mv -f $(STAGESTUFF) stage2 |
| 150 | |
| 151 | stage3: force |
| 152 | -mkdir stage3 |
| 153 | -mv -f $(STAGESTUFF) stage3 |
| 154 | |
| 155 | stage4: force |
| 156 | -mkdir stage4 |
| 157 | -mv -f $(STAGESTUFF) stage4 |
| 158 | |
| 159 | against=stage2 |
| 160 | |
| 161 | comparison: force |
| 162 | for i in *.o ; do cmp $$i $(against)/$$i || exit 1 ; done |
| 163 | |
| 164 | de-stage1: force |
| 165 | -(cd stage1 ; mv -f * ..) |
| 166 | -rmdir stage1 |
| 167 | |
| 168 | de-stage2: force |
| 169 | -(cd stage2 ; mv -f * ..) |
| 170 | -rmdir stage2 |
| 171 | |
| 172 | de-stage3: force |
| 173 | -(cd stage3 ; mv -f * ..) |
| 174 | -rmdir stage3 |
| 175 | |
| 176 | de-stage4: force |
| 177 | -(cd stage4 ; mv -f * ..) |
| 178 | -rmdir stage4 |
| 179 | |
| 180 | etags tags: TAGS |
| 181 | |
| 182 | TAGS: $(CFILES) |
| 183 | etags `for i in $(HFILES) $(CFILES); do echo $(srcdir)/$$i ; done` |
| 184 | |
| 185 | ls: |
| 186 | @echo Makefile $(HFILES) $(CFILES) |
| 187 | |
| 188 | # Need to deal with profiled libraries, too. |
| 189 | |
| 190 | mostlyclean clean: |
| 191 | rm -f *.a *.o core errs *~ \#* TAGS *.E a.out errors |
| 192 | |
| 193 | distclean: clean |
| 194 | rm -f config.cache config.log config.status |
| 195 | rm -f Makefile depend |
| 196 | |
| 197 | maintainer-clean realclean: distclean clean |
| 198 | @echo "This command is intended for maintainers to use;" |
| 199 | @echo "it deletes files that may require special tools to rebuild." |
| 200 | rm -f mmalloc.info |
| 201 | |
| 202 | force: |
| 203 | |
| 204 | Makefile: Makefile.in config.status |
| 205 | $(SHELL) config.status |
| 206 | |
| 207 | config.status: configure |
| 208 | $(SHELL) config.status --recheck |