1## -*- text -*- ####################################################
2#								   #
3# Makefile for the GNU Glob Library.				   #
4#								   #
5####################################################################
6#
7# Copyright (C) 1996-2005 Free Software Foundation, Inc.     
8
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 2, or (at your option)
12# any later version.
13
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.
18
19# You should have received a copy of the GNU General Public License
20# along with this program; if not, write to the Free Software
21# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
22
23srcdir = @srcdir@
24VPATH = .:@srcdir@
25topdir = @top_srcdir@
26BUILD_DIR = @BUILD_DIR@
27
28INSTALL = @INSTALL@
29INSTALL_PROGRAM = @INSTALL_PROGRAM@
30INSTALL_DATA = @INSTALL_DATA@
31
32CC = @CC@
33RANLIB = @RANLIB@
34AR = @AR@
35ARFLAGS = @ARFLAGS@
36RM = rm -f
37CP = cp
38MV = mv
39
40SHELL = @MAKE_SHELL@
41
42PROFILE_FLAGS = @PROFILE_FLAGS@
43
44CFLAGS = @CFLAGS@
45LOCAL_CFLAGS = @LOCAL_CFLAGS@
46CPPFLAGS = @CPPFLAGS@
47LDFLAGS = @LDFLAGS@ @LOCAL_LDFLAGS@
48
49DEFS = @DEFS@
50LOCAL_DEFS = @LOCAL_DEFS@
51
52BASHINCDIR = ${topdir}/include
53
54INCLUDES = -I. -I../.. -I$(topdir) -I$(BASHINCDIR) -I$(topdir)/lib
55
56CCFLAGS = $(PROFILE_FLAGS) $(DEFS) $(LOCAL_DEFS) $(CPPFLAGS) ${INCLUDES} \
57	  $(LOCAL_CFLAGS) $(CFLAGS)
58
59# Here is a rule for making .o files from .c files that doesn't force
60# the type of the machine (like -sun3) into the flags.
61.c.o:
62	$(RM) $@
63	$(CC) -c $(CCFLAGS) $<
64
65# The name of the library target.
66LIBRARY_NAME = libglob.a
67
68# The C code source files for this library.
69CSOURCES = $(srcdir)/glob.c $(srcdir)/strmatch.c $(srcdir)/smatch.c \
70	   $(srcdir)/xmbsrtowcs.c
71
72# The header files for this library.
73HSOURCES = $(srcdir)/strmatch.h
74
75OBJECTS = glob.o strmatch.o smatch.o xmbsrtowcs.o
76
77# The texinfo files which document this library.
78DOCSOURCE = doc/glob.texi
79DOCOBJECT = doc/glob.dvi
80DOCSUPPORT = doc/Makefile
81DOCUMENTATION = $(DOCSOURCE) $(DOCOBJECT) $(DOCSUPPORT)
82
83SUPPORT = Makefile ChangeLog $(DOCSUPPORT)
84
85SOURCES  = $(CSOURCES) $(HSOURCES) $(DOCSOURCE)
86
87THINGS_TO_TAR = $(SOURCES) $(SUPPORT)
88
89######################################################################
90
91all: $(LIBRARY_NAME)
92
93$(LIBRARY_NAME): $(OBJECTS)
94	$(RM) -f $@
95	$(AR) $(ARFLAGS) $@ $(OBJECTS)
96	-test -n "$(RANLIB)" && $(RANLIB) $@
97
98what-tar:
99	@for file in $(THINGS_TO_TAR); do \
100	  echo $(selfdir)$$file; \
101	done
102
103documentation: force
104	-(cd doc; $(MAKE) $(MFLAGS))
105force:
106
107# The rule for 'includes' is written funny so that the if statement
108# always returns TRUE unless there really was an error installing the
109# include files.
110install:
111
112clean:
113	rm -f $(OBJECTS) $(LIBRARY_NAME)
114	-(cd doc && $(MAKE) $(MFLAGS) $@ )
115
116realclean distclean maintainer-clean: clean
117	-( cd doc && $(MAKE) $(MFLAGS) $@ )
118	$(RM) -f Makefile
119
120mostlyclean: clean
121	-( cd doc && $(MAKE) $(MFLAGS) $@ )
122
123######################################################################
124#								     #
125#  Dependencies for the object files which make up this library.     #
126#								     #
127######################################################################
128
129smatch.o: strmatch.h
130smatch.o: $(BUILD_DIR)/config.h
131smatch.o: $(BASHINCDIR)/chartypes.h
132smatch.o: $(BASHINCDIR)/ansi_stdlib.h $(topdir)/bashansi.h
133smatch.o: $(BASHINCDIR)/shmbutil.h
134smatch.o: $(topdir)/xmalloc.h
135
136strmatch.o: strmatch.h
137strmatch.o: $(BUILD_DIR)/config.h
138strmatch.o: $(BASHINCDIR)/stdc.h
139
140glob.o: $(BUILD_DIR)/config.h
141glob.o: $(topdir)/bashtypes.h $(BASHINCDIR)/ansi_stdlib.h $(topdir)/bashansi.h
142glob.o: $(BASHINCDIR)/posixstat.h $(BASHINCDIR)/memalloc.h
143glob.o: strmatch.h glob.h
144glob.o: $(BASHINCDIR)/shmbutil.h
145glob.o: $(topdir)/xmalloc.h
146
147xmbsrtowcs.o: ${BUILD_DIR}/config.h
148xmbsrtowcs.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
149xmbsrtowcs.o: ${BASHINCDIR}/shmbutil.h
150
151# Rules for deficient makes, like SunOS and Solaris
152glob.o: glob.c
153strmatch.o: strmatch.c
154smatch.o: smatch.c
155xmbsrtowcs.o: xmbsrtowcs.c
156
157# dependencies for C files that include other C files
158glob.o: glob_loop.c
159smatch.o: sm_loop.c
160