Commit | Line | Data |
---|---|---|
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 | ||
8 | all: ${PROGC} ${PROGO} | |
9 | ||
10 | .if defined(PROGC) | |
11 | SRCS= ${PROGC}.c | |
12 | ||
13 | .if !defined(MAN1) | |
14 | MAN1= ${PROGC}.0 | |
15 | .endif | |
16 | ||
17 | ${PROGC}: ${SRCS} ${LIBC} ${SRCLIBS} | |
18 | ${CC} -o ${.TARGET} ${.ALLSRC} ${LDLIBS} | |
19 | ||
20 | depend: ${SRCS} | |
21 | mkdep -p ${CFLAGS} ${.ALLSRC} | |
22 | ||
23 | clean: | |
24 | rm -f core ${PROGC} | |
25 | .else | |
26 | OBJS= ${SRCS:.c=.o} | |
27 | ||
28 | .if !defined(MAN1) | |
29 | MAN1= ${PROGO}.0 | |
30 | .endif | |
31 | ||
32 | ${PROGO}: ${OBJS} ${LIBC} ${SRCLIBS} | |
33 | ${CC} -o ${.TARGET} ${OBJS} ${LDLIBS} | |
34 | ||
35 | {OBJS}: ${.PREFIX}.c | |
36 | ||
37 | depend: ${SRCS} | |
38 | mkdep ${CFLAGS} ${.ALLSRC} | |
39 | ||
40 | clean: | |
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 | |
48 | MANALL= ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8} | |
49 | ||
50 | cleandir: clean | |
51 | rm -f ${MANALL} ${TAGSFILE} ${DEPENDFILE} | |
52 | ||
53 | STRIP= -s | |
54 | BINMODE= 755 | |
55 | DEFOWN= bin | |
56 | DEFGRP= bin | |
57 | MANMODE= 444 | |
58 | ||
59 | install: ${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 | ||
95 | LINTFLAGS= -chapbx | |
96 | lint: ${SRCS} | |
97 | lint ${LINTFLAGS} ${CFLAGS} ${.ALLSRC} | |
98 | ||
99 | TAGSFILE= tags | |
100 | tags: ${SRCS} | |
101 | ctags ${.ALLSRC} | |
102 | ||
103 | .include <template.mk> | |
104 | ||
105 | .if exists(.depend) | |
106 | .include ".depend" | |
107 | .endif |