date and time created 89/09/21 21:45:10 by bostic
[unix-history] / usr / src / share / mk / bsd.prog.mk
CommitLineData
272f5bac
KB
1# user defines:
2# SRCS list of source files
3# PROGC program consisting of a single .c module
4# PROGO program consisting of multiple .c modules
5# SRCLIBS list of libraries program depends on
6# LDLIBS list of libraries for loader
7
8all: ${PROGC} ${PROGO}
9
10.if defined(PROGC)
11SRCS= ${PROGC}.c
12
13.if !defined(MAN1)
14MAN1= ${PROGC}.0
15.endif
16
17${PROGC}: ${SRCS} ${LIBC} ${SRCLIBS}
18 ${CC} -o ${.TARGET} ${.ALLSRC} ${LDLIBS}
19
20depend: ${SRCS}
21 mkdep -p ${CFLAGS} ${.ALLSRC}
22
23clean:
24 rm -f core ${PROGC}
25.else
26OBJS= ${SRCS:.c=.o}
27
28.if !defined(MAN1)
29MAN1= ${PROGO}.0
30.endif
31
32${PROGO}: ${OBJS} ${LIBC} ${SRCLIBS}
33 ${CC} -o ${.TARGET} ${OBJS} ${LDLIBS}
34
35{OBJS}: ${.PREFIX}.c
36
37depend: ${SRCS}
38 mkdep ${CFLAGS} ${.ALLSRC}
39
40clean:
41 rm -f ${OBJS} core ${PROGO}
42.endif
43
44# user defines:
45# MAN1 list of man targets for section 1
46# ...
47# MAN8 list of man targets for section 8
48MANALL= ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8}
49
50cleandir: clean
51 rm -f ${MANALL} ${TAGSFILE} ${DEPENDFILE}
52
53STRIP= -s
54BINMODE= 755
55DEFOWN= bin
56DEFGRP= bin
57MANMODE= 444
58
59install: ${MANALL}
60 install ${STRIP} -o ${DEFOWN} -g ${DEFGRP} -m ${BINMODE} \
61 ${PROGC} ${PROGO} ${DESTDIR}/${DIR}
62.if defined(MAN1)
63 install -c -o ${DEFOWN} -g ${DEFGRP} -m ${MANMODE} ${MAN1} \
64 ${DESTDIR}/usr/cat1
65.endif
66.if defined(MAN2)
67 install -c -o ${DEFOWN} -g ${DEFGRP} -m ${MANMODE} ${MAN2} \
68 ${DESTDIR}/usr/cat2
69.endif
70.if defined(MAN3)
71 install -c -o ${DEFOWN} -g ${DEFGRP} -m ${MANMODE} ${MAN3} \
72 ${DESTDIR}/usr/cat3
73.endif
74.if defined(MAN4)
75 install -c -o ${DEFOWN} -g ${DEFGRP} -m ${MANMODE} ${MAN4} \
76 ${DESTDIR}/usr/cat4
77.endif
78.if defined(MAN5)
79 install -c -o ${DEFOWN} -g ${DEFGRP} -m ${MANMODE} ${MAN5} \
80 ${DESTDIR}/usr/cat5
81.endif
82.if defined(MAN6)
83 install -c -o ${DEFOWN} -g ${DEFGRP} -m ${MANMODE} ${MAN6} \
84 ${DESTDIR}/usr/cat6
85.endif
86.if defined(MAN7)
87 install -c -o ${DEFOWN} -g ${DEFGRP} -m ${MANMODE} ${MAN7} \
88 ${DESTDIR}/usr/cat7
89.endif
90.if defined(MAN8)
91 install -c -o ${DEFOWN} -g ${DEFGRP} -m ${MANMODE} ${MAN8} \
92 ${DESTDIR}/usr/cat8
93.endif
94
95LINTFLAGS= -chapbx
96lint: ${SRCS}
97 lint ${LINTFLAGS} ${CFLAGS} ${.ALLSRC}
98
99TAGSFILE= tags
100tags: ${SRCS}
101 ctags ${.ALLSRC}
102
103.include <template.mk>
104
105.if exists(.depend)
106.include ".depend"
107.endif