blob: abe0eca0ab01be4f6eb265827f2f9e016c674111 [file] [log] [blame]
Jari Aaltoccc6cda1996-12-23 17:02:34 +00001# Skeleton Makefile for the GNU malloc code
2#
Jari Aalto31859422009-01-12 13:36:28 +00003# Copyright (C) 1996-2009 Free Software Foundation, Inc.
Jari Aaltobb706242000-03-17 21:46:59 +00004
Jari Aalto31859422009-01-12 13:36:28 +00005# 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 Aaltobb706242000-03-17 21:46:59 +00009
Jari Aalto31859422009-01-12 13:36:28 +000010# 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 Aaltobb706242000-03-17 21:46:59 +000014
Jari Aalto31859422009-01-12 13:36:28 +000015# 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 Aaltoccc6cda1996-12-23 17:02:34 +000017
18srcdir = @srcdir@
19VPATH = .:@srcdir@
20topdir = @top_srcdir@
21BUILD_DIR = @BUILD_DIR@
22
23INSTALL = @INSTALL@
24INSTALL_PROGRAM = @INSTALL_PROGRAM@
25INSTALL_DATA = @INSTALL_DATA@
26
27CC = @CC@
28RANLIB = @RANLIB@
29AR = @AR@
Jari Aaltob72432f1999-02-19 17:11:39 +000030ARFLAGS = @ARFLAGS@
Jari Aaltoccc6cda1996-12-23 17:02:34 +000031RM = rm -f
32CP = cp
33MV = mv
34
Jari Aaltob72432f1999-02-19 17:11:39 +000035SHELL = @MAKE_SHELL@
36
Jari Aalto7117c2d2002-07-17 14:10:11 +000037PROFILE_FLAGS = @PROFILE_FLAGS@
Jari Aaltod166f041997-06-05 14:59:13 +000038
Jari Aaltoccc6cda1996-12-23 17:02:34 +000039CFLAGS = @CFLAGS@
40LOCAL_CFLAGS = @LOCAL_CFLAGS@
41CPPFLAGS = @CPPFLAGS@
42LDFLAGS = @LDFLAGS@
43
44DEFS = @DEFS@
Jari Aaltod166f041997-06-05 14:59:13 +000045LOCAL_DEFS = @LOCAL_DEFS@
Jari Aaltoccc6cda1996-12-23 17:02:34 +000046
Jari Aaltob80f6442004-07-27 13:29:18 +000047LIBBUILD = ${BUILD_DIR}/lib
48
Jari Aaltobb706242000-03-17 21:46:59 +000049BASHINCDIR = ${topdir}/include
50
Jari Aaltob80f6442004-07-27 13:29:18 +000051INTL_LIBSRC = ${topdir}/lib/intl
52INTL_BUILDDIR = ${LIBBUILD}/intl
53INTL_INC = @INTL_INC@
54LIBINTL_H = @LIBINTL_H@
55
56INCLUDES = -I. -I../.. -I$(topdir) -I$(BASHINCDIR) -I$(topdir)/lib $(INTL_INC)
Jari Aaltoccc6cda1996-12-23 17:02:34 +000057
Jari Aaltod166f041997-06-05 14:59:13 +000058CCFLAGS = ${PROFILE_FLAGS} ${INCLUDES} $(DEFS) $(LOCAL_DEFS) $(LOCAL_CFLAGS) \
59 $(CFLAGS) $(MALLOC_CFLAGS) $(CPPFLAGS)
Jari Aaltoccc6cda1996-12-23 17:02:34 +000060
61.c.o:
62 $(CC) $(CCFLAGS) -c $<
63
64.s.o:
65 $(CC) $(CCFLAGS) -c $<
66
67MALLOC_SOURCE = malloc.c
Jari Aaltod166f041997-06-05 14:59:13 +000068STUB_SOURCE = stub.c
Jari Aaltoccc6cda1996-12-23 17:02:34 +000069
70ALLOCA_SOURCE = alloca.c
71ALLOCA_OBJECT = alloca.o
72
73MALLOC_SRC = @MALLOC_SRC@
74MALLOC = @MALLOC@
75ALLOCA = @ALLOCA@
76
Jari Aalto7117c2d2002-07-17 14:10:11 +000077MALLOC_OBJS = malloc.o $(ALLOCA) trace.o stats.o table.o watch.o
Jari Aaltod166f041997-06-05 14:59:13 +000078STUB_OBJS = $(ALLOCA) stub.o
Jari Aaltoccc6cda1996-12-23 17:02:34 +000079
Jari Aaltof73dda02001-11-13 17:56:06 +000080.PHONY: malloc stubmalloc
Jari Aaltod166f041997-06-05 14:59:13 +000081
82all: malloc
83
84malloc: ${MALLOC_OBJS}
85 ${RM} libmalloc.a
Jari Aaltob72432f1999-02-19 17:11:39 +000086 ${AR} ${ARFLAGS} libmalloc.a ${MALLOC_OBJS}
Jari Aaltod166f041997-06-05 14:59:13 +000087 -test -n "$(RANLIB)" && $(RANLIB) libmalloc.a
88
Jari Aaltod166f041997-06-05 14:59:13 +000089stubmalloc: ${STUB_OBJS}
90 ${RM} libmalloc.a
Jari Aaltob72432f1999-02-19 17:11:39 +000091 ${AR} ${ARFLAGS} libmalloc.a ${STUB_OBJS}
Jari Aaltod166f041997-06-05 14:59:13 +000092 -test -n "$(RANLIB)" && $(RANLIB) libmalloc.a
Jari Aaltoccc6cda1996-12-23 17:02:34 +000093
Jari Aaltof73dda02001-11-13 17:56:06 +000094alloca: ${ALLOCA}
95 ${RM} libmalloc.a
96 ${AR} ${ARFLAGS} libmalloc.a ${ALLOCA}
97 -test -n "$(RANLIB)" && $(RANLIB) libmalloc.a
98
Jari Aaltoe8ce7751997-09-22 20:22:27 +000099alloca.o: $(srcdir)/$(ALLOCA_SOURCE)
100 $(CC) $(CCFLAGS) -c $(srcdir)/$(ALLOCA_SOURCE)
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000101 @- if test "$(ALLOCA_OBJECT)" != alloca.o ; then \
102 mv $(ALLOCA_OBJECT) alloca.o >/dev/null 2>&1 ; \
103 fi
104
105mostlyclean clean:
106 $(RM) *.o libmalloc.a
107
108distclean realclean maintainer-clean: clean
109 $(RM) Makefile
110
111alloca.o: $(BUILD_DIR)/config.h
Jari Aaltod166f041997-06-05 14:59:13 +0000112malloc.o: $(BUILD_DIR)/config.h $(topdir)/bashtypes.h getpagesize.h
Jari Aaltobb706242000-03-17 21:46:59 +0000113xmalloc.o: $(BUILD_DIR)/config.h $(BASHINCDIR)/ansi_stdlib.h
Jari Aaltof73dda02001-11-13 17:56:06 +0000114trace.o: ${BUILD_DIR}/config.h
Chet Ramey495aee42011-11-22 19:11:26 -0500115stats.o: ${BUILD_DIR}/config.h
Jari Aaltof73dda02001-11-13 17:56:06 +0000116table.o: ${BUILD_DIR}/config.h
Jari Aalto95732b42005-12-07 14:08:12 +0000117watch.o: ${BUILD_DIR}/config.h
Jari Aaltof73dda02001-11-13 17:56:06 +0000118
119malloc.o: ${srcdir}/imalloc.h ${srcdir}/mstats.h
Jari Aalto7117c2d2002-07-17 14:10:11 +0000120malloc.o: ${srcdir}/table.h ${srcdir}/watch.h
Jari Aaltof73dda02001-11-13 17:56:06 +0000121stats.o: ${srcdir}/imalloc.h ${srcdir}/mstats.h
122trace.o: ${srcdir}/imalloc.h
123table.o: ${srcdir}/imalloc.h ${srcdir}/table.h
Jari Aalto7117c2d2002-07-17 14:10:11 +0000124watch.o: ${srcdir}/imalloc.h ${srcdir}/watch.h
Jari Aaltoe8ce7751997-09-22 20:22:27 +0000125
Jari Aaltob80f6442004-07-27 13:29:18 +0000126malloc.o: ${topdir}/bashintl.h ${LIBINTL_H} ${BASHINCDIR}/gettext.h
127stats.o: ${topdir}/bashintl.h ${LIBINTL_H} ${BASHINCDIR}/gettext.h
128trace.o: ${topdir}/bashintl.h ${LIBINTL_H} ${BASHINCDIR}/gettext.h
129table.o: ${topdir}/bashintl.h ${LIBINTL_H} ${BASHINCDIR}/gettext.h
130watch.o: ${topdir}/bashintl.h ${LIBINTL_H} ${BASHINCDIR}/gettext.h
131
Jari Aaltoe8ce7751997-09-22 20:22:27 +0000132# Rules for deficient makes, like SunOS and Solaris
133stub.o: stub.c
134malloc.o: malloc.c
Jari Aaltof73dda02001-11-13 17:56:06 +0000135table.o: table.c
136trace.o: trace.c
137stats.o: stats.c
Jari Aalto7117c2d2002-07-17 14:10:11 +0000138watch.o: watch.c