1 1.66 christos # $NetBSD: bsd.prog.mk,v 1.66 1997/03/27 17:33:37 christos Exp $ 2 1.44 cgd # @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 3 1.1 cgd 4 1.1 cgd .if exists(${.CURDIR}/../Makefile.inc) 5 1.1 cgd .include "${.CURDIR}/../Makefile.inc" 6 1.1 cgd .endif 7 1.48 mycroft 8 1.48 mycroft .include <bsd.own.mk> 9 1.1 cgd 10 1.18 mycroft .SUFFIXES: .out .o .c .cc .C .y .l .s .8 .7 .6 .5 .4 .3 .2 .1 .0 11 1.1 cgd 12 1.25 mycroft CFLAGS+= ${COPTS} 13 1.1 cgd 14 1.46 mycroft LIBCRT0?= ${DESTDIR}/usr/lib/crt0.o 15 1.46 mycroft LIBC?= ${DESTDIR}/usr/lib/libc.a 16 1.63 christos LIBC_PIC?= ${DESTDIR}/usr/lib/libc_pic.a 17 1.46 mycroft LIBCOMPAT?= ${DESTDIR}/usr/lib/libcompat.a 18 1.46 mycroft LIBCRYPT?= ${DESTDIR}/usr/lib/libcrypt.a 19 1.46 mycroft LIBCURSES?= ${DESTDIR}/usr/lib/libcurses.a 20 1.46 mycroft LIBDBM?= ${DESTDIR}/usr/lib/libdbm.a 21 1.46 mycroft LIBDES?= ${DESTDIR}/usr/lib/libdes.a 22 1.51 mycroft LIBEDIT?= ${DESTDIR}/usr/lib/libedit.a 23 1.46 mycroft LIBGCC?= ${DESTDIR}/usr/lib/libgcc.a 24 1.63 christos LIBGNUMALLOC?= ${DESTDIR}/usr/lib/libgnumalloc.a 25 1.46 mycroft LIBKDB?= ${DESTDIR}/usr/lib/libkdb.a 26 1.46 mycroft LIBKRB?= ${DESTDIR}/usr/lib/libkrb.a 27 1.46 mycroft LIBKVM?= ${DESTDIR}/usr/lib/libkvm.a 28 1.55 jtc LIBL?= ${DESTDIR}/usr/lib/libl.a 29 1.46 mycroft LIBM?= ${DESTDIR}/usr/lib/libm.a 30 1.46 mycroft LIBMP?= ${DESTDIR}/usr/lib/libmp.a 31 1.46 mycroft LIBPC?= ${DESTDIR}/usr/lib/libpc.a 32 1.58 mikel LIBPCAP?= ${DESTDIR}/usr/lib/libpcap.a 33 1.46 mycroft LIBPLOT?= ${DESTDIR}/usr/lib/libplot.a 34 1.46 mycroft LIBRESOLV?= ${DESTDIR}/usr/lib/libresolv.a 35 1.46 mycroft LIBRPCSVC?= ${DESTDIR}/usr/lib/librpcsvc.a 36 1.46 mycroft LIBSKEY?= ${DESTDIR}/usr/lib/libskey.a 37 1.46 mycroft LIBTERMCAP?= ${DESTDIR}/usr/lib/libtermcap.a 38 1.63 christos LIBTELNET?= ${DESTDIR}/usr/lib/libtelnet.a 39 1.46 mycroft LIBUTIL?= ${DESTDIR}/usr/lib/libutil.a 40 1.57 mrg LIBWRAP?= ${DESTDIR}/usr/lib/libwrap.a 41 1.55 jtc LIBY?= ${DESTDIR}/usr/lib/liby.a 42 1.57 mrg LIBZ?= ${DESTDIR}/usr/lib/libz.a 43 1.1 cgd 44 1.1 cgd .if defined(SHAREDSTRINGS) 45 1.1 cgd CLEANFILES+=strings 46 1.1 cgd .c.o: 47 1.1 cgd ${CC} -E ${CFLAGS} ${.IMPSRC} | xstr -c - 48 1.1 cgd @${CC} ${CFLAGS} -c x.c -o ${.TARGET} 49 1.1 cgd @rm -f x.c 50 1.18 mycroft 51 1.18 mycroft .cc.o: 52 1.18 mycroft ${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c - 53 1.18 mycroft @mv -f x.c x.cc 54 1.18 mycroft @${CXX} ${CXXFLAGS} -c x.cc -o ${.TARGET} 55 1.26 mycroft @rm -f x.cc 56 1.18 mycroft 57 1.18 mycroft .C.o: 58 1.18 mycroft ${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c - 59 1.18 mycroft @mv -f x.c x.C 60 1.18 mycroft @${CXX} ${CXXFLAGS} -c x.C -o ${.TARGET} 61 1.26 mycroft @rm -f x.C 62 1.1 cgd .endif 63 1.1 cgd 64 1.38 jtc 65 1.1 cgd .if defined(PROG) 66 1.40 cgd SRCS?= ${PROG}.c 67 1.45 cgd .if !empty(SRCS:N*.h:N*.sh) 68 1.52 cgd OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.o/g} 69 1.52 cgd LOBJS+= ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln} 70 1.45 cgd .endif 71 1.1 cgd 72 1.47 cgd .if defined(OBJS) && !empty(OBJS) 73 1.46 mycroft .if defined(DESTDIR) 74 1.4 nate 75 1.26 mycroft ${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${DPADD} 76 1.46 mycroft ${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} -nostdlib -L${DESTDIR}/usr/lib ${LIBCRT0} ${OBJS} ${LDADD} -lgcc -lc -lgcc 77 1.4 nate 78 1.46 mycroft .else 79 1.4 nate 80 1.26 mycroft ${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${DPADD} 81 1.32 cgd ${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD} 82 1.1 cgd 83 1.47 cgd .endif # defined(DESTDIR) 84 1.47 cgd .endif # defined(OBJS) && !empty(OBJS) 85 1.1 cgd 86 1.49 cgd .if !defined(MAN) 87 1.49 cgd MAN= ${PROG}.1 88 1.49 cgd .endif # !defined(MAN) 89 1.49 cgd .endif # defined(PROG) 90 1.11 mycroft 91 1.1 cgd .MAIN: all 92 1.43 cgd all: ${PROG} _SUBDIRUSE 93 1.1 cgd 94 1.1 cgd .if !target(clean) 95 1.60 cgd cleanprog: 96 1.53 cgd rm -f a.out [Ee]rrs mklog core *.core \ 97 1.53 cgd ${PROG} ${OBJS} ${LOBJS} ${CLEANFILES} 98 1.1 cgd 99 1.60 cgd clean: _SUBDIRUSE cleanprog 100 1.60 cgd cleandir: _SUBDIRUSE cleanprog 101 1.60 cgd .else 102 1.43 cgd cleandir: _SUBDIRUSE clean 103 1.60 cgd .endif 104 1.59 cgd 105 1.59 cgd .if defined(SRCS) 106 1.59 cgd afterdepend: .depend 107 1.59 cgd @(TMP=/tmp/_depend$$$$; \ 108 1.59 cgd sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.ln:/' \ 109 1.59 cgd < .depend > $$TMP; \ 110 1.59 cgd mv $$TMP .depend) 111 1.59 cgd .endif 112 1.27 mycroft 113 1.1 cgd .if !target(install) 114 1.1 cgd .if !target(beforeinstall) 115 1.1 cgd beforeinstall: 116 1.1 cgd .endif 117 1.1 cgd .if !target(afterinstall) 118 1.1 cgd afterinstall: 119 1.1 cgd .endif 120 1.1 cgd 121 1.14 mycroft .if !target(realinstall) 122 1.63 christos 123 1.1 cgd .if defined(PROG) 124 1.63 christos PROGNAME?= ${PROG} 125 1.63 christos proginstall:: ${DESTDIR}${BINDIR}/${PROGNAME} 126 1.63 christos .if !defined(UPDATE) 127 1.63 christos .PHONY: ${DESTDIR}${BINDIR}/${PROGNAME} 128 1.63 christos .endif 129 1.63 christos .if !defined(BUILD) 130 1.63 christos ${DESTDIR}${BINDIR}/${PROGNAME}: .MADE 131 1.63 christos .endif 132 1.63 christos 133 1.63 christos ${DESTDIR}${BINDIR}/${PROGNAME}: ${PROG} 134 1.56 thorpej ${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 135 1.63 christos ${.ALLSRC} ${.TARGET} 136 1.23 mycroft .endif 137 1.23 mycroft 138 1.63 christos .if defined(SCRIPTS) 139 1.65 mycroft SCRIPTSDIR?=${BINDIR} 140 1.65 mycroft SCRIPTSOWN?=${BINOWN} 141 1.65 mycroft SCRIPTSGRP?=${BINGRP} 142 1.65 mycroft SCRIPTSMODE?=${BINMODE} 143 1.63 christos .for S in ${SCRIPTS} 144 1.65 mycroft SCRIPTSDIR_${S}?=${SCRIPTSDIR} 145 1.65 mycroft SCRIPTSOWN_${S}?=${SCRIPTSOWN} 146 1.65 mycroft SCRIPTSGRP_${S}?=${SCRIPTSGRP} 147 1.65 mycroft SCRIPTSMODE_${S}?=${SCRIPTSMODE} 148 1.63 christos .if defined(SCRIPTSNAME) 149 1.63 christos SCRIPTSNAME_${S} ?= ${SCRIPTSNAME} 150 1.63 christos .else 151 1.63 christos SCRIPTSNAME_${S} ?= ${S:T:R} 152 1.63 christos .endif 153 1.65 mycroft SCRIPTSDIR_${S} ?= ${SCRIPTSDIR} 154 1.65 mycroft proginstall:: ${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}} 155 1.63 christos .if !defined(UPDATE) 156 1.65 mycroft .PHONY: ${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}} 157 1.63 christos .endif 158 1.63 christos .if !defined(BUILD) 159 1.65 mycroft ${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}}: .MADE 160 1.63 christos .endif 161 1.63 christos 162 1.65 mycroft ${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}}: ${S} 163 1.65 mycroft ${INSTALL} ${COPY} -o ${SCRIPTSOWN_${S}} -g ${SCRIPTSGRP_${S}} \ 164 1.65 mycroft -m ${SCRIPTSMODE_${S}} ${.ALLSRC} ${.TARGET} 165 1.63 christos .endfor 166 1.14 mycroft .endif 167 1.1 cgd 168 1.63 christos .if target(proginstall) 169 1.66 christos realinstall: proginstall filesinstall 170 1.63 christos .else 171 1.66 christos realinstall: filesinstall 172 1.63 christos .endif 173 1.63 christos .endif 174 1.63 christos 175 1.63 christos install: ${MANINSTALL} _SUBDIRUSE linksinstall 176 1.63 christos 177 1.63 christos ${MANINSTALL}: afterinstall 178 1.1 cgd afterinstall: realinstall 179 1.1 cgd realinstall: beforeinstall 180 1.1 cgd .endif 181 1.1 cgd 182 1.1 cgd .if !target(lint) 183 1.52 cgd lint: ${LOBJS} 184 1.52 cgd .if defined(LOBJS) && !empty(LOBJS) 185 1.52 cgd @${LINT} ${LINTFLAGS} ${LDFLAGS:M-L*} ${LOBJS} ${LDADD} 186 1.1 cgd .endif 187 1.1 cgd .endif 188 1.1 cgd 189 1.1 cgd .if !defined(NOMAN) 190 1.1 cgd .include <bsd.man.mk> 191 1.50 jtc .endif 192 1.50 jtc 193 1.50 jtc .if !defined(NONLS) 194 1.50 jtc .include <bsd.nls.mk> 195 1.1 cgd .endif 196 1.24 mycroft 197 1.24 mycroft .include <bsd.obj.mk> 198 1.63 christos .include <bsd.links.mk> 199 1.66 christos .include <bsd.files.mk> 200 1.63 christos .include <bsd.inc.mk> 201 1.26 mycroft .include <bsd.dep.mk> 202 1.28 mycroft .include <bsd.subdir.mk> 203 1.54 christos .include <bsd.sys.mk> 204