PERFORCE change 231637 for review
Brooks Davis
brooks at FreeBSD.org
Fri Aug 2 03:47:06 UTC 2013
http://p4web.freebsd.org/@@231637?ac=10
Change 231637 by brooks at 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}
More information about the p4-projects
mailing list