Makefile revision 60725
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD: head/include/Makefile 60725 2000-05-19 22:08:18Z peter $
3#
4# Doing a make install builds /usr/include
5#
6# The ``rm -rf''s used below are safe because rm doesn't follow symbolic
7# links.
8
9CLEANFILES= osreldate.h version vers.c
10SUBDIR= rpcsvc
11FILES=	a.out.h ar.h assert.h bitstring.h ctype.h db.h dirent.h disktab.h \
12	dlfcn.h elf.h err.h fnmatch.h fstab.h \
13	fts.h glob.h grp.h strhash.h histedit.h ieeefp.h iso646.h \
14	limits.h link.h locale.h malloc.h memory.h mpool.h \
15	ndbm.h netdb.h nl_types.h nlist.h objformat.h \
16	paths.h pthread.h pthread_np.h pwd.h \
17	ranlib.h regex.h regexp.h resolv.h rune.h runetype.h setjmp.h sgtty.h \
18	signal.h stab.h stddef.h stdio.h stdlib.h string.h stringlist.h \
19	strings.h struct.h sysexits.h tar.h time.h timers.h \
20	ttyent.h unistd.h utime.h utmp.h vis.h
21.if defined(WANT_CSRG_LIBM)
22FILES+=	math.h
23.endif
24
25ARPAFILES=	ftp.h inet.h nameser.h nameser_compat.h telnet.h tftp.h
26
27PROTOFILES=	dumprestore.h routed.h rwhod.h talkd.h timed.h
28
29RPCFILES=	auth.h auth_unix.h clnt.h pmap_clnt.h pmap_prot.h pmap_rmt.h \
30		rpc.h rpc_com.h rpc_msg.h svc.h svc_auth.h types.h xdr.h \
31		auth_des.h des.h des_crypt.h
32
33MFILES=	float.h floatingpoint.h stdarg.h varargs.h
34
35# posix4/aio.h conflicts with dysons and isn't installed:
36PFILES=	mqueue.h sched.h semaphore.h # aio.h
37
38# Only for default SHARED=copies case
39SFILES=	soundcard.h joystick.h
40
41LFILES=	aio.h errno.h fcntl.h inttypes.h linker_set.h \
42	poll.h syslog.h termios.h ucontext.h
43
44LDIRS=	cam msdosfs net netatalk netatm netgraph netinet netinet6 \
45	netipx netkey netncp netns nfs ntfs nwfs pccard posix4 sys vm
46
47LNOHEADERDIRS=	isofs ufs dev
48LSUBDIRS=	isofs/cd9660 ufs/ffs ufs/mfs ufs/ufs cam/scsi dev/ppbus dev/usb
49
50# For SHARED=symlinks, cam is a symlink, so cam/scsi is taken care of
51LSYMSUBDIRS=	isofs/cd9660 ufs/ffs ufs/mfs ufs/ufs dev/ppbus dev/usb
52
53# Define SHARED to indicate whether you want symbolic links to the system
54# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
55# probably only useful for developers and should be avoided if you do not
56# wish to tie your /usr/include and /usr/src together.
57#SHARED=	symlinks
58SHARED?=	copies
59
60all:	osreldate.h
61
62osreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
63		${.CURDIR}/../sys/sys/param.h
64	@${ECHO} creating osreldate.h from newvers.sh
65	setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
66	. ${.CURDIR}/../sys/conf/newvers.sh;			\
67	echo "$$COPYRIGHT" > osreldate.h;			\
68	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
69	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h
70
71beforeinstall: ${SHARED}
72	@rm -f ${DESTDIR}/usr/include/timepps.h
73	cd ${.CURDIR}; \
74		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
75		${FILES} ${DESTDIR}/usr/include
76	cd ${.CURDIR}/arpa; \
77		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
78		${ARPAFILES} ${DESTDIR}/usr/include/arpa
79	cd ${.CURDIR}/protocols; \
80		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
81		${PROTOFILES} ${DESTDIR}/usr/include/protocols
82	cd ${.CURDIR}/rpc; \
83		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
84		${RPCFILES} ${DESTDIR}/usr/include/rpc
85	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
86		${.OBJDIR}/osreldate.h \
87		${DESTDIR}/usr/include
88.for i in ${LFILES}
89	ln -sf sys/$i ${DESTDIR}/usr/include/$i
90.endfor
91.for i in ${MFILES}
92	ln -sf machine/$i ${DESTDIR}/usr/include/$i
93.endfor
94.for i in ${PFILES}
95	ln -sf posix4/$i ${DESTDIR}/usr/include/$i
96.endfor
97
98copies:
99.for i in ${LDIRS} ${LSYMSUBDIRS} machine
100	if [ -h ${DESTDIR}/usr/include/$i ]; then \
101		rm -f ${DESTDIR}/usr/include/$i; \
102	fi
103.endfor
104.for i in ${LNOHEADERDIRS}
105	rm -rf ${DESTDIR}/usr/include/$i
106.endfor
107	mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
108		-p ${DESTDIR}/usr/include
109.for i in ${LDIRS} ${LSUBDIRS}
110	cd ${.CURDIR}/../sys; \
111		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
112		${DESTDIR}/usr/include/$i
113.endfor
114.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include)
115	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
116		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
117		${DESTDIR}/usr/include/machine
118.endif
119.for i in ${SFILES}
120	ln -sf ../sys/$i ${DESTDIR}/usr/include/machine/$i
121.endfor
122
123symlinks:
124	@${ECHO} "Setting up symlinks to kernel source tree..."
125.for i in ${LDIRS}
126	rm -rf ${DESTDIR}/usr/include/$i
127	ln -s ../../sys/$i ${DESTDIR}/usr/include/$i
128.endfor
129.for i in ${LNOHEADERDIRS}
130	rm -rf ${DESTDIR}/usr/include/$i
131	mkdir ${DESTDIR}/usr/include/$i
132.endfor
133.for i in ${LSYMSUBDIRS}
134	ln -s ../../../sys/$i ${DESTDIR}/usr/include/$i
135.endfor
136	rm -rf ${DESTDIR}/usr/include/machine
137	ln -s ../../sys/${MACHINE_ARCH}/include ${DESTDIR}/usr/include/machine
138
139.include <bsd.prog.mk>
140