Makefile revision 1.21
1#	$OpenBSD: Makefile,v 1.21 1997/08/06 09:40:10 deraadt Exp $
2#	$NetBSD: Makefile,v 1.25 1995/10/09 02:11:28 thorpej Exp $
3
4#
5# For more information on building in tricky environments, please see
6# the list of possible environment variables described in
7# /usr/share/mk/bsd.README.
8# 
9# Building recommendations:
10# 
11# 1) If at all possible, put this source tree in /usr/src.  If /usr/src
12# must be a symbolic link, setenv BSDSRCDIR to point to the real location.
13#
14# 2) It is also recommended that you compile with objects outside the
15# source tree. To do this, ensure /usr/obj exists or points to some
16# area of disk of sufficient size.  Then do "cd /usr/src; make obj".
17# This will make a symbolic link called "obj" in each directory, as
18# well as populate the /usr/obj properly with directories for the
19# objects.
20#
21# 3) If you are reasonably sure that things will compile OK, use the
22# "make build" target supplied here. Good luck.
23
24.include <bsd.own.mk>	# for NOMAN, if it's there.
25
26SUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share games
27SUBDIR+= gnu
28
29SUBDIR+= sys lkm
30
31.if (${KERBEROS} == "yes")
32SUBDIR+= kerberosIV
33.endif
34
35.if   make(clean) || make(cleandir) || make(obj)
36SUBDIR+= distrib
37.endif
38
39.if exists(regress)
40.ifmake !(install)
41SUBDIR+= regress
42.endif
43
44regression-tests:
45	@echo Running regression tests...
46	@(cd ${.CURDIR}/regress && ${MAKE} regress)
47.endif
48
49includes:
50	(cd ${.CURDIR}/include; ${MAKE} includes)	
51
52beforeinstall:
53.ifndef DESTDIR
54	(cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ distrib-dirs)
55.else
56	(cd ${.CURDIR}/etc && ${MAKE} distrib-dirs)
57.endif
58	(cd ${.CURDIR}/include; ${MAKE} includes)
59
60afterinstall:
61.ifndef NOMAN
62	(cd ${.CURDIR}/share/man && ${MAKE} makedb)
63.endif
64
65build:
66.ifdef GLOBAL_AUTOCONF_CACHE
67	rm -f ${GLOBAL_AUTOCONF_CACHE}
68.endif
69	(cd ${.CURDIR}/share/mk && ${MAKE} install)
70	(cd ${.CURDIR}/include; ${MAKE} includes)
71	${MAKE} cleandir
72	(cd ${.CURDIR}/lib && ${MAKE} depend && ${MAKE} && ${MAKE} install)
73	(cd ${.CURDIR}/gnu/lib && ${MAKE} depend && ${MAKE} && ${MAKE} install)
74.if (${MACHINE_ARCH} == "mips")
75	ldconfig
76.endif
77.if (${KERBEROS} == "yes")
78	(cd ${.CURDIR}/kerberosIV && ${MAKE} build)
79.endif
80	${MAKE} depend && ${MAKE} && ${MAKE} install
81
82.if !defined(TARGET)
83cross-tools:
84	echo "TARGET must be set"; exit 1
85.else
86cross-tools:	cross-helpers cross-includes cross-binutils cross-gcc
87
88CROSSDIR=	${DESTDIR}/usr/cross/${TARGET}
89
90cross-helpers:
91	-mkdir -p ${CROSSDIR}/usr/include
92	echo _MACHINE_ARCH | \
93	    cat ${.CURDIR}/sys/arch/${TARGET}/include/param.h - | \
94	    ${CPP} -E |sed -n '$$p' >${CROSSDIR}/TARGET_ARCH
95	eval `grep '^osr=' sys/conf/newvers.sh`; \
96	   sed "s/\$$/-unknown-openbsd$$osr/" ${CROSSDIR}/TARGET_ARCH > \
97	   ${CROSSDIR}/TARGET_CANON
98
99cross-includes:
100	${MAKE} MACHINE=${TARGET} MACHINE_ARCH=`cat ${CROSSDIR}/TARGET_ARCH` \
101	    DESTDIR=${CROSSDIR} includes
102
103cross-binutils:
104	-mkdir -p ${CROSSDIR}/usr/obj
105	export BSDSRCDIR=`pwd`; \
106	    (cd ${.CURDIR}/gnu/usr.bin/binutils; \
107	    BSDOBJDIR=${CROSSDIR}/usr/obj \
108	    MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
109	    ${MAKE} -f Makefile.bsd-wrapper obj); \
110	    (cd ${CROSSDIR}/usr/obj/gnu/usr.bin/binutils; \
111	    ${BSDSRCDIR}/gnu/usr.bin/binutils/configure \
112	    --prefix ${CROSSDIR}/usr \
113	    --target `cat ${CROSSDIR}/TARGET_CANON` && \
114	    ${MAKE} && ${MAKE} install)
115	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 755 \
116	    ${.CURDIR}/usr.bin/lorder/lorder.sh.gnm \
117	    ${CROSSDIR}/usr/bin/`cat ${CROSSDIR}/TARGET_CANON`-lorder
118
119cross-gcc:
120	-mkdir -p ${CROSSDIR}/usr/obj
121	(cd gnu/usr.bin/gcc; \
122	    BSDOBJDIR=${CROSSDIR}/usr/obj BSDSRCDIR=${.CURDIR} \
123	    MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
124	    ${MAKE} -f Makefile.bsd-wrapper obj)
125	(cd ${CROSSDIR}/usr/obj/gnu/usr.bin/gcc; \
126	    ${.CURDIR}/gnu/usr.bin/gcc/configure \
127	    --prefix ${CROSSDIR}/usr \
128	    --target `cat ${CROSSDIR}/TARGET_CANON` && \
129	    ${MAKE} BISON=yacc LANGUAGES=c \
130	    GCC_FOR_TARGET="./xgcc -B./ -I${CROSSDIR}/usr/include" && \
131	    ${MAKE} LANGUAGES=c install)
132.endif
133
134.include <bsd.subdir.mk>
135