Whamcloud - gitweb
Refine the build process to avoid re-running subst all the time on
authorTheodore Ts'o <tytso@mit.edu>
Sat, 3 Apr 2004 18:53:46 +0000 (13:53 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 3 Apr 2004 18:53:46 +0000 (13:53 -0500)
some generated files, by having subst update the modtime on these
files even when the generated file hasn't changed.  We do this with
generated files that do not have any downstream dependencies.

18 files changed:
ChangeLog
MCONFIG.in
debugfs/ChangeLog
debugfs/Makefile.in
e2fsck/ChangeLog
e2fsck/Makefile.in
ext2ed/ChangeLog
ext2ed/Makefile.in
lib/blkid/ChangeLog
lib/blkid/Makefile.in
lib/uuid/ChangeLog
lib/uuid/Makefile.in
misc/ChangeLog
misc/Makefile.in
resize/ChangeLog
resize/Makefile.in
util/ChangeLog
util/subst.c

index 26fe6b9..e995b7f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2004-04-03  Theodore Ts'o  <tytso@mit.edu>
 
+       * MCONFIG.in (SUBSTITUTE_UPTIME): New definition which passes the
+               -t option to subst.
+
        * configure.in: Add test for stdint.h
 
 2004-03-19  Theodore Ts'o  <tytso@mit.edu>
index ba99911..0e9fc65 100644 (file)
@@ -109,6 +109,7 @@ LINUX_INCLUDE=@LINUX_INCLUDE@
 #
 SUBST_CONF=$(top_builddir)/util/subst.conf
 SUBSTITUTE= $(top_builddir)/util/subst -f $(SUBST_CONF)
+SUBSTITUTE_UPTIME= $(top_builddir)/util/subst -t -f $(SUBST_CONF)
 DEP_SUBSTITUTE= $(top_builddir)/util/subst $(SUBST_CONF)
 
 $(top_builddir)/util/subst:
index 3f546c8..240a237 100644 (file)
@@ -1,3 +1,10 @@
+2004-04-03  Theodore Ts'o  <tytso@mit.edu>
+
+       * Makefile.in: Update the modtime even if subst doesn't need to
+               update the debugfs man page, to avoid always re-running
+               subst, especially since there are no dependencies on the
+               man page.
+
 2004-03-20  Theodore Ts'o  <tytso@mit.edu>
 
        * debugfs.c (make_link): Set the filetype information when
index cfc24e9..cb5b90d 100644 (file)
@@ -41,7 +41,7 @@ debug_cmds.c debug_cmds.h: debug_cmds.ct
        $(MK_CMDS) $(srcdir)/debug_cmds.ct
 
 debugfs.8: $(DEP_SUBSTITUTE) $(srcdir)/debugfs.8.in
-       $(SUBSTITUTE) $(srcdir)/debugfs.8.in debugfs.8
+       $(SUBSTITUTE_UPTIME) $(srcdir)/debugfs.8.in debugfs.8
 
 installdirs:
        $(top_srcdir)/mkinstalldirs $(DESTDIR)$(root_sbindir) \
index dd0d70f..280860e 100644 (file)
@@ -1,3 +1,10 @@
+2004-04-03  Theodore Ts'o  <tytso@mit.edu>
+
+       * Makefile.in: Update the modtime even if subst doesn't need to
+               update the e2fsck man page, to avoid always re-running
+               subst, especially since there are no dependencies on the
+               man page.
+
 2004-02-28  Theodore Ts'o  <tytso@mit.edu>
 
        * Release of E2fsprogs 1.35
index 43a674c..d91d561 100644 (file)
@@ -137,7 +137,7 @@ profiled:
        mkdir profiled
 
 e2fsck.8: $(DEP_SUBSTITUTE) $(srcdir)/e2fsck.8.in
-       $(SUBSTITUTE) $(srcdir)/e2fsck.8.in e2fsck.8
+       $(SUBSTITUTE_UPTIME) $(srcdir)/e2fsck.8.in e2fsck.8
 
 installdirs:
        $(top_srcdir)/mkinstalldirs $(DESTDIR)$(root_sbindir) \
index 150871d..c233a75 100644 (file)
@@ -1,3 +1,10 @@
+2004-04-03  Theodore Ts'o  <tytso@mit.edu>
+
+       * Makefile.in: Update the modtime even if subst doesn't need to
+               update the ext2ed man page and conbfiguration, to avoid
+               always re-running subst, especially since there are no
+               dependencies on these generated files.
+
 2004-02-28  Theodore Ts'o  <tytso@mit.edu>
 
        * Release of E2fsprogs 1.35
index a581ee3..610635a 100644 (file)
@@ -60,10 +60,10 @@ ext2ed: $(OBJS)
        $(CC) $(ALL_LDFLAGS) -o ext2ed $(OBJS) $(LIBS)
 
 ext2ed.8: $(DEP_SUBSTITUTE) $(srcdir)/ext2ed.8.in
-       $(SUBSTITUTE) $(srcdir)/ext2ed.8.in ext2ed.8
+       $(SUBSTITUTE_UPTIME) $(srcdir)/ext2ed.8.in ext2ed.8
 
 ext2ed.conf: $(DEP_SUBSTITUTE) $(srcdir)/ext2ed.conf.in
-       $(SUBSTITUTE) $(srcdir)/ext2ed.conf.in ext2ed.conf
+       $(SUBSTITUTE_UPTIME) $(srcdir)/ext2ed.conf.in ext2ed.conf
 
 clean:
        $(RM) -f ext2ed $(OBJS) $(DOCS) ext2ed.conf ext2ed.8
index cd26bbf..022b4ba 100644 (file)
@@ -1,5 +1,12 @@
 2004-04-03  Theodore Ts'o  <tytso@mit.edu>
 
+       * Makefile.in: Update the modtime even if subst doesn't need to
+               update the libblkid man page, to avoid always re-running
+               subst, especially since there are no dependencies on the
+               man page.
+
+2004-04-03  Theodore Ts'o  <tytso@mit.edu>
+
        * blkid_types.h.in: Remove check for _UUID_TYPES since uuid_types.h
                is no longer used.
 
index 5e27184..0f82f60 100644 (file)
@@ -68,7 +68,7 @@ $(top_builddir)/lib/blkid/blkid_types.h: $(srcdir)/blkid_types.h.in $(top_buildd
        cd $(top_builddir); CONFIG_FILES=$(my_dir)/blkid_types.h ./config.status
 
 libblkid.3: $(DEP_SUBSTITUTE) $(srcdir)/libblkid.3.in
-       $(SUBSTITUTE) $(srcdir)/libblkid.3.in libblkid.3
+       $(SUBSTITUTE_UPTIME) $(srcdir)/libblkid.3.in libblkid.3
 
 tst_cache: $(srcdir)/cache.c $(DEPLIBS_BLKID)
        $(CC) -o tst_cache -DTEST_PROGRAM $(srcdir)/cache.c $(LIBS_BLKID) $(ALL_CFLAGS)
index 6de5b96..fd665c5 100644 (file)
@@ -1,5 +1,12 @@
 2004-04-03  Theodore Ts'o  <tytso@mit.edu>
 
+       * Makefile.in: Update the modtime even if subst doesn't need to
+               update the libuuid man pages, to avoid always re-running
+               subst, especially since there are no dependencies on the
+               man page.
+
+2004-04-03  Theodore Ts'o  <tytso@mit.edu>
+
        * libuuid.3.in, uuid_clear.3.in, uuid_compare.3.in, uuid_copy.3.in,
                uuid_generate.3.in, uuid_is_null.3.in, uuid_parse.3.in,
                uuid_time.3.in, uuid_unparse.3.in: Change licensing of man
index ba9326a..3c68eb2 100644 (file)
@@ -94,31 +94,31 @@ uuid_time: $(srcdir)/uuid_time.c $(DEPLIBUUID)
                $(LIBUUID)
 
 libuuid.3: $(DEP_SUBSTITUTE) $(srcdir)/libuuid.3.in
-       $(SUBSTITUTE) $(srcdir)/libuuid.3.in libuuid.3
+       $(SUBSTITUTE_UPTIME) $(srcdir)/libuuid.3.in libuuid.3
 
 uuid_clear.3: $(DEP_SUBSTITUTE) $(srcdir)/uuid_clear.3.in
-       $(SUBSTITUTE) $(srcdir)/uuid_clear.3.in uuid_clear.3
+       $(SUBSTITUTE_UPTIME) $(srcdir)/uuid_clear.3.in uuid_clear.3
 
 uuid_compare.3: $(DEP_SUBSTITUTE) $(srcdir)/uuid_compare.3.in
-       $(SUBSTITUTE) $(srcdir)/uuid_compare.3.in uuid_compare.3
+       $(SUBSTITUTE_UPTIME) $(srcdir)/uuid_compare.3.in uuid_compare.3
 
 uuid_copy.3: $(DEP_SUBSTITUTE) $(srcdir)/uuid_copy.3.in
-       $(SUBSTITUTE) $(srcdir)/uuid_copy.3.in uuid_copy.3
+       $(SUBSTITUTE_UPTIME) $(srcdir)/uuid_copy.3.in uuid_copy.3
 
 uuid_generate.3: $(DEP_SUBSTITUTE) $(srcdir)/uuid_generate.3.in
-       $(SUBSTITUTE) $(srcdir)/uuid_generate.3.in uuid_generate.3
+       $(SUBSTITUTE_UPTIME) $(srcdir)/uuid_generate.3.in uuid_generate.3
 
 uuid_is_null.3: $(DEP_SUBSTITUTE) $(srcdir)/uuid_is_null.3.in
-       $(SUBSTITUTE) $(srcdir)/uuid_is_null.3.in uuid_is_null.3
+       $(SUBSTITUTE_UPTIME) $(srcdir)/uuid_is_null.3.in uuid_is_null.3
 
 uuid_parse.3: $(DEP_SUBSTITUTE) $(srcdir)/uuid_parse.3.in
-       $(SUBSTITUTE) $(srcdir)/uuid_parse.3.in uuid_parse.3
+       $(SUBSTITUTE_UPTIME) $(srcdir)/uuid_parse.3.in uuid_parse.3
 
 uuid_time.3: $(DEP_SUBSTITUTE) $(srcdir)/uuid_time.3.in
-       $(SUBSTITUTE) $(srcdir)/uuid_time.3.in uuid_time.3
+       $(SUBSTITUTE_UPTIME) $(srcdir)/uuid_time.3.in uuid_time.3
 
 uuid_unparse.3: $(DEP_SUBSTITUTE) $(srcdir)/uuid_unparse.3.in
-       $(SUBSTITUTE) $(srcdir)/uuid_unparse.3.in uuid_unparse.3
+       $(SUBSTITUTE_UPTIME) $(srcdir)/uuid_unparse.3.in uuid_unparse.3
 
 installdirs::
        $(top_srcdir)/mkinstalldirs $(DESTDIR)$(libdir)  \
index 70d5e6c..c50c9cd 100644 (file)
@@ -1,3 +1,10 @@
+2004-04-03  Theodore Ts'o  <tytso@mit.edu>
+
+       * Makefile.in: Update the modtime even if subst doesn't need to
+               update the man pages, to avoid always re-running
+               subst, especially since there are no dependencies on these
+               generated files.
+
 2004-03-21  Theodore Ts'o  <tytso@mit.edu>
 
        * blkid.c: Remove the partially implemented -p option (it never
index 53d81a0..61176ef 100644 (file)
@@ -121,52 +121,52 @@ filefrag: $(FILEFRAG_OBJS)
        $(CC) $(ALL_LDFLAGS) -o filefrag $(FILEFRAG_OBJS) 
 
 tune2fs.8: $(DEP_SUBSTITUTE) $(srcdir)/tune2fs.8.in
-       $(SUBSTITUTE) $(srcdir)/tune2fs.8.in tune2fs.8
+       $(SUBSTITUTE_UPTIME) $(srcdir)/tune2fs.8.in tune2fs.8
 
 mklost+found.8: $(DEP_SUBSTITUTE) $(srcdir)/mklost+found.8.in
-       $(SUBSTITUTE) $(srcdir)/mklost+found.8.in mklost+found.8
+       $(SUBSTITUTE_UPTIME) $(srcdir)/mklost+found.8.in mklost+found.8
 
 mke2fs.8: $(DEP_SUBSTITUTE) $(srcdir)/mke2fs.8.in
-       $(SUBSTITUTE) $(srcdir)/mke2fs.8.in mke2fs.8
+       $(SUBSTITUTE_UPTIME) $(srcdir)/mke2fs.8.in mke2fs.8
 
 e2label.8: $(DEP_SUBSTITUTE) $(srcdir)/e2label.8.in
-       $(SUBSTITUTE) $(srcdir)/e2label.8.in e2label.8
+       $(SUBSTITUTE_UPTIME) $(srcdir)/e2label.8.in e2label.8
 
 findfs.8: $(DEP_SUBSTITUTE) $(srcdir)/findfs.8.in
-       $(SUBSTITUTE) $(srcdir)/findfs.8.in findfs.8
+       $(SUBSTITUTE_UPTIME) $(srcdir)/findfs.8.in findfs.8
 
 e2image.8: $(DEP_SUBSTITUTE) $(srcdir)/e2image.8.in
-       $(SUBSTITUTE) $(srcdir)/e2image.8.in e2image.8
+       $(SUBSTITUTE_UPTIME) $(srcdir)/e2image.8.in e2image.8
 
 dumpe2fs.8: $(DEP_SUBSTITUTE) $(srcdir)/dumpe2fs.8.in 
-       $(SUBSTITUTE) $(srcdir)/dumpe2fs.8.in dumpe2fs.8
+       $(SUBSTITUTE_UPTIME) $(srcdir)/dumpe2fs.8.in dumpe2fs.8
 
 badblocks.8: $(DEP_SUBSTITUTE) $(srcdir)/badblocks.8.in
-       $(SUBSTITUTE) $(srcdir)/badblocks.8.in badblocks.8      
+       $(SUBSTITUTE_UPTIME) $(srcdir)/badblocks.8.in badblocks.8       
 
 fsck.8: $(DEP_SUBSTITUTE) $(srcdir)/fsck.8.in
-       $(SUBSTITUTE) $(srcdir)/fsck.8.in fsck.8 
+       $(SUBSTITUTE_UPTIME) $(srcdir)/fsck.8.in fsck.8 
 
 blkid.8: $(DEP_SUBSTITUTE) $(srcdir)/blkid.8.in
-       $(SUBSTITUTE) $(srcdir)/blkid.8.in blkid.8
+       $(SUBSTITUTE_UPTIME) $(srcdir)/blkid.8.in blkid.8
 
 logsave.8: $(DEP_SUBSTITUTE) $(srcdir)/logsave.8.in
-       $(SUBSTITUTE) $(srcdir)/logsave.8.in logsave.8
+       $(SUBSTITUTE_UPTIME) $(srcdir)/logsave.8.in logsave.8
 
 chattr.1: $(DEP_SUBSTITUTE) $(srcdir)/chattr.1.in
-       $(SUBSTITUTE) $(srcdir)/chattr.1.in chattr.1 
+       $(SUBSTITUTE_UPTIME) $(srcdir)/chattr.1.in chattr.1 
 
 lsattr.1: $(DEP_SUBSTITUTE) $(srcdir)/lsattr.1.in 
-       $(SUBSTITUTE) $(srcdir)/lsattr.1.in lsattr.1 
+       $(SUBSTITUTE_UPTIME) $(srcdir)/lsattr.1.in lsattr.1 
 
 uuidgen.1: $(DEP_SUBSTITUTE) $(srcdir)/uuidgen.1.in 
-       $(SUBSTITUTE) $(srcdir)/uuidgen.1.in uuidgen.1 
+       $(SUBSTITUTE_UPTIME) $(srcdir)/uuidgen.1.in uuidgen.1 
 
 blkid.1: $(DEP_SUBSTITUTE) $(srcdir)/blkid.1.in 
-       $(SUBSTITUTE) $(srcdir)/blkid.1.in blkid.1 
+       $(SUBSTITUTE_UPTIME) $(srcdir)/blkid.1.in blkid.1 
 
 filefrag.8: $(DEP_SUBSTITUTE) $(srcdir)/filefrag.8.in
-       $(SUBSTITUTE) $(srcdir)/filefrag.8.in filefrag.8
+       $(SUBSTITUTE_UPTIME) $(srcdir)/filefrag.8.in filefrag.8
 
 installdirs:
        $(top_srcdir)/mkinstalldirs $(DESTDIR)$(sbindir) \
index 217a8bc..aa52dc0 100644 (file)
@@ -1,3 +1,10 @@
+2004-04-03  Theodore Ts'o  <tytso@mit.edu>
+
+       * Makefile.in: Update the modtime even if subst doesn't need to
+               update the resize2fs man page, to avoid always re-running
+               subst, especially since there are no dependencies on the
+               man page.
+
 2004-02-28  Theodore Ts'o  <tytso@mit.edu>
 
        * Release of E2fsprogs 1.35
index 2ea4979..c9dff22 100644 (file)
@@ -44,11 +44,11 @@ resize2fs.static: $(RESIZE_OBJS)  $(STATIC_DEPLIBS)
                $(RESIZE_OBJS) $(STATIC_LIBS) 
 
 resize2fs.8: $(DEP_SUBSTITUTE) $(srcdir)/resize2fs.8.in
-       $(SUBSTITUTE) $(srcdir)/resize2fs.8.in resize2fs.8
+       $(SUBSTITUTE_UPTIME) $(srcdir)/resize2fs.8.in resize2fs.8
 
 test_extent: $(TEST_EXTENT_OBJS)
        $(CC) $(ALL_LDFLAGS) -o test_extent $(TEST_EXTENT_OBJS) $(LIBS) 
-       
+
 installdirs:
        $(top_srcdir)/mkinstalldirs $(DESTDIR)$(root_sbindir) \
                $(DESTDIR)$(man8dir)
@@ -85,7 +85,7 @@ check:: test_extent.out
                diff test_extent.out $(srcdir)/test_extent.in ; \
                exit 1 ; \
        fi
-       
+
 clean:
        $(RM) -f $(PROGS) $(TEST_PROGS) $(MANPAGES) \#* *.s *.o *.a *~ core \
                resize2fs.static test_extent.out
@@ -116,7 +116,7 @@ $(top_srcdir)/.exclude-file:
                >> $(top_srcdir)/.exclude-file
        echo $(SRCROOT)/e2fsprogs-ALL-@E2FSPROGS_VERSION@.tar.gz \
                >> $(top_srcdir)/.exclude-file
-       
+
 source_tar_file: $(top_srcdir)/.exclude-file
        (cd $(top_srcdir)/..; a=$(SRCROOT); rm -f $$a ; ln -sf e2fsprogs $$a ; \
                $(TAR) -c -h -v -f - \
index 6625403..ec2a01c 100644 (file)
@@ -1,3 +1,8 @@
+2004-04-03  Theodore Ts'o  <tytso@mit.edu>
+
+       * subst.c (main): Add new option to update the timestamp of the
+               generated file.
+
 2004-02-28  Theodore Ts'o  <tytso@mit.edu>
 
        * Release of E2fsprogs 1.35
index dff1848..0c618a8 100644 (file)
@@ -11,6 +11,9 @@
 #include <unistd.h>
 #include <string.h>
 #include <ctype.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <utime.h>
 
 #ifdef HAVE_GETOPT_H
 #include <getopt.h>
@@ -289,7 +292,6 @@ static int compare_file(const char *outfn, const char *newfn)
        return retval;
 }
 
-       
 
 
 int main(int argc, char **argv)
@@ -299,8 +301,11 @@ int main(int argc, char **argv)
        FILE    *in, *out;
        char    *outfn = NULL, *newfn = NULL;
        int     verbose = 0;
+       int     adjust_timestamp = 0;
+       struct stat stbuf;
+       struct utimbuf ut;
        
-       while ((c = getopt (argc, argv, "f:v")) != EOF) {
+       while ((c = getopt (argc, argv, "f:tv")) != EOF) {
                switch (c) {
                case 'f':
                        in = fopen(optarg, "r");
@@ -311,6 +316,9 @@ int main(int argc, char **argv)
                        parse_config_file(in);
                        fclose(in);
                        break;
+               case 't':
+                       adjust_timestamp++;
+                       break;
                case 'v':
                        verbose++;
                        break;
@@ -361,6 +369,16 @@ int main(int argc, char **argv)
                if (compare_file(outfn, newfn)) {
                        if (verbose)
                                printf("No change, keeping %s.\n", outfn);
+                       if (adjust_timestamp) {
+                               if (stat(outfn, &stbuf) == 0) {
+                                       if (verbose)
+                                               printf("Updating modtime for %s\n", outfn);
+                                       ut.actime = stbuf.st_atime;
+                                       ut.modtime = time(0);
+                                       if (utime(outfn, &ut) < 0)
+                                               perror("utime");
+                               }
+                       }
                        unlink(newfn);
                } else {
                        if (verbose)