Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 1 | ## -*- text -*- #################################################### |
| 2 | # # |
| 3 | # Makefile for the GNU Glob Library. # |
| 4 | # # |
| 5 | #################################################################### |
Jari Aalto | bb70624 | 2000-03-17 21:46:59 +0000 | [diff] [blame] | 6 | # |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 7 | # Copyright (C) 1996-2009 Free Software Foundation, Inc. |
Jari Aalto | bb70624 | 2000-03-17 21:46:59 +0000 | [diff] [blame] | 8 | |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 9 | # This program is free software: you can redistribute it and/or modify |
| 10 | # it under the terms of the GNU General Public License as published by |
| 11 | # the Free Software Foundation, either version 3 of the License, or |
| 12 | # (at your option) any later version. |
Jari Aalto | bb70624 | 2000-03-17 21:46:59 +0000 | [diff] [blame] | 13 | |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 14 | # This program is distributed in the hope that it will be useful, |
| 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | # GNU General Public License for more details. |
Jari Aalto | bb70624 | 2000-03-17 21:46:59 +0000 | [diff] [blame] | 18 | |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 19 | # You should have received a copy of the GNU General Public License |
| 20 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 21 | |
| 22 | srcdir = @srcdir@ |
| 23 | VPATH = .:@srcdir@ |
| 24 | topdir = @top_srcdir@ |
| 25 | BUILD_DIR = @BUILD_DIR@ |
| 26 | |
| 27 | INSTALL = @INSTALL@ |
| 28 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ |
| 29 | INSTALL_DATA = @INSTALL_DATA@ |
| 30 | |
| 31 | CC = @CC@ |
| 32 | RANLIB = @RANLIB@ |
| 33 | AR = @AR@ |
Jari Aalto | b72432f | 1999-02-19 17:11:39 +0000 | [diff] [blame] | 34 | ARFLAGS = @ARFLAGS@ |
Jari Aalto | 0628567 | 2006-10-10 14:15:34 +0000 | [diff] [blame] | 35 | RM = rm -f |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 36 | CP = cp |
| 37 | MV = mv |
| 38 | |
Jari Aalto | b72432f | 1999-02-19 17:11:39 +0000 | [diff] [blame] | 39 | SHELL = @MAKE_SHELL@ |
| 40 | |
Jari Aalto | 7117c2d | 2002-07-17 14:10:11 +0000 | [diff] [blame] | 41 | PROFILE_FLAGS = @PROFILE_FLAGS@ |
| 42 | |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 43 | CFLAGS = @CFLAGS@ |
| 44 | LOCAL_CFLAGS = @LOCAL_CFLAGS@ |
| 45 | CPPFLAGS = @CPPFLAGS@ |
| 46 | LDFLAGS = @LDFLAGS@ @LOCAL_LDFLAGS@ |
| 47 | |
| 48 | DEFS = @DEFS@ |
Jari Aalto | d166f04 | 1997-06-05 14:59:13 +0000 | [diff] [blame] | 49 | LOCAL_DEFS = @LOCAL_DEFS@ |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 50 | |
Jari Aalto | bb70624 | 2000-03-17 21:46:59 +0000 | [diff] [blame] | 51 | BASHINCDIR = ${topdir}/include |
| 52 | |
| 53 | INCLUDES = -I. -I../.. -I$(topdir) -I$(BASHINCDIR) -I$(topdir)/lib |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 54 | |
Jari Aalto | 7117c2d | 2002-07-17 14:10:11 +0000 | [diff] [blame] | 55 | CCFLAGS = $(PROFILE_FLAGS) $(DEFS) $(LOCAL_DEFS) $(CPPFLAGS) ${INCLUDES} \ |
| 56 | $(LOCAL_CFLAGS) $(CFLAGS) |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 57 | |
| 58 | # Here is a rule for making .o files from .c files that doesn't force |
| 59 | # the type of the machine (like -sun3) into the flags. |
| 60 | .c.o: |
Jari Aalto | 0628567 | 2006-10-10 14:15:34 +0000 | [diff] [blame] | 61 | $(RM) $@ |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 62 | $(CC) -c $(CCFLAGS) $< |
| 63 | |
| 64 | # The name of the library target. |
| 65 | LIBRARY_NAME = libglob.a |
| 66 | |
| 67 | # The C code source files for this library. |
Jari Aalto | 7117c2d | 2002-07-17 14:10:11 +0000 | [diff] [blame] | 68 | CSOURCES = $(srcdir)/glob.c $(srcdir)/strmatch.c $(srcdir)/smatch.c \ |
| 69 | $(srcdir)/xmbsrtowcs.c |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 70 | |
| 71 | # The header files for this library. |
Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame] | 72 | HSOURCES = $(srcdir)/strmatch.h |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 73 | |
Chet Ramey | 495aee4 | 2011-11-22 19:11:26 -0500 | [diff] [blame] | 74 | OBJECTS = glob.o strmatch.o smatch.o xmbsrtowcs.o gmisc.o |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 75 | |
| 76 | # The texinfo files which document this library. |
| 77 | DOCSOURCE = doc/glob.texi |
| 78 | DOCOBJECT = doc/glob.dvi |
| 79 | DOCSUPPORT = doc/Makefile |
| 80 | DOCUMENTATION = $(DOCSOURCE) $(DOCOBJECT) $(DOCSUPPORT) |
| 81 | |
| 82 | SUPPORT = Makefile ChangeLog $(DOCSUPPORT) |
| 83 | |
| 84 | SOURCES = $(CSOURCES) $(HSOURCES) $(DOCSOURCE) |
| 85 | |
| 86 | THINGS_TO_TAR = $(SOURCES) $(SUPPORT) |
| 87 | |
| 88 | ###################################################################### |
| 89 | |
| 90 | all: $(LIBRARY_NAME) |
| 91 | |
| 92 | $(LIBRARY_NAME): $(OBJECTS) |
| 93 | $(RM) -f $@ |
Jari Aalto | b72432f | 1999-02-19 17:11:39 +0000 | [diff] [blame] | 94 | $(AR) $(ARFLAGS) $@ $(OBJECTS) |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 95 | -test -n "$(RANLIB)" && $(RANLIB) $@ |
| 96 | |
| 97 | what-tar: |
| 98 | @for file in $(THINGS_TO_TAR); do \ |
| 99 | echo $(selfdir)$$file; \ |
| 100 | done |
| 101 | |
| 102 | documentation: force |
| 103 | -(cd doc; $(MAKE) $(MFLAGS)) |
| 104 | force: |
| 105 | |
| 106 | # The rule for 'includes' is written funny so that the if statement |
| 107 | # always returns TRUE unless there really was an error installing the |
| 108 | # include files. |
| 109 | install: |
| 110 | |
| 111 | clean: |
| 112 | rm -f $(OBJECTS) $(LIBRARY_NAME) |
| 113 | -(cd doc && $(MAKE) $(MFLAGS) $@ ) |
| 114 | |
| 115 | realclean distclean maintainer-clean: clean |
| 116 | -( cd doc && $(MAKE) $(MFLAGS) $@ ) |
| 117 | $(RM) -f Makefile |
| 118 | |
| 119 | mostlyclean: clean |
| 120 | -( cd doc && $(MAKE) $(MFLAGS) $@ ) |
| 121 | |
Chet Ramey | 495aee4 | 2011-11-22 19:11:26 -0500 | [diff] [blame] | 122 | ${BUILD_DIR}/pathnames.h: ${BUILD_DIR}/config.h ${BUILD_DIR}/Makefile Makefile |
| 123 | -( cd ${BUILD_DIR} && ${MAKE} ${MFLAGS} pathnames.h ) |
| 124 | |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 125 | ###################################################################### |
| 126 | # # |
| 127 | # Dependencies for the object files which make up this library. # |
| 128 | # # |
| 129 | ###################################################################### |
| 130 | |
Jari Aalto | 7117c2d | 2002-07-17 14:10:11 +0000 | [diff] [blame] | 131 | smatch.o: strmatch.h |
| 132 | smatch.o: $(BUILD_DIR)/config.h |
| 133 | smatch.o: $(BASHINCDIR)/chartypes.h |
| 134 | smatch.o: $(BASHINCDIR)/ansi_stdlib.h $(topdir)/bashansi.h |
| 135 | smatch.o: $(BASHINCDIR)/shmbutil.h |
| 136 | smatch.o: $(topdir)/xmalloc.h |
| 137 | |
Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame] | 138 | strmatch.o: strmatch.h |
| 139 | strmatch.o: $(BUILD_DIR)/config.h |
Jari Aalto | 7117c2d | 2002-07-17 14:10:11 +0000 | [diff] [blame] | 140 | strmatch.o: $(BASHINCDIR)/stdc.h |
Jari Aalto | d166f04 | 1997-06-05 14:59:13 +0000 | [diff] [blame] | 141 | |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 142 | glob.o: $(BUILD_DIR)/config.h |
Chet Ramey | 495aee4 | 2011-11-22 19:11:26 -0500 | [diff] [blame] | 143 | glob.o: $(topdir)/shell.h $(BUILD_DIR)/pathnames.h |
Jari Aalto | bb70624 | 2000-03-17 21:46:59 +0000 | [diff] [blame] | 144 | glob.o: $(topdir)/bashtypes.h $(BASHINCDIR)/ansi_stdlib.h $(topdir)/bashansi.h |
| 145 | glob.o: $(BASHINCDIR)/posixstat.h $(BASHINCDIR)/memalloc.h |
Jari Aalto | 7117c2d | 2002-07-17 14:10:11 +0000 | [diff] [blame] | 146 | glob.o: strmatch.h glob.h |
| 147 | glob.o: $(BASHINCDIR)/shmbutil.h |
| 148 | glob.o: $(topdir)/xmalloc.h |
| 149 | |
Chet Ramey | 495aee4 | 2011-11-22 19:11:26 -0500 | [diff] [blame] | 150 | gmisc.o: $(BUILD_DIR)/config.h |
| 151 | gmisc.o: $(topdir)/bashtypes.h $(BASHINCDIR)/ansi_stdlib.h $(topdir)/bashansi.h |
| 152 | gmisc.o: $(BASHINCDIR)/shmbutil.h |
| 153 | |
Jari Aalto | 7117c2d | 2002-07-17 14:10:11 +0000 | [diff] [blame] | 154 | xmbsrtowcs.o: ${BUILD_DIR}/config.h |
| 155 | xmbsrtowcs.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h |
| 156 | xmbsrtowcs.o: ${BASHINCDIR}/shmbutil.h |
Jari Aalto | e8ce775 | 1997-09-22 20:22:27 +0000 | [diff] [blame] | 157 | |
| 158 | # Rules for deficient makes, like SunOS and Solaris |
Jari Aalto | e8ce775 | 1997-09-22 20:22:27 +0000 | [diff] [blame] | 159 | glob.o: glob.c |
Chet Ramey | 495aee4 | 2011-11-22 19:11:26 -0500 | [diff] [blame] | 160 | gmisc.o: gmisc.c |
Jari Aalto | 7117c2d | 2002-07-17 14:10:11 +0000 | [diff] [blame] | 161 | strmatch.o: strmatch.c |
| 162 | smatch.o: smatch.c |
| 163 | xmbsrtowcs.o: xmbsrtowcs.c |
| 164 | |
| 165 | # dependencies for C files that include other C files |
| 166 | glob.o: glob_loop.c |
| 167 | smatch.o: sm_loop.c |