Home | History | Annotate | Line # | Download | only in mk
bsd.prog.mk revision 1.67
      1  1.67     mikel #	$NetBSD: bsd.prog.mk,v 1.67 1997/03/29 08:02:53 mikel 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.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.67     mikel .if !target(all)
     92   1.1       cgd .MAIN: all
     93  1.43       cgd all: ${PROG} _SUBDIRUSE
     94  1.67     mikel .endif
     95   1.1       cgd 
     96   1.1       cgd .if !target(clean)
     97  1.60       cgd cleanprog:
     98  1.53       cgd 	rm -f a.out [Ee]rrs mklog core *.core \
     99  1.53       cgd 	    ${PROG} ${OBJS} ${LOBJS} ${CLEANFILES}
    100   1.1       cgd 
    101  1.60       cgd clean: _SUBDIRUSE cleanprog
    102  1.60       cgd cleandir: _SUBDIRUSE cleanprog
    103  1.60       cgd .else
    104  1.43       cgd cleandir: _SUBDIRUSE clean
    105  1.60       cgd .endif
    106  1.59       cgd 
    107  1.59       cgd .if defined(SRCS)
    108  1.59       cgd afterdepend: .depend
    109  1.59       cgd 	@(TMP=/tmp/_depend$$$$; \
    110  1.59       cgd 	    sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.ln:/' \
    111  1.59       cgd 	      < .depend > $$TMP; \
    112  1.59       cgd 	    mv $$TMP .depend)
    113  1.59       cgd .endif
    114  1.27   mycroft 
    115   1.1       cgd .if !target(install)
    116   1.1       cgd .if !target(beforeinstall)
    117   1.1       cgd beforeinstall:
    118   1.1       cgd .endif
    119   1.1       cgd .if !target(afterinstall)
    120   1.1       cgd afterinstall:
    121   1.1       cgd .endif
    122   1.1       cgd 
    123  1.14   mycroft .if !target(realinstall)
    124  1.63  christos 
    125   1.1       cgd .if defined(PROG)
    126  1.63  christos PROGNAME?= ${PROG}
    127  1.63  christos proginstall:: ${DESTDIR}${BINDIR}/${PROGNAME}
    128  1.63  christos .if !defined(UPDATE)
    129  1.63  christos .PHONY: ${DESTDIR}${BINDIR}/${PROGNAME}
    130  1.63  christos .endif
    131  1.63  christos .if !defined(BUILD)
    132  1.63  christos ${DESTDIR}${BINDIR}/${PROGNAME}: .MADE
    133  1.63  christos .endif
    134  1.63  christos 
    135  1.63  christos ${DESTDIR}${BINDIR}/${PROGNAME}: ${PROG}
    136  1.56   thorpej 	${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
    137  1.63  christos 	    ${.ALLSRC} ${.TARGET}
    138  1.23   mycroft .endif
    139  1.23   mycroft 
    140  1.63  christos .if defined(SCRIPTS)
    141  1.65   mycroft SCRIPTSDIR?=${BINDIR}
    142  1.65   mycroft SCRIPTSOWN?=${BINOWN}
    143  1.65   mycroft SCRIPTSGRP?=${BINGRP}
    144  1.65   mycroft SCRIPTSMODE?=${BINMODE}
    145  1.63  christos .for S in ${SCRIPTS}
    146  1.65   mycroft SCRIPTSDIR_${S}?=${SCRIPTSDIR}
    147  1.65   mycroft SCRIPTSOWN_${S}?=${SCRIPTSOWN}
    148  1.65   mycroft SCRIPTSGRP_${S}?=${SCRIPTSGRP}
    149  1.65   mycroft SCRIPTSMODE_${S}?=${SCRIPTSMODE}
    150  1.63  christos .if defined(SCRIPTSNAME)
    151  1.63  christos SCRIPTSNAME_${S} ?= ${SCRIPTSNAME}
    152  1.63  christos .else
    153  1.63  christos SCRIPTSNAME_${S} ?= ${S:T:R}
    154  1.63  christos .endif
    155  1.65   mycroft SCRIPTSDIR_${S} ?= ${SCRIPTSDIR}
    156  1.65   mycroft proginstall:: ${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}}
    157  1.63  christos .if !defined(UPDATE)
    158  1.65   mycroft .PHONY: ${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}}
    159  1.63  christos .endif
    160  1.63  christos .if !defined(BUILD)
    161  1.65   mycroft ${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}}: .MADE
    162  1.63  christos .endif
    163  1.63  christos 
    164  1.65   mycroft ${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}}: ${S}
    165  1.65   mycroft 	${INSTALL} ${COPY} -o ${SCRIPTSOWN_${S}} -g ${SCRIPTSGRP_${S}} \
    166  1.65   mycroft 		-m ${SCRIPTSMODE_${S}} ${.ALLSRC} ${.TARGET}
    167  1.63  christos .endfor
    168  1.14   mycroft .endif
    169   1.1       cgd 
    170  1.63  christos .if target(proginstall)
    171  1.66  christos realinstall: proginstall filesinstall
    172  1.63  christos .else
    173  1.66  christos realinstall: filesinstall
    174  1.63  christos .endif
    175  1.63  christos .endif
    176  1.63  christos 
    177  1.63  christos install: ${MANINSTALL} _SUBDIRUSE linksinstall
    178  1.63  christos 
    179  1.63  christos ${MANINSTALL}: afterinstall
    180   1.1       cgd afterinstall: realinstall
    181   1.1       cgd realinstall: beforeinstall
    182   1.1       cgd .endif
    183   1.1       cgd 
    184   1.1       cgd .if !target(lint)
    185  1.52       cgd lint: ${LOBJS}
    186  1.52       cgd .if defined(LOBJS) && !empty(LOBJS)
    187  1.52       cgd 	@${LINT} ${LINTFLAGS} ${LDFLAGS:M-L*} ${LOBJS} ${LDADD}
    188   1.1       cgd .endif
    189   1.1       cgd .endif
    190   1.1       cgd 
    191   1.1       cgd .if !defined(NOMAN)
    192   1.1       cgd .include <bsd.man.mk>
    193  1.50       jtc .endif
    194  1.50       jtc 
    195  1.50       jtc .if !defined(NONLS)
    196  1.50       jtc .include <bsd.nls.mk>
    197   1.1       cgd .endif
    198  1.24   mycroft 
    199  1.24   mycroft .include <bsd.obj.mk>
    200  1.63  christos .include <bsd.links.mk>
    201  1.66  christos .include <bsd.files.mk>
    202  1.63  christos .include <bsd.inc.mk>
    203  1.26   mycroft .include <bsd.dep.mk>
    204  1.28   mycroft .include <bsd.subdir.mk>
    205  1.54  christos .include <bsd.sys.mk>
    206