CC = @CC@
AR = ar
RANLIB = @RANLIB@
-DEFS = -DCONFIG_BROKETS -Dlint @DEFS@
+DEFS = -Dlint @DEFS@
CFLAGS = @CFLAGS@
YACC = @YACC@
-prefix = @prefix@
-exec_prefix = $(prefix)
+exec_prefix = @exec_prefix@
libdir = $(exec_prefix)/lib
-
SOURCES = getdate.y posixtm.y \
argmatch.c backupfile.c basename.c dirname.c eaccess.c \
error.c filemode.c fsusage.c full-write.c getopt.c getopt1.c \
@LIBOBJS@ @ALLOCA@
DISTFILES = Makefile.in backupfile.h getopt.h modechange.h \
-fnmatch.h fsusage.h mountlist.h pathmax.h safe-xstat.c.in safe-xstat.h.in \
+fnmatch.h fsusage.h mountlist.h pathmax.h safe-xstat.cin safe-xstat.hin \
getdate.c posixtm.c $(SOURCES)
all: libfu.a
-.SUFFIXES =
-.SUFFIXES = .c .o
+.SUFFIXES:
+.SUFFIXES: .c .o
.c.o:
$(CC) -c $(CPPFLAGS) $(DEFS) -I. -I.. -I$(srcdir) $(CFLAGS) $<
Makefile: ../config.status Makefile.in
- CONFIG_FILES=$@ CONFIG_HEADERS= ../config.status
+ cd ..; CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status
+
+installdirs:
install: all
mostlyclean: clean
distclean: clean
- rm -f Makefile *.tab.c getdate.c *posixtm.c
+ rm -f Makefile *.tab.c getdate.c *posixtm.c \
+ safe-stat.c safe-stat.h safe-lstat.c safe-lstat.h
realclean: distclean
- rm -f TAGS safe-stat.c safe-stat.h safe-lstat.c safe-lstat.h
+ rm -f TAGS
-distdir = ../`cat ../.fname`/lib
+distdir = ../`cat ../distname`/$(subdir)
dist: $(DISTFILES)
for file in $(DISTFILES); do \
ln $$file $(distdir) \
extract_stat = sed -e 's/@l@//g' -e 's/@L@//g'
extract_lstat = sed -e 's/@l@/l/g' -e 's/@L@/L/g'
-safe-lstat.c: safe-xstat.c.in
- $(extract_lstat) $(srcdir)/safe-xstat.c.in > $@-tmp
- mv $@-tmp $@
+safe-lstat.c: safe-xstat.cin
+ $(extract_lstat) $(srcdir)/safe-xstat.cin > $@-t
+ mv $@-t $@
-safe-lstat.h: safe-xstat.h.in
- $(extract_lstat) $(srcdir)/safe-xstat.h.in > $@-tmp
- mv $@-tmp $@
+safe-lstat.h: safe-xstat.hin
+ $(extract_lstat) $(srcdir)/safe-xstat.hin > $@-t
+ mv $@-t $@
-safe-stat.c: safe-xstat.c.in
- $(extract_stat) $(srcdir)/safe-xstat.c.in > $@-tmp
- mv $@-tmp $@
+safe-stat.c: safe-xstat.cin
+ $(extract_stat) $(srcdir)/safe-xstat.cin > $@-t
+ mv $@-t $@
-safe-stat.h: safe-xstat.h.in
- $(extract_stat) $(srcdir)/safe-xstat.h.in > $@-tmp
- mv $@-tmp $@
+safe-stat.h: safe-xstat.hin
+ $(extract_stat) $(srcdir)/safe-xstat.hin > $@-t
+ mv $@-t $@
safe-stat.o: safe-stat.h
safe-lstat.o: safe-lstat.h
-/* mkdir.c -- BSD compatible directory functions for System V
+/* mkdir.c -- BSD compatible make directory function for System V
Copyright (C) 1988, 1990 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
#include <sys/types.h>
#include <sys/stat.h>
+
#include <errno.h>
-#ifndef STDC_HEADERS
+#ifndef errno
extern int errno;
#endif
#ifdef STAT_MACROS_BROKEN
#undef S_ISDIR
-#endif /* STAT_MACROS_BROKEN. */
+#endif
#if !defined(S_ISDIR) && defined(S_IFDIR)
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#include "safe-stat.h"
-/* mkdir and rmdir adapted from GNU tar. */
+/* mkdir adapted from GNU tar. */
/* Make directory DPATH, with permission mode DMODE.
if (SAFE_STAT (dpath, &statbuf) == 0)
{
- errno = EEXIST; /* stat worked, so it already exists. */
+ errno = EEXIST; /* stat worked, it already exists */
return -1;
}
cpid = fork ();
switch (cpid)
{
- case -1: /* Cannot fork. */
- return -1; /* errno is set already. */
+ case -1: /* cannot fork */
+ return -1; /* errno already set */
+
+ case 0: /* child process */
- case 0: /* Child process. */
/* Cheap hack to set mode of new directory. Since this child
- process is going away anyway, we zap its umask.
- This won't suffice to set SUID, SGID, etc. on this
- directory, so the parent process calls chmod afterward. */
- status = umask (0); /* Get current umask. */
- umask (status | (0777 & ~dmode)); /* Set for mkdir. */
+ process is going away anyway, we zap its umask. This won't
+ suffice to set SUID, SGID, etc. on this directory, so the parent
+ process calls chmod afterward. */
+
+ status = umask (0);
+ umask (status | (0777 & ~dmode));
execl ("/bin/mkdir", "mkdir", dpath, (char *) 0);
_exit (1);
- default: /* Parent process. */
- while (wait (&status) != cpid) /* Wait for kid to finish. */
- /* Do nothing. */ ;
+ default: /* parent process */
- if (status & 0xFFFF)
- {
- errno = EIO; /* /bin/mkdir failed. */
- return -1;
- }
- return chmod (dpath, dmode);
- }
-}
-
-/* Remove directory DPATH.
- Return 0 if successful, -1 if not. */
+ /* Wait for kid to finish. */
-int
-rmdir (dpath)
- char *dpath;
-{
- int cpid, status;
- struct stat statbuf;
-
- if (SAFE_STAT (dpath, &statbuf) != 0)
- return -1; /* stat set errno. */
-
- if (!S_ISDIR (statbuf.st_mode))
- {
- errno = ENOTDIR;
- return -1;
- }
-
- cpid = fork ();
- switch (cpid)
- {
- case -1: /* Cannot fork. */
- return -1; /* errno is set already. */
-
- case 0: /* Child process. */
- execl ("/bin/rmdir", "rmdir", dpath, (char *) 0);
- _exit (1);
-
- default: /* Parent process. */
- while (wait (&status) != cpid) /* Wait for kid to finish. */
+ while (wait (&status) != cpid)
/* Do nothing. */ ;
if (status & 0xFFFF)
{
- errno = EIO; /* /bin/rmdir failed. */
+
+ /* /bin/mkdir failed. */
+
+ errno = EIO;
return -1;
}
- return 0;
+ return chmod (dpath, dmode);
}
}