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