Subject: how to make (sic) relinks faster...
To: None <current-users@sun-lamp.cs.berkeley.edu>
From: Luke Mewburn <lm@rmit.edu.au>
List: current-users
Date: 05/21/1994 12:27:28
I seem to be doing `make' from the top of the src tree a bit, and
when most of the code just needs to get relinked in with the slightly
changed libc, or whatever, I notice that programs with 1 source
file get compiled like:
    cc -o foo .... foo.c
instead of:
    cc -c foo.c
    cc -o foo foo.o
The latter (to me) is preferable, because when the code is just
linking the `cc -o foo foo.o' is much faster than the first method.

The disadvantage, of course, is a few more .o files around; but
that's the tradeoff with speed & space...

Here's my patch to /usr/share/mk/bsd.prog.mk.


*** O_bsd.prog.mk	Sat May 21 12:04:03 1994
--- bsd.prog.mk	Sat May 21 12:02:47 1994
***************
*** 50,56 ****
  .endif

  .if defined(PROG)
! .if defined(SRCS)

  OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}

--- 50,58 ----
  .endif

  .if defined(PROG)
! .if !defined(SRCS)
! SRCS=	${PROG}.c
! .endif

  OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}

***************
*** 63,79 ****

  ${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${DPADD}
  	${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD}
- 
- .endif
- 
- .else
- 
- SRCS=	${PROG}.c
- 
- ${PROG}: ${LIBCRT0} ${SRCS} ${LIBC} ${DPADD}
- 	${CC} ${LDFLAGS} ${LDSTATIC} ${CFLAGS} -o ${.TARGET} ${.CURDIR}/${SRCS} ${LDADD}
- 
- MKDEP=	-p

  .endif

--- 65,70 ----


-- 
``Concealment is never as hard as people think, you          Luke Mewburn
  must understand that. It's action while hiding that's    <lm@rmit.edu.au>
  the hard part''
        -- Coyote, in Kim Stanley Robinson's `Green Mars'

------------------------------------------------------------------------------