1 1.75 mycroft # $NetBSD: bsd.prog.mk,v 1.75 1997/05/07 17:06:28 mycroft 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.46 mycroft .if defined(DESTDIR) 90 1.4 nate 91 1.69 thorpej ${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD} 92 1.69 thorpej ${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} -nostdlib -L${DESTDIR}/usr/lib ${LIBCRT0} ${LIBCRTBEGIN} ${OBJS} ${LDADD} -lgcc -lc -lgcc ${LIBCRTEND} 93 1.4 nate 94 1.46 mycroft .else 95 1.4 nate 96 1.69 thorpej ${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD} 97 1.32 cgd ${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD} 98 1.1 cgd 99 1.47 cgd .endif # defined(DESTDIR) 100 1.47 cgd .endif # defined(OBJS) && !empty(OBJS) 101 1.1 cgd 102 1.49 cgd .if !defined(MAN) 103 1.49 cgd MAN= ${PROG}.1 104 1.49 cgd .endif # !defined(MAN) 105 1.49 cgd .endif # defined(PROG) 106 1.11 mycroft 107 1.75 mycroft all: ${PROG} 108 1.1 cgd 109 1.60 cgd cleanprog: 110 1.53 cgd rm -f a.out [Ee]rrs mklog core *.core \ 111 1.53 cgd ${PROG} ${OBJS} ${LOBJS} ${CLEANFILES} 112 1.1 cgd 113 1.59 cgd .if defined(SRCS) 114 1.59 cgd afterdepend: .depend 115 1.59 cgd @(TMP=/tmp/_depend$$$$; \ 116 1.59 cgd sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.ln:/' \ 117 1.59 cgd < .depend > $$TMP; \ 118 1.59 cgd mv $$TMP .depend) 119 1.59 cgd .endif 120 1.27 mycroft 121 1.74 mycroft .if defined(PROG) && !target(proginstall) 122 1.63 christos PROGNAME?= ${PROG} 123 1.63 christos proginstall:: ${DESTDIR}${BINDIR}/${PROGNAME} 124 1.63 christos .if !defined(UPDATE) 125 1.63 christos .PHONY: ${DESTDIR}${BINDIR}/${PROGNAME} 126 1.63 christos .endif 127 1.63 christos .if !defined(BUILD) 128 1.63 christos ${DESTDIR}${BINDIR}/${PROGNAME}: .MADE 129 1.63 christos .endif 130 1.63 christos 131 1.72 mycroft .PRECIOUS: ${DESTDIR}${BINDIR}/${PROGNAME} 132 1.63 christos ${DESTDIR}${BINDIR}/${PROGNAME}: ${PROG} 133 1.69 thorpej ${INSTALL} ${COPY} ${STRIPFLAG} -o ${BINOWN} -g ${BINGRP} \ 134 1.69 thorpej -m ${BINMODE} ${.ALLSRC} ${.TARGET} 135 1.23 mycroft .endif 136 1.23 mycroft 137 1.74 mycroft .if !target(proginstall) 138 1.74 mycroft proginstall:: 139 1.74 mycroft .endif 140 1.74 mycroft 141 1.74 mycroft .if defined(SCRIPTS) && !target(scriptsinstall) 142 1.65 mycroft SCRIPTSDIR?=${BINDIR} 143 1.65 mycroft SCRIPTSOWN?=${BINOWN} 144 1.65 mycroft SCRIPTSGRP?=${BINGRP} 145 1.65 mycroft SCRIPTSMODE?=${BINMODE} 146 1.63 christos .for S in ${SCRIPTS} 147 1.65 mycroft SCRIPTSDIR_${S}?=${SCRIPTSDIR} 148 1.65 mycroft SCRIPTSOWN_${S}?=${SCRIPTSOWN} 149 1.65 mycroft SCRIPTSGRP_${S}?=${SCRIPTSGRP} 150 1.65 mycroft SCRIPTSMODE_${S}?=${SCRIPTSMODE} 151 1.63 christos .if defined(SCRIPTSNAME) 152 1.63 christos SCRIPTSNAME_${S} ?= ${SCRIPTSNAME} 153 1.63 christos .else 154 1.63 christos SCRIPTSNAME_${S} ?= ${S:T:R} 155 1.63 christos .endif 156 1.65 mycroft SCRIPTSDIR_${S} ?= ${SCRIPTSDIR} 157 1.74 mycroft scriptsinstall:: ${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}} 158 1.63 christos .if !defined(UPDATE) 159 1.65 mycroft .PHONY: ${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}} 160 1.63 christos .endif 161 1.63 christos .if !defined(BUILD) 162 1.65 mycroft ${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}}: .MADE 163 1.63 christos .endif 164 1.63 christos 165 1.72 mycroft .PRECIOUS: ${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}} 166 1.65 mycroft ${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}}: ${S} 167 1.65 mycroft ${INSTALL} ${COPY} -o ${SCRIPTSOWN_${S}} -g ${SCRIPTSGRP_${S}} \ 168 1.65 mycroft -m ${SCRIPTSMODE_${S}} ${.ALLSRC} ${.TARGET} 169 1.63 christos .endfor 170 1.14 mycroft .endif 171 1.1 cgd 172 1.74 mycroft .if !target(scriptsinstall) 173 1.74 mycroft scriptsinstall:: 174 1.1 cgd .endif 175 1.1 cgd 176 1.1 cgd .if !target(lint) 177 1.52 cgd lint: ${LOBJS} 178 1.52 cgd .if defined(LOBJS) && !empty(LOBJS) 179 1.52 cgd @${LINT} ${LINTFLAGS} ${LDFLAGS:M-L*} ${LOBJS} ${LDADD} 180 1.1 cgd .endif 181 1.1 cgd .endif 182 1.1 cgd 183 1.1 cgd .if !defined(NOMAN) 184 1.1 cgd .include <bsd.man.mk> 185 1.50 jtc .endif 186 1.50 jtc 187 1.50 jtc .if !defined(NONLS) 188 1.50 jtc .include <bsd.nls.mk> 189 1.1 cgd .endif 190 1.24 mycroft 191 1.24 mycroft .include <bsd.obj.mk> 192 1.63 christos .include <bsd.links.mk> 193 1.66 christos .include <bsd.files.mk> 194 1.63 christos .include <bsd.inc.mk> 195 1.26 mycroft .include <bsd.dep.mk> 196 1.28 mycroft .include <bsd.subdir.mk> 197 1.54 christos .include <bsd.sys.mk> 198