changeset 108475:b246058e9b05

Do not preprocess lib-src/Makefile.in * configure.in: Generate lib-src/Makefile directly, do not run cpp. * config.bat: Do not run cpp on lib-src/Makefile.in. * lib-src/Makefile.in: Convert comments to makefile format. * admin/notes/cpp: lib-src/Makefile not preprocessed.
author Glenn Morris <rgm@gnu.org>
date Mon, 10 May 2010 20:00:32 -0700
parents d89b565897dd
children 2b195069f0d5
files admin/notes/cpp config.bat configure.in lib-src/ChangeLog lib-src/Makefile.in
diffstat 5 files changed, 39 insertions(+), 63 deletions(-) [+]
line wrap: on
line diff
--- a/admin/notes/cpp	Mon May 10 19:51:08 2010 -0700
+++ b/admin/notes/cpp	Mon May 10 20:00:32 2010 -0700
@@ -1,11 +1,7 @@
 ttn 2003-04-09
 
 we use a C preprocesor not only in the normal compilation of .c files
-into object files, but also for creating
-
-	src/Makefile
-	lib-src/Makefile
-
+into object files, but also for creating src/Makefile.
 (delimited by comment "start of cpp stuff").  some cpp implementations
 insert whitespace in between tokens.
 
--- a/config.bat	Mon May 10 19:51:08 2010 -0700
+++ b/config.bat	Mon May 10 20:00:32 2010 -0700
@@ -221,16 +221,12 @@
 rem   ----------------------------------------------------------------------
 Echo Configuring the library source directory...
 cd lib-src
-rem   Create "makefile" from "makefile.in".
-sed -e "1,/== start of cpp stuff ==/s@^##*[ 	].*$@@" <Makefile.in >junk.c
-gcc -E -traditional -I. -I../src junk.c | sed -e "s/^ /	/" -e "/^#/d" -e "/^[ 	]*$/d" >makefile.new
 If "%DJGPP_VER%" == "2" goto libsrc-v2
-sed -f ../msdos/sed3.inp <makefile.new >Makefile
+sed -f ../msdos/sed3.inp <Makefile.in >Makefile
 Goto libsrc2
 :libsrc-v2
-sed -f ../msdos/sed3v2.inp <makefile.new >Makefile
+sed -f ../msdos/sed3v2.inp <Makefile.in >Makefile
 :libsrc2
-rm -f makefile.new junk.c
 if "%X11%" == "" goto libsrc2a
 mv Makefile makefile.tmp
 sed -f ../msdos/sed3x.inp <makefile.tmp >Makefile
--- a/configure.in	Mon May 10 19:51:08 2010 -0700
+++ b/configure.in	Mon May 10 20:00:32 2010 -0700
@@ -3595,7 +3595,7 @@
 	CPP_NEED_TRADITIONAL=no,
 	CPP_NEED_TRADITIONAL=yes)
 
-AC_OUTPUT(Makefile lib-src/Makefile.c:lib-src/Makefile.in oldXMenu/Makefile \
+AC_OUTPUT(Makefile lib-src/Makefile oldXMenu/Makefile \
 	doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile \
 	doc/lispref/Makefile src/Makefile.c:src/Makefile.in \
 	lwlib/Makefile lisp/Makefile leim/Makefile, [
@@ -3619,22 +3619,6 @@
   CPPFLAGS="$CPPFLAGS -traditional"
 fi
 
-echo creating lib-src/Makefile
-( cd lib-src
-  rm -f junk.c junk1.c junk2.c
-  sed -e '/start of cpp stuff/q' \
-      < Makefile.c > junk1.c
-  sed -e '1,/start of cpp stuff/d'\
-      -e 's,/\*\*/#\(.*\)$,/* \1 */,' \
-      < Makefile.c > junk.c
-  $CPP -P $cpp_undefs -I. -I$srcdir/src $CPPFLAGS junk.c | \
-      sed -e 's/^ /	/' -e '/^#/d' -e '/^[ 	]*$/d' > junk2.c
-  cat junk1.c junk2.c > Makefile.new
-  rm -f junk.c junk1.c junk2.c
-  chmod 444 Makefile.new
-  mv -f Makefile.new Makefile
-)
-
 echo creating src/Makefile
 ( cd src
   rm -f junk.c junk1.c junk2.c
--- a/lib-src/ChangeLog	Mon May 10 19:51:08 2010 -0700
+++ b/lib-src/ChangeLog	Mon May 10 20:00:32 2010 -0700
@@ -1,5 +1,7 @@
 2010-05-11  Glenn Morris  <rgm@gnu.org>
 
+	* Makefile.in: Convert comments to makefile format.
+
 	* Makefile.in (LIBS_SYSTEM) [MSDOS]: Do not reset.
 	(config.h) [MSDOS]: Do not include.
 
--- a/lib-src/Makefile.in	Mon May 10 19:51:08 2010 -0700
+++ b/lib-src/Makefile.in	Mon May 10 20:00:32 2010 -0700
@@ -31,6 +31,7 @@
 CC=@CC@
 CFLAGS=@CFLAGS@
 version=@version@
+## Used in $archlibdir.
 configuration=@configuration@
 EXEEXT=@EXEEXT@
 C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@
@@ -127,8 +128,8 @@
 # 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
-# in ../src/[ms]/*.h should be correct and you should not need to do anything.
-# If neither flag is set, blessmail is used.
+# set by configure should be correct and you should not need to do anything.
+# If neither flag is set, you need to use blessmail.
 MOVE_FLAGS=
 
 ## Empty if either MAIL_USE_FLOCK or MAIL_USE_LOCKF, else need-blessmail.
@@ -164,18 +165,15 @@
 LINK_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) -DHAVE_CONFIG_H -I. -I../src -I${srcdir} -I${srcdir}/../src ${LDFLAGS} ${CFLAGS}
 CPP_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) -DHAVE_CONFIG_H -I. -I../src -I${srcdir} -I${srcdir}/../src ${CPPFLAGS} ${CFLAGS}
 
-# ========================== start of cpp stuff =======================
-/* From here on, comments must be done in C syntax.  */
-
 LOADLIBES=$(LIBS_SYSTEM)
 
 
 .SUFFIXES: .m
 
-/* This is the default compilation command.
-   But we should never rely on it, because some make version
-   failed to find it for getopt.o.
-   Using an explicit command made it work.  */
+## This is the default compilation command.
+## But we should never rely on it, because some make version failed to
+## find it for getopt.o.
+## Using an explicit command made it work.
 .c.o:
 	${CC} -c ${CPP_CFLAGS} $<
 
@@ -184,11 +182,10 @@
 
 all: ${DONT_INSTALL} ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
 
-/* These targets copy the scripts into the build directory
-so that they can be run from there in an uninstalled Emacs.
-The "-" is prepended because some versions of cp barf when
-srcdir is the current directory, and thus the file will be
-copied into itself.  */
+## These targets copy the scripts into the build directory so that
+## they can be run from there in an uninstalled Emacs.
+## The "-" is prepended because some versions of cp barf when srcdir
+## is the current directory, and thus the file will be copied into itself.
 rcs2log: $(srcdir)/rcs2log
 	-cp -p $(srcdir)/rcs2log rcs2log
 
@@ -201,16 +198,15 @@
 vcdiff: $(srcdir)/vcdiff
 	-cp -p $(srcdir)/vcdiff vcdiff
 
-/* Only used if we need blessmail, but no harm in always defining.
-   This makes the actual blessmail executable.  */
+## Only used if we need blessmail, but no harm in always defining.
+## This makes the actual blessmail executable.
 blessmail:
 	$(EMACS) $(EMACSOPT) -l $(srcdir)/../lisp/mail/blessmail.el
 	chmod +x blessmail
 
-/* This checks if we need to run blessmail.  */
+## This checks if we need to run blessmail.
+## Do not charge ahead and do it!  Let the installer decide.
 need-blessmail: blessmail
-/* Don\'t charge ahead and do it!  Let the installer decide.
-	  ./blessmail $(DESTDIR)${archlibdir}/movemail${EXEEXT}  */
 	@if [ `wc -l <blessmail` != 2 ] ; then \
 	  dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \
 	  echo Assuming $$dir is really the mail spool directory, you should; \
@@ -219,11 +215,14 @@
 	  echo Do that after running  make install.; \
 	fi
 
-/* This is the target invoked by the top-level Makefile.  */
+## This is the target invoked by the top-level Makefile.
 maybe-blessmail: $(BLESSMAIL_TARGET)
 
-/* Install the internal utilities.  Until they are installed, we can
-   just run them directly from lib-src.  */
+## Install the internal utilities.  Until they are installed, we can
+## just run them directly from lib-src.
+## If the chown/chmod commands fail, that is not a big deal.
+## update-game-score will detect at runtime that it is not setuid,
+## and handle things accordingly.
 $(DESTDIR)${archlibdir}: all
 	@echo
 	@echo "Installing utilities run internally by Emacs."
@@ -236,9 +235,6 @@
 	umask 022; $(top_srcdir)/mkinstalldirs $(DESTDIR)${gamedir}; \
 	touch $(DESTDIR)${gamedir}/snake-scores; \
 	touch $(DESTDIR)${gamedir}/tetris-scores
-/* If the following commands fail, that is not a big deal.
-   update-game-score will detect at runtime that it is not setuid,
-   and handle things accordingly. */
 	-if chown ${gameuser} $(DESTDIR)${archlibdir}/update-game-score && chmod u+s $(DESTDIR)${archlibdir}/update-game-score; then \
 	  chown ${gameuser} $(DESTDIR)${gamedir}; \
 	  chmod u=rwx,g=rwx,o=rx $(DESTDIR)${gamedir}; \
@@ -289,7 +285,7 @@
 extraclean: maintainer-clean
 	-rm -f *~ \#*
 
-/* Test the contents of the directory.  */
+## Test the contents of the directory.
 check:
 	@echo "We don't have any tests for GNU Emacs yet."
 
@@ -297,16 +293,16 @@
 TAGS: etags${EXEEXT}
 	etags *.[ch]
 
-/* This verifies that the non-ASCII characters in the file \`testfile\'
-   have not been clobbered by whatever means were used to copy and
-   distribute Emacs.  If they were clobbered, all the .elc files were
-   clobbered too.  */
+## This verifies that the non-ASCII characters in the file \`testfile\'
+## have not been clobbered by whatever means were used to copy and
+## distribute Emacs.  If they were clobbered, all the .elc files were
+## clobbered too.
 test-distrib${EXEEXT}: ${srcdir}/test-distrib.c
 	$(CC) ${ALL_CFLAGS} -o test-distrib ${srcdir}/test-distrib.c
 	./test-distrib ${srcdir}/testfile
 
-/* We need the following in order to create a <getopt.h> when the system
-   does not have one that works with the given compiler.  */
+## We need the following in order to create a <getopt.h> when the system
+## does not have one that works with the given compiler.
 GETOPT_H = @GETOPT_H@
 getopt.h: getopt_.h
 	cp $(srcdir)/getopt_.h $@-t
@@ -331,8 +327,8 @@
 ebrowse${EXEEXT}: ${srcdir}/ebrowse.c $(GETOPTDEPS) ../src/config.h
 	$(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" ${srcdir}/ebrowse.c $(GETOPTOBJS) $(LOADLIBES) -o ebrowse
 
-/* We depend on etags to assure that parallel makes don\'t write two
-   etags.o files on top of each other.  */
+## We depend on etags to assure that parallel makes do not write two
+## etags.o files on top of each other.
 ctags${EXEEXT}: etags${EXEEXT}
 	$(CC) ${ALL_CFLAGS} -DCTAGS -DEMACS_NAME="\"GNU Emacs\"" -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) $(REGEXPOBJ) $(LOADLIBES) -o ctags
 
@@ -355,7 +351,7 @@
 movemail${EXEEXT}: movemail.o pop.o $(GETOPTDEPS)
 	$(CC) ${LINK_CFLAGS} ${MOVE_FLAGS} movemail.o pop.o $(GETOPTOBJS) $(LOADLIBES) $(LIBS_MOVE) -o movemail
 
-/*  We need to define emacs to get the right version of something (what?).  */
+## We need to define emacs to get the right version of something (what?).
 movemail.o: ${srcdir}/movemail.c ../src/config.h $(GETOPT_H)
 	$(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c
 
@@ -379,3 +375,5 @@
 update-game-score.o: ${srcdir}/update-game-score.c ../src/config.h $(GETOPT_H)
 	$(CC) -c ${CPP_CFLAGS} ${srcdir}/update-game-score.c \
 	  -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\""
+
+## Makefile ends here.