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