c1ba84d49234f3d7b9641e262bff2af25420baf3
[gnulib.git] / lib / Makefile.in
1 # Makefile for library files used by GNU file utilities.
2 # Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
3
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
8
9 # This program 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
12 # GNU General Public License for more details.
13
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 SHELL = /bin/sh
19
20 srcdir = @srcdir@
21 VPATH = @srcdir@
22
23 CC = @CC@
24 AR = ar
25 RANLIB = @RANLIB@
26 DEFS = -Dlint @DEFS@
27 CFLAGS = @CFLAGS@
28 YACC = @YACC@
29
30 exec_prefix = @exec_prefix@
31 libdir = $(exec_prefix)/lib
32
33 SOURCES = getdate.y posixtm.y \
34 argmatch.c backupfile.c basename.c dirname.c euidaccess.c \
35 error.c filemode.c fsusage.c full-write.c getopt.c getopt1.c \
36 getversion.c group-member.c idcache.c isdir.c makepath.c \
37 modechange.c mountlist.c obstack.c safe-read.c savedir.c \
38 stripslash.c xgetcwd.c xmalloc.c xstrdup.c userspec.c yesno.c \
39 fileblocks.c fnmatch.c ftruncate.c mkdir.c mktime.c rename.c rmdir.c stpcpy.c \
40 strdup.c strstr.c alloca.c long-options.c
41
42 OBJECTS = getdate.o posixtm.o \
43 argmatch.o backupfile.o basename.o dirname.o \
44 error.o filemode.o full-write.o getopt.o getopt1.o \
45 getversion.o group-member.o idcache.o isdir.o long-options.o makepath.o \
46 modechange.o obstack.o safe-read.o safe-stat.o safe-lstat.o savedir.o \
47 stripslash.o xgetcwd.o xmalloc.o xstrdup.o userspec.o yesno.o \
48 @LIBOBJS@ @ALLOCA@
49
50 DISTFILES = Makefile.in backupfile.h getopt.h long-options.h modechange.h \
51 fnmatch.h fsusage.h group-member.h makepath.h mountlist.h obstack.h pathmax.h \
52 safe-xstat.cin safe-xstat.hin getdate.c posixtm.c $(SOURCES)
53
54 all: libfu.a
55
56 .SUFFIXES:
57 .SUFFIXES: .c .o
58
59 .c.o:
60         $(CC) -c $(CPPFLAGS) $(DEFS) -I. -I.. -I$(srcdir) $(CFLAGS) $<
61
62 subdir = lib
63 Makefile: ../config.status Makefile.in
64         cd .. && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status
65
66 installdirs:
67
68 install: all
69
70 uninstall:
71
72 TAGS: $(SOURCES)
73         etags $(SOURCES)
74
75 check:
76
77 clean:
78         rm -f *.a *.o
79
80 mostlyclean: clean
81
82 distclean: clean
83         rm -f Makefile *.tab.c tposixtm.c \
84           safe-stat.c safe-stat.h safe-lstat.c safe-lstat.h
85
86 realclean: distclean
87         rm -f TAGS getdate.c posixtm.c
88
89 distdir = ../`cat ../distname`/$(subdir)
90 dist: $(DISTFILES)
91         for file in $(DISTFILES); do \
92           ln $$file $(distdir) \
93             || { echo copying $$file instead; cp -p $$file $(distdir);}; \
94         done
95
96 libfu.a: $(OBJECTS)
97         rm -f $@
98         $(AR) cr $@ $(OBJECTS)
99         -$(RANLIB) $@
100
101 extract_stat = sed 's/@l@//g; s/@L@//g; /@LSTAT_ONLY@/d'
102 extract_lstat = sed 's/@l@/l/g; s/@L@/L/g; s/   *@LSTAT_ONLY@//'
103
104 safe-lstat.c: safe-xstat.cin
105         $(extract_lstat) $(srcdir)/safe-xstat.cin > $@-t
106         mv $@-t $@
107
108 safe-lstat.h: safe-xstat.hin
109         $(extract_lstat) $(srcdir)/safe-xstat.hin > $@-t
110         mv $@-t $@
111
112 safe-stat.c: safe-xstat.cin
113         $(extract_stat) $(srcdir)/safe-xstat.cin > $@-t
114         mv $@-t $@
115
116 safe-stat.h: safe-xstat.hin
117         $(extract_stat) $(srcdir)/safe-xstat.hin > $@-t
118         mv $@-t $@
119
120 safe-stat.o: safe-stat.h
121 safe-lstat.o: safe-lstat.h safe-stat.h
122
123 # Since this directory contains two parsers, we have to be careful to avoid
124 # running two $(YACC)s during parallel makes.  See below.
125 getdate.c: getdate.y
126         @echo expect 10 shift/reduce conflicts
127         $(YACC) $(srcdir)/getdate.y
128         mv y.tab.c getdate.c
129
130 # Make the rename atomic, in case sed is interrupted and later rerun.
131 # The artificial dependency on getdate.c keeps the two parsers from being
132 # built in parallel.  Enforcing this little bit of sequentiality lets
133 # everyone (even those without bison) still run mostly parallel builds.
134 posixtm.c: posixtm.y getdate.c
135         $(YACC) $(srcdir)/posixtm.y
136         mv y.tab.c posixtm.tab.c
137         sed -e 's/yy/zz/g' posixtm.tab.c > tposixtm.c
138         mv tposixtm.c posixtm.c
139         rm -f posixtm.tab.c
140
141 rename.o: rename.c
142         $(CC) -c $(CPPFLAGS) -DMVDIR="\"$(libdir)/mvdir\"" $(DEFS) \
143             -I.. -I$(srcdir) $(CFLAGS) $(srcdir)/rename.c
144
145 $(OBJECTS): ../config.h
146
147 backupfile.o getversion.o: backupfile.h
148 fnmatch.o: fnmatch.h
149 fsusage.o: fsusage.h
150 getopt1.o: getopt.h
151 modechange.o: modechange.h
152 mountlist.o: mountlist.h
153 xgetcwd.o: pathmax.h
154 euidaccess.o fsusage.o isdir.o makepath.o mkdir.o rename.o: safe-stat.h
155 makepath.o: makepath.h
156 obstack.o: obstack.h
157 group-member.o: group-member.h
158
159 # Tell versions [3.59,3.63) of GNU make not to export all variables.
160 # Otherwise a system limit (for SysV at least) may be exceeded.
161 .NOEXPORT: