Home | History | Annotate | Line # | Download | only in mk
bsd.prog.mk revision 1.57
      1  1.57       mrg #	$NetBSD: bsd.prog.mk,v 1.57 1996/11/26 17:37:39 mrg 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.46   mycroft LIBCOMPAT?=	${DESTDIR}/usr/lib/libcompat.a
     17  1.46   mycroft LIBCRYPT?=	${DESTDIR}/usr/lib/libcrypt.a
     18  1.46   mycroft LIBCURSES?=	${DESTDIR}/usr/lib/libcurses.a
     19  1.46   mycroft LIBDBM?=	${DESTDIR}/usr/lib/libdbm.a
     20  1.46   mycroft LIBDES?=	${DESTDIR}/usr/lib/libdes.a
     21  1.51   mycroft LIBEDIT?=	${DESTDIR}/usr/lib/libedit.a
     22  1.46   mycroft LIBGCC?=	${DESTDIR}/usr/lib/libgcc.a
     23  1.46   mycroft LIBKDB?=	${DESTDIR}/usr/lib/libkdb.a
     24  1.46   mycroft LIBKRB?=	${DESTDIR}/usr/lib/libkrb.a
     25  1.46   mycroft LIBKVM?=	${DESTDIR}/usr/lib/libkvm.a
     26  1.55       jtc LIBL?=		${DESTDIR}/usr/lib/libl.a
     27  1.46   mycroft LIBM?=		${DESTDIR}/usr/lib/libm.a
     28  1.46   mycroft LIBMP?=		${DESTDIR}/usr/lib/libmp.a
     29  1.46   mycroft LIBPC?=		${DESTDIR}/usr/lib/libpc.a
     30  1.46   mycroft LIBPLOT?=	${DESTDIR}/usr/lib/libplot.a
     31  1.46   mycroft LIBRESOLV?=	${DESTDIR}/usr/lib/libresolv.a
     32  1.46   mycroft LIBRPCSVC?=	${DESTDIR}/usr/lib/librpcsvc.a
     33  1.46   mycroft LIBSKEY?=	${DESTDIR}/usr/lib/libskey.a
     34  1.46   mycroft LIBTERMCAP?=	${DESTDIR}/usr/lib/libtermcap.a
     35  1.46   mycroft LIBUTIL?=	${DESTDIR}/usr/lib/libutil.a
     36  1.57       mrg LIBWRAP?=	${DESTDIR}/usr/lib/libwrap.a
     37  1.55       jtc LIBY?=		${DESTDIR}/usr/lib/liby.a
     38  1.57       mrg LIBZ?=		${DESTDIR}/usr/lib/libz.a
     39   1.1       cgd 
     40   1.1       cgd .if defined(SHAREDSTRINGS)
     41   1.1       cgd CLEANFILES+=strings
     42   1.1       cgd .c.o:
     43   1.1       cgd 	${CC} -E ${CFLAGS} ${.IMPSRC} | xstr -c -
     44   1.1       cgd 	@${CC} ${CFLAGS} -c x.c -o ${.TARGET}
     45   1.1       cgd 	@rm -f x.c
     46  1.18   mycroft 
     47  1.18   mycroft .cc.o:
     48  1.18   mycroft 	${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c -
     49  1.18   mycroft 	@mv -f x.c x.cc
     50  1.18   mycroft 	@${CXX} ${CXXFLAGS} -c x.cc -o ${.TARGET}
     51  1.26   mycroft 	@rm -f x.cc
     52  1.18   mycroft 
     53  1.18   mycroft .C.o:
     54  1.18   mycroft 	${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c -
     55  1.18   mycroft 	@mv -f x.c x.C
     56  1.18   mycroft 	@${CXX} ${CXXFLAGS} -c x.C -o ${.TARGET}
     57  1.26   mycroft 	@rm -f x.C
     58   1.1       cgd .endif
     59   1.1       cgd 
     60  1.38       jtc 
     61   1.1       cgd .if defined(PROG)
     62  1.40       cgd SRCS?=	${PROG}.c
     63  1.45       cgd .if !empty(SRCS:N*.h:N*.sh)
     64  1.52       cgd OBJS+=	${SRCS:N*.h:N*.sh:R:S/$/.o/g}
     65  1.52       cgd LOBJS+=	${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
     66  1.45       cgd .endif
     67   1.1       cgd 
     68  1.47       cgd .if defined(OBJS) && !empty(OBJS)
     69  1.46   mycroft .if defined(DESTDIR)
     70   1.4      nate 
     71  1.26   mycroft ${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${DPADD}
     72  1.46   mycroft 	${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} -nostdlib -L${DESTDIR}/usr/lib ${LIBCRT0} ${OBJS} ${LDADD} -lgcc -lc -lgcc
     73   1.4      nate 
     74  1.46   mycroft .else
     75   1.4      nate 
     76  1.26   mycroft ${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${DPADD}
     77  1.32       cgd 	${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD}
     78   1.1       cgd 
     79  1.47       cgd .endif	# defined(DESTDIR)
     80  1.47       cgd .endif	# defined(OBJS) && !empty(OBJS)
     81   1.1       cgd 
     82  1.49       cgd .if	!defined(MAN)
     83  1.49       cgd MAN=	${PROG}.1
     84  1.49       cgd .endif	# !defined(MAN)
     85  1.49       cgd .endif	# defined(PROG)
     86  1.11   mycroft 
     87   1.1       cgd .MAIN: all
     88  1.43       cgd all: ${PROG} _SUBDIRUSE
     89   1.1       cgd 
     90   1.1       cgd .if !target(clean)
     91  1.43       cgd clean: _SUBDIRUSE
     92  1.53       cgd 	rm -f a.out [Ee]rrs mklog core *.core \
     93  1.53       cgd 	    ${PROG} ${OBJS} ${LOBJS} ${CLEANFILES}
     94   1.1       cgd .endif
     95   1.1       cgd 
     96  1.43       cgd cleandir: _SUBDIRUSE clean
     97  1.27   mycroft 
     98   1.1       cgd .if !target(install)
     99   1.1       cgd .if !target(beforeinstall)
    100   1.1       cgd beforeinstall:
    101   1.1       cgd .endif
    102   1.1       cgd .if !target(afterinstall)
    103   1.1       cgd afterinstall:
    104   1.1       cgd .endif
    105   1.1       cgd 
    106  1.14   mycroft .if !target(realinstall)
    107  1.26   mycroft realinstall:
    108   1.1       cgd .if defined(PROG)
    109  1.56   thorpej 	${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
    110   1.1       cgd 	    ${PROG} ${DESTDIR}${BINDIR}
    111   1.1       cgd .endif
    112   1.1       cgd .if defined(HIDEGAME)
    113  1.41       cgd 	(cd ${DESTDIR}/usr/games; rm -f ${PROG}; ln -s dm ${PROG})
    114   1.1       cgd .endif
    115  1.23   mycroft .endif
    116  1.23   mycroft 
    117  1.29   mycroft install: maninstall _SUBDIRUSE
    118   1.1       cgd .if defined(LINKS) && !empty(LINKS)
    119   1.1       cgd 	@set ${LINKS}; \
    120   1.1       cgd 	while test $$# -ge 2; do \
    121   1.1       cgd 		l=${DESTDIR}$$1; \
    122   1.1       cgd 		shift; \
    123   1.1       cgd 		t=${DESTDIR}$$1; \
    124   1.1       cgd 		shift; \
    125   1.1       cgd 		echo $$t -\> $$l; \
    126   1.1       cgd 		rm -f $$t; \
    127   1.1       cgd 		ln $$l $$t; \
    128   1.1       cgd 	done; true
    129  1.14   mycroft .endif
    130   1.1       cgd 
    131   1.1       cgd maninstall: afterinstall
    132   1.1       cgd afterinstall: realinstall
    133   1.1       cgd realinstall: beforeinstall
    134   1.1       cgd .endif
    135   1.1       cgd 
    136   1.1       cgd .if !target(lint)
    137  1.52       cgd lint: ${LOBJS}
    138  1.52       cgd .if defined(LOBJS) && !empty(LOBJS)
    139  1.52       cgd 	@${LINT} ${LINTFLAGS} ${LDFLAGS:M-L*} ${LOBJS} ${LDADD}
    140   1.1       cgd .endif
    141   1.1       cgd .endif
    142   1.1       cgd 
    143   1.1       cgd .if !defined(NOMAN)
    144   1.1       cgd .include <bsd.man.mk>
    145  1.50       jtc .endif
    146  1.50       jtc 
    147  1.50       jtc .if !defined(NONLS)
    148  1.50       jtc .include <bsd.nls.mk>
    149   1.1       cgd .endif
    150  1.24   mycroft 
    151  1.24   mycroft .include <bsd.obj.mk>
    152  1.26   mycroft .include <bsd.dep.mk>
    153  1.28   mycroft .include <bsd.subdir.mk>
    154  1.54  christos .include <bsd.sys.mk>
    155