Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Aug 2013 03:47:05 GMT
From:      Brooks Davis <brooks@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 231637 for review
Message-ID:  <201308020347.r723l5Z9029594@skunkworks.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@231637?ac=10

Change 231637 by brooks@brooks_zenith on 2013/08/02 03:46:08

	Simplify the generation of make rules and reduce duplicate code.

Affected files ...

.. //depot/projects/ctsrd/tesla/src/share/mk/bsd.prog.mk#8 edit

Differences ...

==== //depot/projects/ctsrd/tesla/src/share/mk/bsd.prog.mk#8 (text+ko) ====

@@ -42,39 +42,17 @@
 
 .if defined(PROG)
 PROGNAME?=	${PROG}
-.if defined(SRCS)
 
-OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}
-
-.if target(beforelinking)
-beforelinking: ${OBJS}
-${PROG}: beforelinking
-.endif
-${PROG}: ${OBJS}
-.if defined(PROG_CXX)
-	${CXX} ${CXXFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
-.else
-	${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
-.endif
-.if ${MK_CTF} != "no"
-	${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS}
-.endif
-
-.else	# !defined(SRCS)
-
-.if !target(${PROG})
+.if !defined(SRCS) && !target(${PROG})
 .if defined(PROG_CXX)
 SRCS=	${PROG}.cc
 .else
 SRCS=	${PROG}.c
 .endif
+.endif
 
-# Always make an intermediate object file because:
-# - it saves time rebuilding when only the library has changed
-# - the name of the object gets put into the executable symbol table instead of
-#   the name of a variable temporary object.
-# - it's useful to keep objects around for crunching.
-OBJS+=	${PROG}.o
+.if defined(SRCS) && !empty(SRCS)
+OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}
 
 .if target(beforelinking)
 beforelinking: ${OBJS}
@@ -91,8 +69,6 @@
 .endif
 .endif
 
-.endif # !defined(SRCS)
-
 # XXX: forced assignment due to make not figuring out how to make things
 # from generated .c files (which are added to SRCS later).
 CSRC_OBJS:=	${SRCS:M*.c:R:S/$/.object/:N.object}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308020347.r723l5Z9029594>