clean up suffix list, don't need bsd.global.mk
[unix-history] / usr / src / share / mk / bsd.prog.mk
CommitLineData
3d68901b 1.include <bsd.global.mk>
272f5bac 2
3d68901b
KB
3.if exists(${.CURDIR}/../Makefile.inc)
4.include "${.CURDIR}/../Makefile.inc"
2cf63a09 5.endif
68cbfc75 6
3d68901b
KB
7LIBC?= /lib/libc.a
8LIBCOMPAT?= /usr/lib/libcompat.a
9LIBCURSES?= /usr/lib/libcurses.a
10LIBDBM?= /usr/lib/libdbm.a
11LIBDES?= /usr/lib/libdes.a
12LIBL?= /usr/lib/libl.a
13LIBKDB?= /usr/lib/libkdb.a
14LIBKRB?= /usr/lib/libkrb.a
15LIBM?= /usr/lib/libm.a
16LIBMP?= /usr/lib/libmp.a
17LIBPC?= /usr/lib/libpc.a
18LIBPLOT?= /usr/lib/libplot.a
19LIBRPC?= /usr/lib/sunrpc.a
20LIBTERM?= /usr/lib/libterm.a
21LIBUTIL?= /usr/lib/libutil.a
68cbfc75 22
3a5e4842 23.if defined(PROG)
9e327654 24.if defined(SRCS)
272f5bac 25
3d68901b 26OBJS+= ${SRCS:.c=.o}
2cf63a09 27
3d68901b
KB
28${PROG}: ${OBJS} ${LIBC} ${DPADD}
29 ${CC} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
68cbfc75 30
3a5e4842 31.else defined(PROG)
9e327654
KB
32
33SRCS= ${PROG}.c
34
3d68901b
KB
35${PROG}: ${SRCS} ${LIBC} ${DPADD}
36 ${CC} ${CFLAGS} -o ${.TARGET} ${.CURDIR}/${SRCS} ${LDADD}
9e327654 37
3d68901b 38.endif
272f5bac 39
3d68901b
KB
40.if !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \
41 !defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \
42 !defined(MAN7) && !defined(MAN8) && !defined(NOMAN)
43MAN1= ${PROG}.0
44.endif
3a5e4842 45.endif
3d68901b 46MANALL= ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8}
9e327654 47
3d68901b
KB
48PROGSUBDIR: .USE
49.if defined(SUBDIR) && !empty(SUBDIR)
50 @for entry in ${SUBDIR}; do \
8d3c2d2e 51 (echo "===> ${PROG}/$$entry"; \
3d68901b
KB
52 if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \
53 cd ${.CURDIR}/$${entry}.${MACHINE}; \
54 else \
55 cd ${.CURDIR}/$${entry}; \
56 fi; \
57 ${MAKE} ${.TARGET}) \
58 done
59.endif
68cbfc75 60
3d68901b
KB
61.MAIN: all
62all: ${PROG} ${MANALL} PROGSUBDIR
9e327654 63
3d68901b
KB
64.if !target(clean)
65clean: PROGSUBDIR
66 rm -f a.out [Ee]rrs mklog core ${PROG} ${OBJS} ${CLEANFILES}
67.endif
68cbfc75 68
8d3c2d2e
KB
69.if !target(cleandir)
70cleandir: PROGSUBDIR
3d68901b
KB
71 rm -f a.out [Ee]rrs mklog core ${PROG} ${OBJS} ${CLEANFILES}
72 rm -f .depend ${.CURDIR}/tags ${MANALL}
8d3c2d2e 73.endif
9e327654 74
3d68901b 75# some of the rules involve .h sources, so remove them from mkdep line
8d3c2d2e
KB
76.if !target(depend)
77depend: .depend
78.depend: ${SRCS} PROGSUBDIR
3d68901b 79 mkdep ${CFLAGS:M-[ID]*} ${.ALLSRC:M*.c}
8d3c2d2e
KB
80.endif
81
82.if !target(install)
83.if !target(beforeinstall)
84beforeinstall:
85.endif
2cf63a09 86
8d3c2d2e 87realinstall: beforeinstall PROGSUBDIR
2cf63a09 88 install ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
9e327654 89 ${PROG} ${DESTDIR}${BINDIR}
3d68901b
KB
90.if defined(HIDEGAME)
91 (cd ${DESTDIR}/usr/games; rm -f ${PROG}; ln -s dm ${PROG}; \
92 chown games.bin ${PROG})
2cf63a09 93.endif
3d68901b 94
3a5e4842
KB
95install: afterinstall PROGSUBDIR
96afterinstall: realinstall maninstall
97.else
98install: PROGSUBDIR
8d3c2d2e
KB
99.endif
100
101.if !target(lint)
102lint: ${SRCS} PROGSUBDIR
3d68901b 103 @${LINT} ${LINTFLAGS} ${CFLAGS} ${.ALLSRC} | more 2>&1
8d3c2d2e 104.endif
3d68901b 105
8d3c2d2e
KB
106.if !target(tags)
107tags: ${SRCS} PROGSUBDIR
108 ctags -f ${.CURDIR}/tags ${.ALLSRC}
109.endif
3d68901b
KB
110
111.include <bsd.own.mk>