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