blob: 7998afd7a8fcbcfdb950ee2270d8891399c3552e (
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
|
# from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91
# $Id: bsd.prog.mk,v 1.57 1997/12/17 13:40:00 bde Exp $
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
# Default executable format
BINFORMAT?= aout
.SUFFIXES: .out .o .c .cc .cxx .C .y .l .s .S
CFLAGS+=${COPTS} ${DEBUG_FLAGS}
.if defined(DESTDIR)
CFLAGS+= -I${DESTDIR}/usr/include
CXXINCLUDES+= -I${DESTDIR}/usr/include/g++
.endif
.if !defined(DEBUG_FLAGS)
STRIP?= -s
.endif
.if defined(NOSHARED) && ( ${NOSHARED} != "no" && ${NOSHARED} != "NO" )
LDFLAGS+= -static
.endif
.if defined(PROG)
.if defined(SRCS)
DPSRCS+= ${SRCS:M*.h}
OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
${PROG}: ${DPSRCS} ${OBJS}
${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDDESTDIR} ${LDADD}
.else !defined(SRCS)
SRCS= ${PROG}.c
# 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}: ${DPSRCS} ${OBJS}
${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDDESTDIR} ${LDADD}
.endif
.if !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \
!defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \
!defined(MAN7) && !defined(MAN8) && !defined(NOMAN)
MAN1= ${PROG}.1
.endif
.endif
.MAIN: all
all: objwarn ${PROG} all-man _SUBDIR
.if !target(clean)
clean: _SUBDIR
.if defined(PROG) && !empty(PROG) || defined(OBJS) && !empty(OBJS) || \
defined(CLEANFILES) && !empty(CLEANFILES)
rm -f ${PROG} ${OBJS} ${CLEANFILES}
.endif
rm -f ${PROG} ${OBJS} ${CLEANFILES}
.if defined(CLEANDIRS) && !empty(CLEANDIRS)
rm -rf ${CLEANDIRS}
.endif
.endif
.if defined(PROG) && !defined(NOEXTRADEPEND)
_EXTRADEPEND:
.if ${BINFORMAT} == aout
echo ${PROG}: `${CC} -Wl,-f ${CFLAGS} ${LDFLAGS} ${LDDESTDIR} \
${LDADD:S/^/-Wl,/}` >> ${DEPENDFILE}
.else
.if defined(DPADD) && !empty(DPADD)
echo ${PROG}: ${DPADD} >> ${DEPENDFILE}
.endif
.endif
.endif
.if !target(install)
.if !target(beforeinstall)
beforeinstall:
.endif
realinstall: beforeinstall
.if defined(PROG)
${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
${INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}
.endif
.if defined(HIDEGAME)
(cd ${DESTDIR}/usr/games; rm -f ${PROG}; ln -s dm ${PROG}; \
chown games:bin ${PROG})
.endif
.if defined(LINKS) && !empty(LINKS)
@set ${LINKS}; \
while test $$# -ge 2; do \
l=${DESTDIR}$$1; \
shift; \
t=${DESTDIR}$$1; \
shift; \
${ECHO} $$t -\> $$l; \
rm -f $$t; \
ln ${LN_FLAGS} $$l $$t; \
done; true
.endif
install: afterinstall _SUBDIR
.if !defined(NOMAN)
afterinstall: realinstall maninstall
.else
afterinstall: realinstall
.endif
.endif
DISTRIBUTION?= bin
.if !target(distribute)
distribute: _SUBDIR
.for dist in ${DISTRIBUTION}
cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${dist} SHARED=copies
.endfor
.endif
.if !target(lint)
lint: ${SRCS} _SUBDIR
.if defined(PROG)
@${LINT} ${LINTFLAGS} ${CFLAGS} ${.ALLSRC} | more 2>&1
.endif
.endif
.if defined(NOTAGS)
tags:
.endif
.if !target(tags)
tags: ${SRCS} _SUBDIR
.if defined(PROG)
@cd ${.CURDIR} && gtags ${GTAGSFLAGS}
.if defined(HTML)
@cd ${.CURDIR} && htags ${HTAGSFLAGS}
.endif
.endif
.endif
.if !defined(NOMAN)
.include <bsd.man.mk>
.elif !target(maninstall)
maninstall:
all-man:
.endif
.if ${BINFORMAT} != aout || make(checkdpadd)
.include <bsd.libnames.mk>
.endif
.include <bsd.dep.mk>
.include <bsd.obj.mk>
|