blob: f655c6ec3bc77b97de7db859e71c7e1781adf5f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
|
# from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91
# $FreeBSD$
.include <bsd.init.mk>
.SUFFIXES: .out .o .c .cc .cpp .cxx .C .m .y .l .s .S .asm
CFLAGS+=${COPTS} ${DEBUG_FLAGS}
.if !defined(DEBUG_FLAGS)
STRIP?= -s
.endif
.if defined(NOSHARED) && ( ${NOSHARED} != "no" && ${NOSHARED} != "NO" )
LDFLAGS+= -static
.endif
.if defined(PROG_CXX)
PROG= ${PROG_CXX}
.endif
.if defined(PROG)
.if defined(SRCS)
# If there are Objective C sources, link with Objective C libraries.
.if ${SRCS:M*.m} != ""
OBJCLIBS?= -lobjc
LDADD+= ${OBJCLIBS}
.endif
OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
${PROG}: ${OBJS}
.if defined(PROG_CXX)
${CXX} ${CXXFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
.else
${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
.endif
.else !defined(SRCS)
.if !target(${PROG})
.if defined(PROG_CXX)
SRCS= ${PROG}.cc
.else
SRCS= ${PROG}.c
.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
${PROG}: ${OBJS}
.if defined(PROG_CXX)
${CXX} ${CXXFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
.else
${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
.endif
.endif
.endif
.if !defined(NOMAN) && !defined(MAN) && \
!defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \
!defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \
!defined(MAN7) && !defined(MAN8) && !defined(MAN9) && \
!defined(MAN1aout)
MAN= ${PROG}.1
MAN1= ${MAN}
.endif
.endif
all: objwarn ${PROG} ${SCRIPTS} ${FILES}
.if !defined(NOMAN)
all: all-man
.endif
CLEANFILES+= ${PROG} ${OBJS}
.if defined(PROG)
_EXTRADEPEND:
.if ${OBJFORMAT} == aout
echo ${PROG}: `${CC} -Wl,-f ${CFLAGS} ${LDFLAGS} \
${LDADD:S/^/-Wl,/}` >> ${DEPENDFILE}
.else
echo ${PROG}: ${LIBC} ${DPADD} >> ${DEPENDFILE}
.if defined(PROG_CXX)
echo ${PROG}: ${LIBSTDCPLUSPLUS} >> ${DEPENDFILE}
.endif
.endif
.endif
.if !target(install)
.if !target(beforeinstall)
beforeinstall:
.endif
_INSTALLFLAGS:= ${INSTALLFLAGS}
.for ie in ${INSTALLFLAGS_EDIT}
_INSTALLFLAGS:= ${_INSTALLFLAGS${ie}}
.endfor
realinstall: beforeinstall
realinstall: _proginstall
_proginstall:
.if defined(PROG)
.if defined(PROGNAME)
${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}/${PROGNAME}
.else
${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}
.endif
.endif
.if defined(HIDEGAME)
(cd ${DESTDIR}${ORIGBINDIR}; ln -fs dm ${PROG}; \
chown -h ${BINOWN}:${ORIGBINGRP} ${PROG})
.endif
realinstall:
.if defined(LINKS) && !empty(LINKS)
@set ${LINKS}; \
while test $$# -ge 2; do \
l=${DESTDIR}$$1; \
shift; \
t=${DESTDIR}$$1; \
shift; \
${ECHO} $$t -\> $$l; \
ln -f $$l $$t; \
done; true
.endif
.if defined(SYMLINKS) && !empty(SYMLINKS)
@set ${SYMLINKS}; \
while test $$# -ge 2; do \
l=$$1; \
shift; \
t=${DESTDIR}$$1; \
shift; \
${ECHO} $$t -\> $$l; \
ln -fs $$l $$t; \
done; true
.endif
.if defined(SCRIPTS) && !empty(SCRIPTS)
realinstall: _scriptsinstall
SCRIPTSDIR?= ${BINDIR}
SCRIPTSOWN?= ${BINOWN}
SCRIPTSGRP?= ${BINGRP}
SCRIPTSMODE?= ${BINMODE}
.for script in ${SCRIPTS}
.if defined(SCRIPTSNAME)
SCRIPTSNAME_${script:T}?= ${SCRIPTSNAME}
.else
SCRIPTSNAME_${script:T}?= ${script:T:R}
.endif
SCRIPTSDIR_${script:T}?= ${SCRIPTSDIR}
SCRIPTSOWN_${script:T}?= ${SCRIPTSOWN}
SCRIPTSGRP_${script:T}?= ${SCRIPTSGRP}
SCRIPTSMODE_${script:T}?= ${SCRIPTSMODE}
_scriptsinstall: _SCRIPTSINS_${script:T}
_SCRIPTSINS_${script:T}: ${script}
${INSTALL} ${COPY} -o ${SCRIPTSOWN_${.ALLSRC:T}} \
-g ${SCRIPTSGRP_${.ALLSRC:T}} -m ${SCRIPTSMODE_${.ALLSRC:T}} \
${.ALLSRC} \
${DESTDIR}${SCRIPTSDIR_${.ALLSRC:T}}/${SCRIPTSNAME_${.ALLSRC:T}}
.endfor
.endif
.if defined(FILES) && !empty(FILES)
realinstall: _filesinstall
FILESDIR?= ${BINDIR}
FILESOWN?= ${SHAREOWN}
FILESGRP?= ${SHAREGRP}
FILESMODE?= ${SHAREMODE}
.for file in ${FILES}
.if defined(FILESNAME)
FILESNAME_${file:T}?= ${FILESNAME}
.else
FILESNAME_${file:T}?= ${file:T}
.endif
FILESDIR_${file:T}?= ${FILESDIR}
FILESOWN_${file:T}?= ${FILESOWN}
FILESGRP_${file:T}?= ${FILESGRP}
FILESMODE_${file:T}?= ${FILESMODE}
_filesinstall: _FILESINS_${file:T}
_FILESINS_${file:T}: ${file}
${INSTALL} ${COPY} -o ${FILESOWN_${.ALLSRC:T}} \
-g ${FILESGRP_${.ALLSRC:T}} -m ${FILESMODE_${.ALLSRC:T}} \
${.ALLSRC} \
${DESTDIR}${FILESDIR_${.ALLSRC:T}}/${FILESNAME_${.ALLSRC:T}}
.endfor
.endif
install: afterinstall
afterinstall: realinstall
.if !defined(NOMAN)
afterinstall: maninstall
.endif
.endif
.if !target(lint)
lint: ${SRCS}
.if defined(PROG)
${LINT} ${LINTFLAGS} ${CFLAGS:M-[DIU]*} ${.ALLSRC} | more 2>&1
.endif
.endif
.if defined(NOTAGS)
tags:
.endif
.if !target(tags)
tags: ${SRCS}
.if defined(PROG)
@cd ${.CURDIR} && gtags ${GTAGSFLAGS} ${.OBJDIR}
.if defined(HTML)
@cd ${.CURDIR} && htags ${HTAGSFLAGS} -d ${.OBJDIR} ${.OBJDIR}
.endif
.endif
.endif
.if !defined(NOMAN)
.include <bsd.man.mk>
.endif
.if ${OBJFORMAT} != aout || make(checkdpadd) || defined(NEED_LIBNAMES)
.include <bsd.libnames.mk>
.endif
.include <bsd.dep.mk>
.if defined(PROG) && !exists(${.OBJDIR}/${DEPENDFILE})
${OBJS}: ${SRCS:M*.h}
.endif
.include <bsd.obj.mk>
.include <bsd.sys.mk>
|