From 9a514d4a6c27b837fc2cd6d02c7cd60f08a621a4 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 8 Jan 2011 13:02:38 -0800 Subject: [PATCH] Automate syncing from gnulib. --- ChangeLog | 29 ++++++++++++++++++++++ INSTALL | 11 ++++++--- Makefile.in | 59 +++++++++++++++++++++++++++++++++++++++------ README | 1 + configure.in | 10 +++++++- lib-src/ChangeLog | 10 ++++++++ lib-src/Makefile.in | 12 +++++++-- lib/Makefile.am | 8 ++++++ make-dist | 14 +++++++++-- src/ChangeLog | 9 ++++++- src/Makefile.in | 8 ++++-- 11 files changed, 152 insertions(+), 19 deletions(-) create mode 100644 lib/Makefile.am diff --git a/ChangeLog b/ChangeLog index fdf037c24c..5a0a61e353 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,32 @@ +2011-01-08 Paul Eggert + + Automate syncing from gnulib. + * INSTALL, README: Document new subdirectory 'lib'. + * Makefile.in (SUBDIR): Add lib. + (SUBDIR_MAKEFILES): Add lib/Makefile. + (lib-src, src, TAGS, tags): Depend on lib. + (gnulib_srcdir, GNULIB_MODULES, GNULIB_TOOL_FLAGS): New macros. + ($(gnulib_srcdir)): New rule. + (sync-from-gnulib): New rule, which is .PHONY. + (lib): New rule, which is like lib-src. + (Makefile): Depend on lib/Makefile.in. + (AUTOCONF_INPUTS): Depend on aclocal.m4. + (ACLOCAL_INPUTS, AUTOMAKE_INPUTS): New macros. + ($(srcdir)/aclocal.m4, $(srcdir)/lib/Makefile.in): New rules. + (am--refresh): New rule, to pacify Automake. + (mostlyclean, clean, distclean, bootstrap-clean, maintainer-clean): + Clean lib, too. + (top_maintainer_clean): New macro, to remove gnulib-tool and Automake + droppings. + (maintainer-clean, extraclean): Use it. + * configure.in: Initialize for automake and gnulib, by invoking + AM_INIT_AUTOMAKE, AM_PROG_CC_C_O, gl_EARLY, and gl_INIT. Output + lib/Makefile, too. Use automake to build gnulib, as gnulib works + more conveniently with automake. + * lib/Makefile.am: New file. + * make-dist: Also put into the distribution aclocal.m4, + compile, depcomp, missing, and the files under lib/. + 2011-01-07 Paul Eggert * install-sh, mkinstalldirs, move-if-change: Update from master diff --git a/INSTALL b/INSTALL index 542cf96f12..a5579df1fd 100644 --- a/INSTALL +++ b/INSTALL @@ -675,12 +675,15 @@ the following steps. `./src/epaths.h' from the template file `./src/epaths.in', changing the paths to the values specified in `./Makefile'. -2) Go to directory `./lib-src' and run `make'. This creates +2) Go to directory `./lib' and run `make'. This creates include files +and libraries used in later steps. + +3) Go to directory `./lib-src' and run `make'. This creates executables named `etags', `make-docfile', and others. -3) Go to directory `./src' and run `make'. This refers to files in -the `./lisp' and `./lib-src' subdirectories using names `../lisp' and -`../lib-src'. +4) Go to directory `./src' and run `make'. This refers to files in +the `./lisp', `./lib', and `./lib-src' subdirectories using names +`../lisp', `../lib', and `../lib-src'. This creates a file `./src/emacs' which is the runnable Emacs, which has another name that contains a version number. diff --git a/Makefile.in b/Makefile.in index 05865578d6..dbe98f37fa 100644 --- a/Makefile.in +++ b/Makefile.in @@ -264,10 +264,10 @@ EMACSFULL = `echo emacs-${version}${EXEEXT} | sed '$(TRANSFORM)'` # Actually, we now include `lisp' as well, since the compiled files # are not included any more in case of bootstrap or in case Emacs was # checked out from a VCS. -SUBDIR = lib-src src lisp +SUBDIR = lib lib-src src lisp # The subdir makefiles created by config.status. -SUBDIR_MAKEFILES = lib-src/Makefile doc/emacs/Makefile doc/misc/Makefile doc/lispref/Makefile doc/lispintro/Makefile src/Makefile oldXMenu/Makefile lwlib/Makefile leim/Makefile lisp/Makefile +SUBDIR_MAKEFILES = lib/Makefile lib-src/Makefile doc/emacs/Makefile doc/misc/Makefile doc/lispref/Makefile doc/lispintro/Makefile src/Makefile oldXMenu/Makefile lwlib/Makefile leim/Makefile lisp/Makefile # Subdirectories to install, and where they'll go. # lib-src's makefile knows how to install it, so we don't do that here. @@ -313,6 +313,8 @@ leim: src Makefile FRC CC='${CC}' CFLAGS='${CFLAGS}' CPPFLAGS='${CPPFLAGS}' \ LDFLAGS='${LDFLAGS}' MAKE='${MAKE}') +lib-src src: lib + src: lib-src FRC .RECURSIVE: ${SUBDIR} leim @@ -320,8 +322,32 @@ src: lib-src FRC # We need to build `emacs' in `src' to compile the *.elc files in `lisp'. lisp: src +# Maintainers can put a copy of gnulib into $(gnulib_srcdir). +gnulib_srcdir = ../gnulib +$(gnulib_srcdir): + git clone git://git.savannah.gnu.org/gnulib.git $@ + +# Update modules from gnulib, for maintainers, who should have it in +# $(gnulib_srcdir) (relative to $(srcdir) and should have build tools +# as per $(gnulib_srcdir)/DEPENDENCIES. +GNULIB_MODULES = dummy # Just a dummy for now, to establish the mechanism. +GNULIB_TOOL_FLAGS = \ + --import --no-changelog --no-vc-files --makefile-name=gnulib.mk +sync-from-gnulib: $(gnulib_srcdir) + cd $(srcdir) && \ + $(gnulib_srcdir)/gnulib-tool $(GNULIB_TOOL_FLAGS) $(GNULIB_MODULES) + cp $(gnulib_srcdir)/build-aux/texinfo.tex $(srcdir)/doc/misc + cp \ + $(gnulib_srcdir)/build-aux/config.sub \ + $(gnulib_srcdir)/build-aux/config.guess \ + $(gnulib_srcdir)/build-aux/install-sh \ + $(gnulib_srcdir)/build-aux/mkinstalldirs \ + $(gnulib_srcdir)/build-aux/move-if-change \ + $(srcdir) +.PHONY: sync-from-gnulib + # These targets should be "${SUBDIR} without `src'". -lib-src lisp: Makefile FRC +lib lib-src lisp: Makefile FRC cd $@; $(MAKE) all $(MFLAGS) \ CC='${CC}' CFLAGS='${CFLAGS}' CPPFLAGS='${CPPFLAGS}' \ LDFLAGS='${LDFLAGS}' MAKE='${MAKE}' @@ -360,6 +386,7 @@ blessmail: Makefile src FRC Makefile: config.status $(srcdir)/src/config.in \ $(srcdir)/Makefile.in \ $(srcdir)/src/Makefile.in \ + $(srcdir)/lib/Makefile.in \ $(srcdir)/lib-src/Makefile.in \ $(srcdir)/doc/emacs/Makefile.in \ $(srcdir)/doc/misc/Makefile.in \ @@ -374,11 +401,20 @@ Makefile: config.status $(srcdir)/src/config.in \ config.status: ${srcdir}/configure ${srcdir}/lisp/version.el ./config.status --recheck -AUTOCONF_INPUTS = @MAINT@ $(srcdir)/configure.in $(srcdir)/m4/getopt.m4 +AUTOCONF_INPUTS = @MAINT@ $(srcdir)/configure.in $(srcdir)/m4/getopt.m4 $(srcdir)/aclocal.m4 $(srcdir)/configure: $(AUTOCONF_INPUTS) cd ${srcdir} && autoconf +ACLOCAL_INPUTS = @MAINT@ $(srcdir)/m4/gnulib-comp.m4 +$(srcdir)/aclocal.m4: $(ACLOCAL_INPUTS) + cd $(srcdir) && aclocal -I m4 + +AUTOMAKE_INPUTS = @MAINT@ $(srcdir)/aclocal.m4 $(srcdir)/lib/Makefile.am +$(srcdir)/lib/Makefile.in: $(AUTOMAKE_INPUTS) + cd $(srcdir) && automake --gnu -a -c lib/Makefile +am--refresh: + $(srcdir)/src/config.in: $(srcdir)/src/stamp-h.in @ # Usually, there's no need to rebuild src/config.in just @ # because stamp-h.in has changed (since building stamp-h.in @@ -710,6 +746,7 @@ mostlyclean: FRC (cd src; $(MAKE) $(MFLAGS) mostlyclean) (cd oldXMenu; $(MAKE) $(MFLAGS) mostlyclean) (cd lwlib; $(MAKE) $(MFLAGS) mostlyclean) + (cd lib; $(MAKE) $(MFLAGS) mostlyclean) (cd lib-src; $(MAKE) $(MFLAGS) mostlyclean) -(cd doc/emacs && $(MAKE) $(MFLAGS) mostlyclean) -(cd doc/misc && $(MAKE) $(MFLAGS) mostlyclean) @@ -729,6 +766,7 @@ clean: FRC (cd src; $(MAKE) $(MFLAGS) clean) (cd oldXMenu; $(MAKE) $(MFLAGS) clean) (cd lwlib; $(MAKE) $(MFLAGS) clean) + (cd lib; $(MAKE) $(MFLAGS) clean) (cd lib-src; $(MAKE) $(MFLAGS) clean) -(cd doc/emacs && $(MAKE) $(MFLAGS) clean) -(cd doc/misc && $(MAKE) $(MFLAGS) clean) @@ -753,6 +791,7 @@ distclean: FRC (cd src; $(MAKE) $(MFLAGS) distclean) (cd oldXMenu; $(MAKE) $(MFLAGS) distclean) (cd lwlib; $(MAKE) $(MFLAGS) distclean) + (cd lib; $(MAKE) $(MFLAGS) distclean) (cd lib-src; $(MAKE) $(MFLAGS) distclean) (cd doc/emacs && $(MAKE) $(MFLAGS) distclean) (cd doc/misc && $(MAKE) $(MFLAGS) distclean) @@ -769,6 +808,7 @@ bootstrap-clean: FRC (cd src; $(MAKE) $(MFLAGS) bootstrap-clean) (cd oldXMenu; $(MAKE) $(MFLAGS) maintainer-clean) (cd lwlib; $(MAKE) $(MFLAGS) maintainer-clean) + (cd lib; $(MAKE) $(MFLAGS) maintainer-clean) (cd lib-src; $(MAKE) $(MFLAGS) maintainer-clean) -(cd doc/emacs && $(MAKE) $(MFLAGS) maintainer-clean) -(cd doc/misc && $(MAKE) $(MFLAGS) maintainer-clean) @@ -789,10 +829,15 @@ bootstrap-clean: FRC ### Makefile. More generally, `make maintainer-clean' should not delete ### anything that needs to exist in order to run `configure' and then ### begin to build the program. +top_maintainer_clean=\ + ${top_distclean}; \ + rm -fr autom4te.cache; \ + rm -f aclocal.m4 lib/gnulib.mk m4/gnulib-cache.m4 maintainer-clean: bootstrap-clean FRC (cd src; $(MAKE) $(MFLAGS) maintainer-clean) + (cd lib; $(MAKE) $(MFLAGS) maintainer-clean) (cd lisp; $(MAKE) $(MFLAGS) maintainer-clean) - ${top_distclean} + ${top_maintainer_clean} ### This doesn't actually appear in the coding standards, but Karl ### says GCC supports it, and that's where the configuration part of @@ -800,13 +845,13 @@ maintainer-clean: bootstrap-clean FRC ### it deletes backup and autosave files too. extraclean: for i in ${SUBDIR} leim; do (cd $$i; $(MAKE) $(MFLAGS) extraclean); done - ${top_distclean} + ${top_maintainer_clean} -rm -f config-tmp-* -rm -f *~ \#* # The src subdir knows how to do the right thing # even when the build directory and source dir are different. -TAGS tags: lib-src src +TAGS tags: lib lib-src src cd src; $(MAKE) tags check: diff --git a/README b/README index 1dba713231..283d175e61 100644 --- a/README +++ b/README @@ -63,6 +63,7 @@ There are several subdirectories: `leim' holds the library of Emacs input methods, Lisp code and auxiliary data files required to type international characters which can't be directly produced by your keyboard. +`lib' holds source code for libraries used by Emacs and its utilities `lib-src' holds the source code for some utility programs for use by or with Emacs, like movemail and etags. `etc' holds miscellaneous architecture-independent data files Emacs diff --git a/configure.in b/configure.in index 00c4721028..a267481c21 100644 --- a/configure.in +++ b/configure.in @@ -27,6 +27,7 @@ AC_PREREQ(2.65) AC_INIT(emacs, 24.0.50) AC_CONFIG_HEADER(src/config.h:src/config.in) AC_CONFIG_SRCDIR(src/lisp.h) +AM_INIT_AUTOMAKE dnl Support for --program-prefix, --program-suffix and dnl --program-transform-name options @@ -638,6 +639,10 @@ SPECIFIED_CFLAGS="$CFLAGS" dnl Sets GCC=yes if using gcc. AC_PROG_CC +AM_PROG_CC_C_O + +# Initialize gnulib right after verifying that the C compiler works. +gl_EARLY # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then @@ -2668,6 +2673,9 @@ AC_SUBST(GETOPTOBJS) AC_FUNC_GETPGRP +# Configure gnulib. +gl_INIT + AC_FUNC_STRFTIME # UNIX98 PTYs. @@ -3747,7 +3755,7 @@ dnl Secondly, the GNU Coding standards require that one should be able dnl to run `make prefix=/some/where/else' and override the values set dnl by configure. This also explains the `move-if-change' test and dnl the use of force in the `epaths-force' rule in Makefile.in. -AC_OUTPUT(Makefile lib-src/Makefile oldXMenu/Makefile \ +AC_OUTPUT(Makefile lib/Makefile lib-src/Makefile oldXMenu/Makefile \ doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile \ doc/lispref/Makefile src/Makefile \ lwlib/Makefile lisp/Makefile leim/Makefile, [ diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index b5869b322d..7da5d2104e 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,13 @@ +2011-01-08 Paul Eggert + + Automate syncing from gnulib. + * Makefile.in (EXE_FILES): New macro. + (BASE_CFLAGS): Add -I../lib and -I${srcdir}/../lib, + for gnulib's .h files. + (LOADLIBES): Add ../lib/libgnu.a. + ($(EXE_FILES)): Depend on ../lib/libgnu.a. + (../lib/libgnu.a): New rule. + 2011-01-08 Paul Eggert * Makefile.in (EXECUTABLES): Remove; macro unused since 1993. diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in index 5561c04b66..fc404c5ae6 100644 --- a/lib-src/Makefile.in +++ b/lib-src/Makefile.in @@ -128,6 +128,9 @@ DONT_INSTALL= test-distrib${EXEEXT} make-docfile${EXEEXT} SCRIPTS= rcs2log vcdiff STAMP_SCRIPTS= stamp-rcs2log stamp-vcdiff +# All files that are created by the linker, i.e., whose names end in ${EXEEXT}. +EXE_FILES = ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL} + # Specify additional -D flags for movemail. Options: # -DMAIL_USE_FLOCK or -DMAIL_USE_LOCKF (use flock or lockf for file locking). # See the comments about locking in movemail.c. Normally the values @@ -166,13 +169,15 @@ LIBS_SYSTEM = @LIBS_SYSTEM@ # defined before they know they can take advantage of the information # in ../src/config.h. BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) ${C_WARNINGS_SWITCH} \ - -DHAVE_CONFIG_H -I. -I../src -I${srcdir} -I${srcdir}/../src + -DHAVE_CONFIG_H -I. -I../src -I../lib \ + -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS} LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS} CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS} -LOADLIBES=$(LIBS_SYSTEM) +LOADLIBES = ../lib/libgnu.a $(LIBS_SYSTEM) +$(EXE_FILES): ../lib/libgnu.a ## This is the default compilation command. ## But we should never rely on it, because some make version failed to @@ -320,6 +325,9 @@ getopt.o: ${srcdir}/getopt.c $(GETOPT_H) ${srcdir}/gettext.h getopt1.o: ${srcdir}/getopt1.c $(GETOPT_H) ${CC} -c ${CPP_CFLAGS} ${srcdir}/getopt1.c +../lib/libgnu.a: ../src/config.h + cd ../lib && $(MAKE) libgnu.a + REGEXPOBJ = regex.o REGEXPDEPS = $(REGEXPOBJ) $(srcdir)/../src/regex.h diff --git a/lib/Makefile.am b/lib/Makefile.am new file mode 100644 index 0000000000..6a014f6057 --- /dev/null +++ b/lib/Makefile.am @@ -0,0 +1,8 @@ +BUILT_SOURCES = +EXTRA_DIST = +MOSTLYCLEANFILES = +noinst_LIBRARIES = + +DEFAULT_INCLUDES = -I. -I../src -I$(top_srcdir)/src + +include gnulib.mk diff --git a/make-dist b/make-dist index 3d610c1eee..3f8ea55b3d 100755 --- a/make-dist +++ b/make-dist @@ -286,12 +286,14 @@ ln INSTALL README BUGS move-if-change ${tempdir} ln ChangeLog Makefile.in configure configure.in ${tempdir} ln config.bat make-dist update-subdirs vpath.sed .dir-locals.el ${tempdir} ln mkinstalldirs config.sub config.guess install-sh ${tempdir} +ln aclocal.m4 ${tempdir} +ln compile depcomp missing ${tempdir} echo "Creating subdirectories" for subdir in site-lisp \ leim leim/CXTERM-DIC leim/MISC-DIC \ leim/SKK-DIC leim/ja-dic leim/quail \ - src src/m src/s src/bitmaps lib-src oldXMenu lwlib \ + src src/m src/s src/bitmaps lib lib-src oldXMenu lwlib \ nt nt/inc nt/inc/sys nt/inc/arpa nt/inc/netinet nt/icons \ `find etc lisp -type d` \ doc doc/emacs doc/misc doc/man doc/lispref doc/lispintro \ @@ -368,6 +370,14 @@ echo "Making links to \`src/s'" (cd src/s ln README [a-zA-Z0-9]*.h ../../${tempdir}/src/s) +echo "Making links to \`lib'" +(build_aux_h=`(ls *.h)` + cd lib + ln [a-zA-Z]*.[ch] ../${tempdir}/lib + ln gnulib.mk Makefile.am Makefile.in ../${tempdir}/lib + cd ../${tempdir}/lib + rm -f `(echo "$build_aux_h"; ls *.in.h) | sed '/[*]/d; s/.in.h$/.h/'`) + echo "Making links to \`lib-src'" (cd lib-src ln [a-zA-Z]*.[ch] ../${tempdir}/lib-src @@ -477,7 +487,7 @@ echo "Making links to \`doc/man'" ### It would be nice if they could all be symlinks to top-level copy, but ### you're not supposed to have any symlinks in distribution tar files. echo "Making sure copying notices are all copies of \`COPYING'" -for subdir in . etc info leim lib-src lisp lwlib msdos nt src; do +for subdir in . etc info leim lib lib-src lisp lwlib msdos nt src; do rm -f ${tempdir}/${subdir}/COPYING cp COPYING ${tempdir}/${subdir} done diff --git a/src/ChangeLog b/src/ChangeLog index aad0050f0b..c8bcd2ab66 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2011-01-08 Paul Eggert + + Automate syncing from gnulib. + * Makefile.in (lib): New macro. + (ALL_CFLAGS): Add -I$(lib) -I$(srcdir)/../lib. + ($(lib)/libgnu.a): New rule. + (temacs$(EXEEXT)): Also link $(lib)/libgnu.a. + 2011-01-08 Andreas Schwab * fns.c (Fyes_or_no_p): Add usage. @@ -29483,4 +29491,3 @@ See ChangeLog.10 for earlier changes. You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . - diff --git a/src/Makefile.in b/src/Makefile.in index 0f85428b88..b2a6b6537d 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -47,6 +47,7 @@ version = @version@ LIBOBJS = @LIBOBJS@ lispsource = $(srcdir)/../lisp +lib = ../lib libsrc = ../lib-src etc = ../etc oldXMenudir = ../oldXMenu @@ -320,6 +321,7 @@ MKDEPDIR=@MKDEPDIR@ ## ## FIXME? MYCPPFLAGS only referenced in etc/DEBUG. ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I$(srcdir) \ + -I$(lib) -I$(srcdir)/../lib \ $(C_SWITCH_MACHINE) $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \ $(C_SWITCH_X_SYSTEM) $(CFLAGS_SOUND) $(RSVG_CFLAGS) $(IMAGEMAGICK_CFLAGS) \ $(LIBXML2_CFLAGS) $(DBUS_CFLAGS) \ @@ -644,10 +646,12 @@ $(libsrc)/make-docfile$(EXEEXT): buildobj.h: Makefile echo "#define BUILDOBJ \"$(obj) $(otherobj) " "\"" > buildobj.h +$(lib)/libgnu.a: $(config_h) + cd $(lib) && $(MAKE) libgnu.a -temacs$(EXEEXT): $(START_FILES) stamp-oldxmenu $(obj) $(otherobj) +temacs$(EXEEXT): $(START_FILES) stamp-oldxmenu $(obj) $(otherobj) $(lib)/libgnu.a $(CC) $(LD_FIRSTFLAG) $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(TEMACS_LDFLAGS2) \ - -o temacs $(START_FILES) $(obj) $(otherobj) $(LIBES) + -o temacs $(START_FILES) $(obj) $(otherobj) $(lib)/libgnu.a $(LIBES) ## The following oldxmenu-related rules are only (possibly) used if ## HAVE_X11 && !USE_GTK, but there is no harm in always defining them -- 2.20.1