octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: streamlining build process.


From: John W. Eaton
Subject: Re: streamlining build process.
Date: Tue, 21 Mar 2000 02:20:03 -0600 (CST)

On 20-Mar-2000, Ben Sapp <address@hidden> wrote:

| The patches I have attached make it so that ar is called only once for
| each library.   I believe that all dependency information is handled
| correctly, even in lubcruft.   The src and liboctave directories were
| trivial.  libcruft was a bit more of a problem.    I tested it on IRIX
| and also Linux.   I also tested it with shared and static libraries. 
| 
| The patches are applicable to the unstable CVS from a few days ago.  Let
| me know if there are any problems with them. 

I applied your patch with a few modifications and checked in the
changes (diffs appended).

The main difference from your original changes is that I don't try to
build the object files from the libcruft directory.  Instead, I let
make recurse through the libcruft subdirectories to build the objects,
then I put them all together in the libcruft directory.  This is
similar to the way things work for creating a shared library version
of libcruft.  By recursing, we avoid missing any special targets that
might need to be run in the subdirectories.

One of the advantages of the previous approach has been lost.  Now if
you run make in a libcruft subdirectory (libcruft/lapack, for
example), the archive won't be updated unless you also go up one
directory level and run make again.  Instead of worrying too about
making that work correctly (I don't think it is possible without some
changes to Make), I've just added a warning message that is printed if
anything is done in a subdirectory.

One potential problem with these changes is the length of the command
line that is generated for the ar command.  Some shells may choke on
that.  But they would also have trouble with the command that builds
the shared library version of libcruft, so maybe it won't cause any
real trouble.

I think the patch below also prevents octave from being linked every
time Make is run, even when it is not out of date (that's been bugging
me for a long time, but I've not been motivated to fix it until now).

Thanks,

jwe


Index: ChangeLog
===================================================================
RCS file: /usr/local/cvsroot/octave/ChangeLog,v
retrieving revision 1.206
diff -u -r1.206 ChangeLog
--- ChangeLog   2000/03/08 22:01:16     1.206
+++ ChangeLog   2000/03/21 08:09:35
@@ -1,3 +1,13 @@
+2000-03-21  John W. Eaton  <address@hidden>
+
+       * Makefile.in (liboctave.$(SHLEXT)): Delete target before rebuilding.
+
+2000-03-21  Ben Sapp <address@hidden>:
+
+       * Makeconf.in (%.o : %.c): Pass -o to compile command.
+       (%.o : %.cc): Ditto.
+       * configure.in (%.o : %.f): Ditto.
+
 2000-03-08  Stephen Eglen  <address@hidden>
 
        * emacs/octave-mod.el (octave-font-lock-keywords): To font-lock
Index: Makeconf.in
===================================================================
RCS file: /usr/local/cvsroot/octave/Makeconf.in,v
retrieving revision 1.103
diff -u -r1.103 Makeconf.in
--- Makeconf.in 2000/02/12 02:24:41     1.103
+++ Makeconf.in 2000/03/21 08:09:40
@@ -279,10 +279,10 @@
 # How to make .o files:
 
 %.o : %.c
-       $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
+       $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< -o $@
 
 %.o : %.cc
-       $(CXX) -c $(CPPFLAGS) $(ALL_CXXFLAGS) $<
+       $(CXX) -c $(CPPFLAGS) $(ALL_CXXFLAGS) $< -o $@
 
 pic/%.o : %.c
        $(CC) -c $(CPPFLAGS) $(CPICFLAG) $(ALL_CFLAGS) $< -o $@
Index: configure.in
===================================================================
RCS file: /usr/local/cvsroot/octave/configure.in,v
retrieving revision 1.324
diff -u -r1.324 configure.in
--- configure.in        2000/03/08 09:30:05     1.324
+++ configure.in        2000/03/21 08:10:03
@@ -427,7 +427,7 @@
 %.c : %.f
 
 %.o : %.f
-       $(FC) -c $(ALL_FFLAGS) $<
+       $(FC) -c $(ALL_FFLAGS) -o $@ $<
 
 pic/%.o : %.f
        $(FC) -c $(FPICFLAG) $(ALL_FFLAGS) $< -o $@
Index: libcruft/ChangeLog
===================================================================
RCS file: /usr/local/cvsroot/octave/libcruft/ChangeLog,v
retrieving revision 1.69
diff -u -r1.69 ChangeLog
--- ChangeLog   2000/02/10 09:20:48     1.69
+++ ChangeLog   2000/03/21 08:10:13
@@ -1,3 +1,16 @@
+2000-03-21  John W. Eaton  <address@hidden>
+
+       * Makefile.in (libcruft.$(LIBEXT)): New target.
+       (all): Depend on `libraries', not `$(SUBDIRS) shared-lib'.
+       Conditionally construct `libraries' target.
+       (libcruft.$(SHLEXT_VER)): Delete target before rebuilding.
+       * Makerules.in (LIBCRUFT): Delete variable.
+       (LIBCRUFT_DEPEND): Conditionally define to $(LIBCRUFT_OBJS) only.
+       (all): Print warning if anything is done.
+       (stmp-pic): New target.
+       ($CRUFT_PICOBJ): Depend on stmp-pic.
+       (clean, mostlyclean): Remove pic and stmp-pic.
+
 2000-02-10  John W. Eaton  <address@hidden>
 
        * lapack/dbdsqr.f, lapack/dgeesv.f, lapack/dgelss.f,
Index: libcruft/Makefile.in
===================================================================
RCS file: /usr/local/cvsroot/octave/libcruft/Makefile.in,v
retrieving revision 1.63
diff -u -r1.63 Makefile.in
--- Makefile.in 1999/10/19 17:52:29     1.63
+++ Makefile.in 2000/03/21 08:10:15
@@ -36,7 +36,7 @@
   BINDISTFILES = libcruft.$(SHLEXT_VER)
 endif
 
-all: $(SUBDIRS) shared-lib
+all: libraries
 .PHONY: all
 
 $(SUBDIRS):
@@ -67,17 +67,31 @@
 endif
 
 ifeq ($(SHARED_LIBS), true)
-shared-lib: libcruft.$(SHLEXT)
+  ifeq ($(STATIC_LIBS), true)
+    libraries: $(SUBDIRS) libcruft.$(LIBEXT) libcruft.$(SHLEXT)
+  else
+    libraries: $(SUBDIRS) libcruft.$(SHLEXT)
+  endif
 else
-shared-lib:
+  ifeq ($(STATIC_LIBS), true)
+    libraries: $(SUBDIRS) libcruft.$(LIBEXT)
+  else
+    libraries:
+  endif
 endif
-.PHONY: shared-lib
+.PHONY: libraries
 
+libcruft.$(LIBEXT): $(CRUFT_OBJ)
+       rm -f $@
+       $(AR) $(ARFLAGS) $@ $^
+       $(RANLIB) $@
+
 libcruft.$(SHLEXT): libcruft.$(SHLEXT_VER)
        rm -f $@
        $(LN_S) $< $@
 
 libcruft.$(SHLEXT_VER): $(CRUFT_PICOBJ)
+       rm -f $@
        $(SH_LD) $(SH_LDFLAGS) $(SONAME_FLAGS) -o $@ $^
 
 $(CRUFT_OBJ):
Index: libcruft/Makerules.in
===================================================================
RCS file: /usr/local/cvsroot/octave/libcruft/Makerules.in,v
retrieving revision 1.27
diff -u -r1.27 Makerules.in
--- Makerules.in        1999/11/03 19:54:16     1.27
+++ Makerules.in        2000/03/21 08:10:15
@@ -31,21 +31,26 @@
 CWD = $(shell pwd)
 THISDIR = $(notdir $(CWD))
 
-LIBCRUFT := ../libcruft.$(LIBEXT)
-
 LIBCRUFT_OBJS = $(CRUFT_OBJ) $(SPECIAL_DEPEND)
 
-LIBCRUFT_DEPS = $(LIBCRUFT)($(LIBCRUFT_OBJS))
-
 ifeq ($(STATIC_LIBS), true)
-  LIBCRUFT_DEPEND := $(LIBCRUFT_DEPS)
+  LIBCRUFT_DEPEND := $(LIBCRUFT_OBJS)
 endif
 
 all: pic $(LIBCRUFT_DEPEND) $(CRUFT_PICOBJ) $(SPECIAL_PICDEPEND)
+       @echo "warning: run make in parent directory to update libraries"
 .PHONY: all
 
 .PRECIOUS: $(LIBCRUFT_OBJS)
 
+stmp-pic: pic
+       @if [ -f stmp-pic ]; then \
+         true; \
+       else \
+         echo "touch stmp-pic"; \
+         touch stmp-pic; \
+       fi
+
 pic:
        @if [ -d pic ]; then \
          true; \
@@ -54,6 +59,8 @@
          mkdir pic; \
        fi
 
+$(CRUFT_PICOBJ): stmp-pic
+
 install:: all
 .PHONY: install
 
@@ -68,15 +75,18 @@
 
 clean::
        rm -f *.a *.o pic/*.o
+       -rmdir pic
+       rm -f stmp-pic
 .PHONY: clean
 
 mostlyclean::
        rm -f *.o pic/*.o
+       -rmdir pic
+       rm -f stmp-pic
 .PHONY: mostlyclean
 
 distclean:: clean
        rm -f Makefile
-       -rmdir pic
 .PHONY: distclean
        
 maintainer-clean:: distclean
Index: liboctave/ChangeLog
===================================================================
RCS file: /usr/local/cvsroot/octave/liboctave/ChangeLog,v
retrieving revision 1.199
diff -u -r1.199 ChangeLog
--- ChangeLog   2000/03/17 11:01:02     1.199
+++ ChangeLog   2000/03/21 08:10:48
@@ -1,3 +1,13 @@
+2000-03-21  John W. Eaton  <address@hidden>
+
+       * Makefile.in (liboctave.$(SHLEXT)): Delete target
+       before rebuilding.
+
+2000-03-21  Ben Sapp <address@hidden>:
+
+       * liboctave/Makefile.in (liboctave.$(LIBEXT)): New target.
+       (libraries): Depend only on library targets, not archive members.
+
 2000-03-17  John W. Eaton  <address@hidden>
 
        * Makefile.in: (objects): New target.
Index: liboctave/Makefile.in
===================================================================
RCS file: /usr/local/cvsroot/octave/liboctave/Makefile.in,v
retrieving revision 1.132
diff -u -r1.132 Makefile.in
--- Makefile.in 2000/03/17 11:03:52     1.132
+++ Makefile.in 2000/03/21 08:10:50
@@ -148,24 +148,30 @@
 
 ifeq ($(SHARED_LIBS), true)
   ifeq ($(STATIC_LIBS), true)
-    libraries: liboctave.$(LIBEXT)($(OBJECTS)) liboctave.$(SHLEXT)
+    libraries: liboctave.$(LIBEXT) liboctave.$(SHLEXT)
   else
     libraries: liboctave.$(SHLEXT)
   endif
 else
   ifeq ($(STATIC_LIBS), true)
-    libraries: liboctave.$(LIBEXT)($(OBJECTS))
+    libraries: liboctave.$(LIBEXT)
   else
     libraries:
   endif
 endif
 .PHONY: libraries
 
+liboctave.$(LIBEXT): $(OBJECTS)
+       rm -f $@
+       $(AR) $(ARFLAGS) $@ $^
+       $(RANLIB) $@
+
 liboctave.$(SHLEXT): liboctave.$(SHLEXT_VER)
        rm -f $@
        $(LN_S) $< $@
 
 liboctave.$(SHLEXT_VER): $(PICOBJ)
+       rm -f $@
        $(SH_LD) $(SH_LDFLAGS) $(SONAME_FLAGS) -o $@ $^
 
 $(PICOBJ): stmp-pic
Index: ChangeLog
===================================================================
RCS file: /usr/local/cvsroot/octave/src/ChangeLog,v
retrieving revision 1.401
diff -u -r1.401 ChangeLog
--- ChangeLog   2000/03/17 11:01:03     1.401
+++ ChangeLog   2000/03/21 08:17:49
@@ -1,3 +1,18 @@
+2000-03-21  John W. Eaton  <address@hidden>
+
+       * src/Makefile.in (LIBRARIES): Conditionally define.
+       (libraries): Depend on $(LIBRARIES).
+       (octave): Depend on $(LIBRARIES), not libraries.  Also depend on
+       stamp-prereq and stamp-oct-links.
+       (all): Don't depend on stamp-prereq or stamp-oct-links.
+       (liboctinterp.$(LIBEXT), liboctinterp.$(SHELXT)): Delete target
+       before rebuilding.
+
+2000-03-21  Ben Sapp <address@hidden>:
+
+       * src/Makefile.in (libraries): Depend only on library targets, not
+       archive members.
+
 2000-03-17  John W. Eaton  <address@hidden>
 
        * Makefile.in (objects): New target
Index: src/Makefile.in
===================================================================
RCS file: /usr/local/cvsroot/octave/src/Makefile.in,v
retrieving revision 1.247
diff -u -r1.247 Makefile.in
--- Makefile.in 2000/03/17 11:01:03     1.247
+++ Makefile.in 2000/03/21 08:12:40
@@ -203,11 +203,41 @@
   BINDISTFILES = octave $(OCT_FILES)
 endif
 
-all: stamp-prereq libraries stamp-oct-links octave DOCSTRINGS
+all: octave DOCSTRINGS
 .PHONY: all
 
 objects: $(OBJECTS)
 
+ifeq ($(SHARED_LIBS), true)
+  ifeq ($(STATIC_LIBS), true)
+    LIBRARIES = liboctinterp.$(LIBEXT) liboctinterp.$(SHLEXT)
+  else
+    LIBRARIES = liboctinterp.$(SHLEXT)
+  endif
+else
+  ifeq ($(STATIC_LIBS), true)
+    LIBRARIES = liboctinterp.$(LIBEXT)
+  else
+    LIBRARIES =
+  endif
+endif
+
+libraries: $(LIBRARIES)
+.PHONY: libraries
+
+liboctinterp.$(LIBEXT): $(OBJECTS)
+       rm -f $@
+       $(AR) $(ARFLAGS) $@ $^
+       $(RANLIB) $@
+
+liboctinterp.$(SHLEXT): liboctinterp.$(SHLEXT_VER)
+       rm -f $@
+       $(LN_S) $< $@
+
+liboctinterp.$(SHLEXT_VER): $(PICOBJ)
+       rm -f $@
+       $(SH_LD) $(SH_LDFLAGS) $(SONAME_FLAGS) -o $@ $^
+
 stamp-oct-links: $(OCT_FILES)
        if [ -n "$(OCT_FILES)" ]; then \
          $(srcdir)/mk-oct-links . $(addprefix $(srcdir)/, $(DLD_SRC)); \
@@ -217,7 +247,8 @@
 stamp-prereq: defaults.h oct-conf.h
        touch stamp-prereq
 
-octave: octave.o builtins.o ops.o $(DLD_STATIC_OBJ) libraries
+octave: stamp-prereq $(LIBRARIES) stamp-oct-links \
+       octave.o builtins.o ops.o $(DLD_STATIC_OBJ)
        $(CXX) $(CPPFLAGS) $(ALL_CXXFLAGS) $(RDYNAMIC_FLAG) \
        $(ALL_LDFLAGS) -o octave \
        octave.o builtins.o ops.o $(DLD_STATIC_OBJ) \
@@ -240,32 +271,6 @@
          echo "mkdir pic"; \
          mkdir pic; \
        fi
-
-ifeq ($(SHARED_LIBS), true)
-  ifeq ($(STATIC_LIBS), true)
-    libraries: liboctinterp.$(LIBEXT)($(OBJECTS)) liboctinterp.$(SHLEXT)
-  else
-    libraries: liboctinterp.$(SHLEXT)
-  endif
-else
-  ifeq ($(STATIC_LIBS), true)
-    libraries: liboctinterp.$(LIBEXT)($(OBJECTS))
-  else
-    libraries:
-  endif
-endif
-.PHONY: libraries
-
-liboctinterp.$(LIBEXT): $(OBJECTS)
-       $(AR) $(ARFLAGS) $@ $^
-       $(RANLIB) $@
-
-liboctinterp.$(SHLEXT): liboctinterp.$(SHLEXT_VER)
-       rm -f $@
-       $(LN_S) $< $@
-
-liboctinterp.$(SHLEXT_VER): $(PICOBJ)
-       $(SH_LD) $(SH_LDFLAGS) $(SONAME_FLAGS) -o $@ $^
 
 $(PICOBJ): stmp-pic
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]