Deleted Added
sdiff udiff text old ( 248753 ) new ( 251512 )
full compact
1# from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91
2# $FreeBSD: head/share/mk/bsd.prog.mk 251512 2013-06-07 21:40:02Z emaste $
3
4.include <bsd.init.mk>
5
6.SUFFIXES: .out .o .c .cc .cpp .cxx .C .m .y .l .ln .s .S .asm
7
8# XXX The use of COPTS in modern makefiles is discouraged.
9.if defined(COPTS)
10CFLAGS+=${COPTS}

--- 8 unchanged lines hidden (view full) ---

19CFLAGS+=${DEBUG_FLAGS}
20CXXFLAGS+=${DEBUG_FLAGS}
21
22.if ${MK_CTF} != "no" && ${DEBUG_FLAGS:M-g} != ""
23CTFFLAGS+= -g
24.endif
25.endif
26
27.if defined(PROG_CXX)
28PROG= ${PROG_CXX}
29.endif
30
31.if defined(PROG) && target(${PROG})
32MK_DEBUG_FILES= no
33.elif !empty(LDFLAGS:M-Wl,*--oformat,*) || !empty(LDFLAGS:M-static)
34MK_DEBUG_FILES= no
35.endif
36
37.if defined(CRUNCH_CFLAGS)
38CFLAGS+=${CRUNCH_CFLAGS}
39.else
40.if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \
41 empty(DEBUG_FLAGS:M-gdwarf-*)
42CFLAGS+= -g
43CTFFLAGS+= -g
44.endif
45.endif
46
47.if !defined(DEBUG_FLAGS)
48STRIP?= -s
49.endif
50
51.if defined(NO_SHARED) && (${NO_SHARED} != "no" && ${NO_SHARED} != "NO")
52LDFLAGS+= -static
53.endif
54
55.if ${MK_DEBUG_FILES} != "no"
56PROG_FULL=${PROG}.full
57# Use ${DEBUGDIR} for base system debug files, else .debug subdirectory
58.if defined(BINDIR) && (\
59 ${BINDIR} == "/bin" ||\
60 ${BINDIR} == "/libexec" ||\
61 ${BINDIR} == "/sbin" ||\
62 ${BINDIR:C%/usr/(bin|bsdinstall|games|libexec|lpr|sendmail|sm.bin|sbin)(/.*)?%/usr/bin%} == "/usr/bin"\
63 )
64DEBUGFILEDIR= ${DEBUGDIR}${BINDIR}
65.else
66DEBUGFILEDIR?= ${BINDIR}/.debug
67DEBUGMKDIR=
68.endif
69.else
70PROG_FULL= ${PROG}
71.endif
72
73.if defined(PROG)
74PROGNAME?= ${PROG}
75
76.if defined(SRCS)
77
78OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
79
80.if target(beforelinking)
81beforelinking: ${OBJS}
82${PROG_FULL}: beforelinking
83.endif
84${PROG_FULL}: ${OBJS}
85.if defined(PROG_CXX)
86 ${CXX} ${CXXFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
87.else
88 ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
89.endif
90.if ${MK_CTF} != "no"
91 ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS}
92.endif

--- 11 unchanged lines hidden (view full) ---

104# - it saves time rebuilding when only the library has changed
105# - the name of the object gets put into the executable symbol table instead of
106# the name of a variable temporary object.
107# - it's useful to keep objects around for crunching.
108OBJS+= ${PROG}.o
109
110.if target(beforelinking)
111beforelinking: ${OBJS}
112${PROG_FULL}: beforelinking
113.endif
114${PROG_FULL}: ${OBJS}
115.if defined(PROG_CXX)
116 ${CXX} ${CXXFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
117.else
118 ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
119.endif
120.if ${MK_CTF} != "no"
121 ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS}
122.endif
123.endif # !target(${PROG})
124
125.endif # !defined(SRCS)
126
127.if ${MK_DEBUG_FILES} != "no"
128${PROG}: ${PROG_FULL} ${PROGNAME}.debug
129 ${OBJCOPY} --strip-debug --add-gnu-debuglink=${PROGNAME}.debug \
130 ${PROG_FULL} ${.TARGET}
131
132${PROGNAME}.debug: ${PROG_FULL}
133 ${OBJCOPY} --only-keep-debug ${PROG_FULL} ${.TARGET}
134.endif
135
136.if ${MK_MAN} != "no" && !defined(MAN) && \
137 !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \
138 !defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \
139 !defined(MAN7) && !defined(MAN8) && !defined(MAN9)
140MAN= ${PROG}.1
141MAN1= ${MAN}
142.endif
143.endif # defined(PROG)
144
145all: objwarn ${PROG} ${SCRIPTS}
146.if ${MK_MAN} != "no"
147all: _manpages
148.endif
149
150.if defined(PROG)
151CLEANFILES+= ${PROG}
152.if ${MK_DEBUG_FILES} != "no"
153CLEANFILES+= ${PROG_FULL} ${PROGNAME}.debug
154.endif
155.endif
156
157.if defined(OBJS)
158CLEANFILES+= ${OBJS}
159.endif
160
161.include <bsd.libnames.mk>
162
163.if defined(PROG)

--- 30 unchanged lines hidden (view full) ---

194
195.if !target(realinstall) && !defined(INTERNALPROG)
196realinstall: _proginstall
197.ORDER: beforeinstall _proginstall
198_proginstall:
199.if defined(PROG)
200 ${INSTALL} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
201 ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}/${PROGNAME}
202.if ${MK_DEBUG_FILES} != "no"
203.if defined(DEBUGMKDIR)
204 ${INSTALL} -T debug -d ${DESTDIR}${DEBUGFILEDIR}
205.endif
206 ${INSTALL} -T debug -o ${BINOWN} -g ${BINGRP} -m ${DEBUGMODE} \
207 ${PROGNAME}.debug ${DESTDIR}${DEBUGFILEDIR}/${PROGNAME}.debug
208.endif
209.endif
210.endif # !target(realinstall)
211
212.if defined(SCRIPTS) && !empty(SCRIPTS)
213realinstall: _scriptsinstall
214.ORDER: beforeinstall _scriptsinstall
215
216SCRIPTSDIR?= ${BINDIR}
217SCRIPTSOWN?= ${BINOWN}

--- 60 unchanged lines hidden ---