GNU file utilities
[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 = -DCONFIG_BROKETS @DEFS@
27 CFLAGS = @CFLAGS@
28 YACC = @YACC@
29
30 prefix = @prefix@
31 exec_prefix = $(prefix)
32 libdir = $(exec_prefix)/lib
33
34 SOURCES = getdate.y posixtm.y \
35 argmatch.c backupfile.c basename.c dirname.c eaccess.c \
36 error.c filemode.c fsusage.c full-write.c getopt.c getopt1.c \
37 getversion.c group-member.c idcache.c isdir.c makepath.c \
38 modechange.c mountlist.c safe-read.c savedir.c \
39 stripslash.c xgetcwd.c xmalloc.c xstrdup.c userspec.c yesno.c \
40 fileblocks.c fnmatch.c ftruncate.c mkdir.c mktime.c rename.c stpcpy.c \
41 strdup.c strstr.c alloca.c long-options.c
42
43 OBJECTS = getdate.o posixtm.o \
44 argmatch.o backupfile.o basename.o dirname.o eaccess.o \
45 error.o filemode.o full-write.o getopt.o getopt1.o \
46 getversion.o group-member.o idcache.o isdir.o long-options.o makepath.o \
47 modechange.o safe-read.o safe-stat.o safe-lstat.o savedir.o \
48 stripslash.o xgetcwd.o xmalloc.o xstrdup.o userspec.o yesno.o \
49 @LIBOBJS@ @ALLOCA@
50
51 DISTFILES = Makefile.in backupfile.h getopt.h modechange.h \
52 fnmatch.h fsusage.h mountlist.h pathmax.h safe-xstat.c.in safe-xstat.h.in \
53 $(SOURCES)
54
55 all: libfu.a
56
57 .SUFFIXES =
58 .SUFFIXES = .c .o
59
60 .c.o:
61         $(CC) -c $(CPPFLAGS) $(DEFS) -I.. -I$(srcdir) $(CFLAGS) $<
62
63 Makefile: ../config.status Makefile.in
64         CONFIG_FILES=$@ CONFIG_HEADERS= ../config.status
65
66 install: all
67
68 uninstall:
69
70 TAGS: $(SOURCES)
71         etags $(SOURCES)
72
73 check:
74
75 clean:
76         rm -f *.a *.o
77
78 mostlyclean: clean
79
80 distclean: clean
81         rm -f Makefile *.tab.c getdate.c *posixtm.c
82
83 realclean: distclean
84         rm -f TAGS safe-stat.c safe-stat.h safe-lstat.c safe-lstat.h 
85
86 distdir = ../`cat ../.fname`/lib 
87 dist: $(DISTFILES)
88         for file in $(DISTFILES); do \
89           ln $$file $(distdir) \
90             || { echo copying $$file instead; cp -p $$file $(distdir);}; \
91         done
92
93 libfu.a: $(OBJECTS)
94         rm -f $@
95         $(AR) cr $@ $(OBJECTS)
96         -$(RANLIB) $@
97
98 extract_stat = sed -e 's/@l@//g' -e 's/@L@//g'
99 extract_lstat = sed -e 's/@l@/l/g' -e 's/@L@/L/g'
100
101 safe-lstat.c: safe-xstat.c.in
102         $(extract_lstat) safe-xstat.c.in > $@-tmp
103         mv $@-tmp $@
104
105 safe-lstat.h: safe-xstat.h.in
106         $(extract_lstat) safe-xstat.h.in > $@-tmp
107         mv $@-tmp $@
108
109 safe-stat.c: safe-xstat.c.in
110         $(extract_stat) safe-xstat.c.in > $@-tmp
111         mv $@-tmp $@
112
113 safe-stat.h: safe-xstat.h.in
114         $(extract_stat) safe-xstat.h.in > $@-tmp
115         mv $@-tmp $@
116
117 safe-stat.o: safe-stat.h
118 safe-lstat.o: safe-lstat.h
119
120 # Since this directory contains two parsers, we have to be careful to avoid
121 # running two $(YACC)s during parallel makes.  See below.
122 getdate.c: getdate.y
123         @echo expect 10 shift/reduce conflicts
124         $(YACC) $(srcdir)/getdate.y
125         mv y.tab.c getdate.c
126
127 # Make the rename atomic, in case sed is interrupted and later rerun.
128 # The artificial dependency on getdate.c keeps the two parsers from being
129 # built in parallel.  Enforcing this little bit of sequentiality lets
130 # everyone (even those without bison) still run mostly parallel builds.
131 posixtm.c: posixtm.y getdate.c
132         $(YACC) $(srcdir)/posixtm.y
133         mv y.tab.c posixtm.tab.c
134         sed -e 's/yy/zz/g' posixtm.tab.c > tposixtm.c
135         mv tposixtm.c posixtm.c
136         rm -f posixtm.tab.c
137
138 rename.o: rename.c
139         $(CC) -c $(CPPFLAGS) -DMVDIR="\"$(libdir)/mvdir\"" $(DEFS) \
140             -I.. -I$(srcdir) $(CFLAGS) $(srcdir)/rename.c
141
142 $(OBJECTS): ../config.h
143
144 backupfile.o getversion.o: backupfile.h
145 fnmatch.o: fnmatch.h
146 fsusage.o: fsusage.h
147 getopt1.o: getopt.h
148 modechange.o: modechange.h
149 mountlist.o: mountlist.h
150 xgetcwd.o: pathmax.h
151
152 # Tell versions [3.59,3.63) of GNU make not to export all variables.
153 # Otherwise a system limit (for SysV at least) may be exceeded.
154 .NOEXPORT: