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