Commit | Line | Data |
---|---|---|
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 |
7 | LIBC?= /lib/libc.a |
8 | LIBCOMPAT?= /usr/lib/libcompat.a | |
9 | LIBCURSES?= /usr/lib/libcurses.a | |
10 | LIBDBM?= /usr/lib/libdbm.a | |
11 | LIBDES?= /usr/lib/libdes.a | |
12 | LIBL?= /usr/lib/libl.a | |
13 | LIBKDB?= /usr/lib/libkdb.a | |
14 | LIBKRB?= /usr/lib/libkrb.a | |
15 | LIBM?= /usr/lib/libm.a | |
16 | LIBMP?= /usr/lib/libmp.a | |
17 | LIBPC?= /usr/lib/libpc.a | |
18 | LIBPLOT?= /usr/lib/libplot.a | |
19 | LIBRPC?= /usr/lib/sunrpc.a | |
20 | LIBTERM?= /usr/lib/libterm.a | |
21 | LIBUTIL?= /usr/lib/libutil.a | |
68cbfc75 | 22 | |
3a5e4842 | 23 | .if defined(PROG) |
9e327654 | 24 | .if defined(SRCS) |
272f5bac | 25 | |
3d68901b | 26 | OBJS+= ${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 | |
33 | SRCS= ${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) | |
43 | MAN1= ${PROG}.0 | |
44 | .endif | |
3a5e4842 | 45 | .endif |
3d68901b | 46 | MANALL= ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8} |
9e327654 | 47 | |
3d68901b KB |
48 | PROGSUBDIR: .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 |
62 | all: ${PROG} ${MANALL} PROGSUBDIR | |
9e327654 | 63 | |
3d68901b KB |
64 | .if !target(clean) |
65 | clean: PROGSUBDIR | |
66 | rm -f a.out [Ee]rrs mklog core ${PROG} ${OBJS} ${CLEANFILES} | |
67 | .endif | |
68cbfc75 | 68 | |
8d3c2d2e KB |
69 | .if !target(cleandir) |
70 | cleandir: 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) |
77 | depend: .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) | |
84 | beforeinstall: | |
85 | .endif | |
2cf63a09 | 86 | |
8d3c2d2e | 87 | realinstall: 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 |
95 | install: afterinstall PROGSUBDIR |
96 | afterinstall: realinstall maninstall | |
97 | .else | |
98 | install: PROGSUBDIR | |
8d3c2d2e KB |
99 | .endif |
100 | ||
101 | .if !target(lint) | |
102 | lint: ${SRCS} PROGSUBDIR | |
3d68901b | 103 | @${LINT} ${LINTFLAGS} ${CFLAGS} ${.ALLSRC} | more 2>&1 |
8d3c2d2e | 104 | .endif |
3d68901b | 105 | |
8d3c2d2e KB |
106 | .if !target(tags) |
107 | tags: ${SRCS} PROGSUBDIR | |
108 | ctags -f ${.CURDIR}/tags ${.ALLSRC} | |
109 | .endif | |
3d68901b KB |
110 | |
111 | .include <bsd.own.mk> |