[BACK]Return to bsd.prog.mk CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / share / mk

File: [cvs.NetBSD.org] / src / share / mk / bsd.prog.mk (download)

Revision 1.26, Sun Aug 15 20:42:43 1993 UTC (23 years, 1 month ago) by mycroft
Branch: MAIN
Changes since 1.25: +14 -53 lines

Move man rules to sys.mk.
Use bsd.subdir.mk for building subdirectories.
Don't forget to remove x.cc and x.C when using SHAREDSTRINGS.
Make ${PROG} always depend on ${LIBCRT0}.
Don't duplicate code between cleandir and clean.
Move tags target to bsd.dep.mk.
Move STRIP to bsd.own.mk.
Remove redundant definitions of {BIN,MAN}{DIR,GRP,OWN,MODE}.
Move {LIB,DOC}{DIR,GRP,OWN,MODE} defaults to bsd.own.mk.

#	from: @(#)bsd.prog.mk	5.26 (Berkeley) 6/25/91
#	$Id: bsd.prog.mk,v 1.26 1993/08/15 20:42:43 mycroft Exp $

.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"

.SUFFIXES: .out .o .c .cc .C .y .l .s .8 .7 .6 .5 .4 .3 .2 .1 .0


LIBCRT0?=	/usr/lib/crt0.o
LIBC?=		/usr/lib/libc.a
LIBCOMPAT?=	/usr/lib/libcompat.a
LIBCRYPT?=	/usr/lib/libcrypt.a
LIBCURSES?=	/usr/lib/libcurses.a
LIBDBM?=	/usr/lib/libdbm.a
LIBDES?=	/usr/lib/libdes.a
LIBL?=		/usr/lib/libl.a
LIBKDB?=	/usr/lib/libkdb.a
LIBKRB?=	/usr/lib/libkrb.a
LIBM?=		/usr/lib/libm.a
LIBMP?=		/usr/lib/libmp.a
LIBPC?=		/usr/lib/libpc.a
LIBPLOT?=	/usr/lib/libplot.a
LIBRESOLV?=	/usr/lib/libresolv.a
LIBRPC?=	/usr/lib/librpc.a
LIBRPCSVC?=	/usr/lib/librpcsvc.a
LIBTERM?=	/usr/lib/libterm.a
LIBUTIL?=	/usr/lib/libutil.a

.if defined(SHAREDSTRINGS)
	${CC} -E ${CFLAGS} ${.IMPSRC} | xstr -c -
	@${CC} ${CFLAGS} -c x.c -o ${.TARGET}
	@rm -f x.c

	${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c -
	@mv -f x.c x.cc
	@${CXX} ${CXXFLAGS} -c x.cc -o ${.TARGET}
	@rm -f x.cc

	${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c -
	@mv -f x.c x.C
	@${CXX} ${CXXFLAGS} -c x.C -o ${.TARGET}
	@rm -f x.C

.if defined(PROG)
.if defined(SRCS)

OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}

.if defined(LDONLY)


.else defined(LDONLY)

	${CC} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}







.if	!defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \
	!defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \
	!defined(MAN7) && !defined(MAN8)
MAN1=	${PROG}.0

.MAIN: all
all: ${PROG}

.if !target(clean)
	rm -f a.out [Ee]rrs mklog core ${PROG} ${OBJS} ${CLEANFILES}

.if !target(install)
.if !target(beforeinstall)
.if defined(DESTDIR) || defined(BINDIR)
	@install -d -o root -g wheel -m 755 ${DESTDIR}${BINDIR}
.if !target(afterinstall)

.if !target(realinstall)
.if defined(PROG)
	install ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
.if defined(HIDEGAME)
	(cd ${DESTDIR}/usr/games; rm -f ${PROG}; ln -s dm ${PROG}; \
	    chown games.bin ${PROG})

install: maninstall
.if defined(LINKS) && !empty(LINKS)
	@set ${LINKS}; \
	while test $$# -ge 2; do \
		l=${DESTDIR}$$1; \
		shift; \
		t=${DESTDIR}$$1; \
		shift; \
		echo $$t -\> $$l; \
		rm -f $$t; \
		ln $$l $$t; \
	done; true

maninstall: afterinstall
afterinstall: realinstall
realinstall: beforeinstall

.if !target(lint)
lint: ${SRCS}
.if defined(PROG)
	@${LINT} ${LINTFLAGS} ${CFLAGS} ${.ALLSRC} | more 2>&1

cleandir: clean

.if !defined(NOMAN)
.include <bsd.man.mk>

.include <bsd.obj.mk>
.include <bsd.dep.mk>
.include <bsd.subdir.mk>