Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 1 | # Skeleton Makefile for the GNU malloc code |
| 2 | # |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 3 | # Copyright (C) 1996-2009 Free Software Foundation, Inc. |
Jari Aalto | bb70624 | 2000-03-17 21:46:59 +0000 | [diff] [blame] | 4 | |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 5 | # This program is free software: you can redistribute it and/or modify |
| 6 | # it under the terms of the GNU General Public License as published by |
| 7 | # the Free Software Foundation, either version 3 of the License, or |
| 8 | # (at your option) any later version. |
Jari Aalto | bb70624 | 2000-03-17 21:46:59 +0000 | [diff] [blame] | 9 | |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 10 | # This program is distributed in the hope that it will be useful, |
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | # GNU General Public License for more details. |
Jari Aalto | bb70624 | 2000-03-17 21:46:59 +0000 | [diff] [blame] | 14 | |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 15 | # You should have received a copy of the GNU General Public License |
| 16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 17 | |
| 18 | srcdir = @srcdir@ |
| 19 | VPATH = .:@srcdir@ |
| 20 | topdir = @top_srcdir@ |
| 21 | BUILD_DIR = @BUILD_DIR@ |
| 22 | |
| 23 | INSTALL = @INSTALL@ |
| 24 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ |
| 25 | INSTALL_DATA = @INSTALL_DATA@ |
| 26 | |
| 27 | CC = @CC@ |
| 28 | RANLIB = @RANLIB@ |
| 29 | AR = @AR@ |
Jari Aalto | b72432f | 1999-02-19 17:11:39 +0000 | [diff] [blame] | 30 | ARFLAGS = @ARFLAGS@ |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 31 | RM = rm -f |
| 32 | CP = cp |
| 33 | MV = mv |
| 34 | |
Jari Aalto | b72432f | 1999-02-19 17:11:39 +0000 | [diff] [blame] | 35 | SHELL = @MAKE_SHELL@ |
| 36 | |
Jari Aalto | 7117c2d | 2002-07-17 14:10:11 +0000 | [diff] [blame] | 37 | PROFILE_FLAGS = @PROFILE_FLAGS@ |
Jari Aalto | d166f04 | 1997-06-05 14:59:13 +0000 | [diff] [blame] | 38 | |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 39 | CFLAGS = @CFLAGS@ |
| 40 | LOCAL_CFLAGS = @LOCAL_CFLAGS@ |
| 41 | CPPFLAGS = @CPPFLAGS@ |
| 42 | LDFLAGS = @LDFLAGS@ |
| 43 | |
| 44 | DEFS = @DEFS@ |
Jari Aalto | d166f04 | 1997-06-05 14:59:13 +0000 | [diff] [blame] | 45 | LOCAL_DEFS = @LOCAL_DEFS@ |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 46 | |
Jari Aalto | b80f644 | 2004-07-27 13:29:18 +0000 | [diff] [blame] | 47 | LIBBUILD = ${BUILD_DIR}/lib |
| 48 | |
Jari Aalto | bb70624 | 2000-03-17 21:46:59 +0000 | [diff] [blame] | 49 | BASHINCDIR = ${topdir}/include |
| 50 | |
Jari Aalto | b80f644 | 2004-07-27 13:29:18 +0000 | [diff] [blame] | 51 | INTL_LIBSRC = ${topdir}/lib/intl |
| 52 | INTL_BUILDDIR = ${LIBBUILD}/intl |
| 53 | INTL_INC = @INTL_INC@ |
| 54 | LIBINTL_H = @LIBINTL_H@ |
| 55 | |
| 56 | INCLUDES = -I. -I../.. -I$(topdir) -I$(BASHINCDIR) -I$(topdir)/lib $(INTL_INC) |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 57 | |
Jari Aalto | d166f04 | 1997-06-05 14:59:13 +0000 | [diff] [blame] | 58 | CCFLAGS = ${PROFILE_FLAGS} ${INCLUDES} $(DEFS) $(LOCAL_DEFS) $(LOCAL_CFLAGS) \ |
| 59 | $(CFLAGS) $(MALLOC_CFLAGS) $(CPPFLAGS) |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 60 | |
| 61 | .c.o: |
| 62 | $(CC) $(CCFLAGS) -c $< |
| 63 | |
| 64 | .s.o: |
| 65 | $(CC) $(CCFLAGS) -c $< |
| 66 | |
| 67 | MALLOC_SOURCE = malloc.c |
Jari Aalto | d166f04 | 1997-06-05 14:59:13 +0000 | [diff] [blame] | 68 | STUB_SOURCE = stub.c |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 69 | |
| 70 | ALLOCA_SOURCE = alloca.c |
| 71 | ALLOCA_OBJECT = alloca.o |
| 72 | |
| 73 | MALLOC_SRC = @MALLOC_SRC@ |
| 74 | MALLOC = @MALLOC@ |
| 75 | ALLOCA = @ALLOCA@ |
| 76 | |
Jari Aalto | 7117c2d | 2002-07-17 14:10:11 +0000 | [diff] [blame] | 77 | MALLOC_OBJS = malloc.o $(ALLOCA) trace.o stats.o table.o watch.o |
Jari Aalto | d166f04 | 1997-06-05 14:59:13 +0000 | [diff] [blame] | 78 | STUB_OBJS = $(ALLOCA) stub.o |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 79 | |
Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame] | 80 | .PHONY: malloc stubmalloc |
Jari Aalto | d166f04 | 1997-06-05 14:59:13 +0000 | [diff] [blame] | 81 | |
| 82 | all: malloc |
| 83 | |
| 84 | malloc: ${MALLOC_OBJS} |
| 85 | ${RM} libmalloc.a |
Jari Aalto | b72432f | 1999-02-19 17:11:39 +0000 | [diff] [blame] | 86 | ${AR} ${ARFLAGS} libmalloc.a ${MALLOC_OBJS} |
Jari Aalto | d166f04 | 1997-06-05 14:59:13 +0000 | [diff] [blame] | 87 | -test -n "$(RANLIB)" && $(RANLIB) libmalloc.a |
| 88 | |
Jari Aalto | d166f04 | 1997-06-05 14:59:13 +0000 | [diff] [blame] | 89 | stubmalloc: ${STUB_OBJS} |
| 90 | ${RM} libmalloc.a |
Jari Aalto | b72432f | 1999-02-19 17:11:39 +0000 | [diff] [blame] | 91 | ${AR} ${ARFLAGS} libmalloc.a ${STUB_OBJS} |
Jari Aalto | d166f04 | 1997-06-05 14:59:13 +0000 | [diff] [blame] | 92 | -test -n "$(RANLIB)" && $(RANLIB) libmalloc.a |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 93 | |
Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame] | 94 | alloca: ${ALLOCA} |
| 95 | ${RM} libmalloc.a |
| 96 | ${AR} ${ARFLAGS} libmalloc.a ${ALLOCA} |
| 97 | -test -n "$(RANLIB)" && $(RANLIB) libmalloc.a |
| 98 | |
Jari Aalto | e8ce775 | 1997-09-22 20:22:27 +0000 | [diff] [blame] | 99 | alloca.o: $(srcdir)/$(ALLOCA_SOURCE) |
| 100 | $(CC) $(CCFLAGS) -c $(srcdir)/$(ALLOCA_SOURCE) |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 101 | @- if test "$(ALLOCA_OBJECT)" != alloca.o ; then \ |
| 102 | mv $(ALLOCA_OBJECT) alloca.o >/dev/null 2>&1 ; \ |
| 103 | fi |
| 104 | |
| 105 | mostlyclean clean: |
| 106 | $(RM) *.o libmalloc.a |
| 107 | |
| 108 | distclean realclean maintainer-clean: clean |
| 109 | $(RM) Makefile |
| 110 | |
| 111 | alloca.o: $(BUILD_DIR)/config.h |
Jari Aalto | d166f04 | 1997-06-05 14:59:13 +0000 | [diff] [blame] | 112 | malloc.o: $(BUILD_DIR)/config.h $(topdir)/bashtypes.h getpagesize.h |
Jari Aalto | bb70624 | 2000-03-17 21:46:59 +0000 | [diff] [blame] | 113 | xmalloc.o: $(BUILD_DIR)/config.h $(BASHINCDIR)/ansi_stdlib.h |
Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame] | 114 | trace.o: ${BUILD_DIR}/config.h |
Chet Ramey | 495aee4 | 2011-11-22 19:11:26 -0500 | [diff] [blame^] | 115 | stats.o: ${BUILD_DIR}/config.h |
Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame] | 116 | table.o: ${BUILD_DIR}/config.h |
Jari Aalto | 95732b4 | 2005-12-07 14:08:12 +0000 | [diff] [blame] | 117 | watch.o: ${BUILD_DIR}/config.h |
Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame] | 118 | |
| 119 | malloc.o: ${srcdir}/imalloc.h ${srcdir}/mstats.h |
Jari Aalto | 7117c2d | 2002-07-17 14:10:11 +0000 | [diff] [blame] | 120 | malloc.o: ${srcdir}/table.h ${srcdir}/watch.h |
Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame] | 121 | stats.o: ${srcdir}/imalloc.h ${srcdir}/mstats.h |
| 122 | trace.o: ${srcdir}/imalloc.h |
| 123 | table.o: ${srcdir}/imalloc.h ${srcdir}/table.h |
Jari Aalto | 7117c2d | 2002-07-17 14:10:11 +0000 | [diff] [blame] | 124 | watch.o: ${srcdir}/imalloc.h ${srcdir}/watch.h |
Jari Aalto | e8ce775 | 1997-09-22 20:22:27 +0000 | [diff] [blame] | 125 | |
Jari Aalto | b80f644 | 2004-07-27 13:29:18 +0000 | [diff] [blame] | 126 | malloc.o: ${topdir}/bashintl.h ${LIBINTL_H} ${BASHINCDIR}/gettext.h |
| 127 | stats.o: ${topdir}/bashintl.h ${LIBINTL_H} ${BASHINCDIR}/gettext.h |
| 128 | trace.o: ${topdir}/bashintl.h ${LIBINTL_H} ${BASHINCDIR}/gettext.h |
| 129 | table.o: ${topdir}/bashintl.h ${LIBINTL_H} ${BASHINCDIR}/gettext.h |
| 130 | watch.o: ${topdir}/bashintl.h ${LIBINTL_H} ${BASHINCDIR}/gettext.h |
| 131 | |
Jari Aalto | e8ce775 | 1997-09-22 20:22:27 +0000 | [diff] [blame] | 132 | # Rules for deficient makes, like SunOS and Solaris |
| 133 | stub.o: stub.c |
| 134 | malloc.o: malloc.c |
Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame] | 135 | table.o: table.c |
| 136 | trace.o: trace.c |
| 137 | stats.o: stats.c |
Jari Aalto | 7117c2d | 2002-07-17 14:10:11 +0000 | [diff] [blame] | 138 | watch.o: watch.c |