Makefile revision 72171
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD: head/include/Makefile 72171 2001-02-08 17:14:28Z phantom $
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 \
14	hesiod.h histedit.h ieeefp.h ifaddrs.h iso646.h langinfo.h \
15	libgen.h limits.h link.h locale.h malloc.h memory.h mpool.h \
16	ndbm.h netdb.h nl_types.h nlist.h nsswitch.h objformat.h \
17	paths.h pthread.h pthread_np.h pwd.h \
18	ranlib.h regex.h regexp.h resolv.h rune.h runetype.h \
19	search.h setjmp.h sgtty.h \
20	signal.h stab.h stdbool.h stddef.h stdio.h stdlib.h string.h \
21	stringlist.h strings.h sysexits.h tar.h time.h timers.h \
22	ttyent.h unistd.h utime.h utmp.h vis.h
23.if defined(WANT_CSRG_LIBM)
24FILES+=	math.h
25.endif
26
27ARPAFILES=	ftp.h inet.h nameser.h nameser_compat.h telnet.h tftp.h
28
29PROTOFILES=	dumprestore.h routed.h rwhod.h talkd.h timed.h
30
31RPCFILES=	auth.h auth_unix.h clnt.h pmap_clnt.h pmap_prot.h pmap_rmt.h \
32		rpc.h rpc_com.h rpc_msg.h svc.h svc_auth.h types.h xdr.h \
33		auth_des.h des.h des_crypt.h
34
35MFILES=	float.h floatingpoint.h stdarg.h varargs.h
36
37# posix4/aio.h conflicts with dysons and isn't installed:
38PFILES=	mqueue.h sched.h semaphore.h # aio.h
39
40# Only for default SHARED=copies case
41SFILES=	soundcard.h joystick.h
42
43LFILES=	aio.h errno.h fcntl.h inttypes.h linker_set.h poll.h syslog.h \
44	termios.h ucontext.h
45
46LDIRS=	cam msdosfs net netatalk netatm netgraph netinet netinet6 \
47	netipx netkey netnatm netncp netns nfs ntfs nwfs pccard posix4 sys vm
48
49LNOHEADERDIRS=	isofs ufs dev
50LSUBDIRS=	isofs/cd9660 ufs/ffs ufs/mfs ufs/ufs cam/scsi dev/ppbus \
51	dev/usb dev/wi
52
53# For SHARED=symlinks, cam is a symlink, so cam/scsi is taken care of
54LSYMSUBDIRS=	isofs/cd9660 ufs/ffs ufs/mfs ufs/ufs dev/ppbus dev/usb dev/wi
55
56# Define SHARED to indicate whether you want symbolic links to the system
57# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
58# probably only useful for developers and should be avoided if you do not
59# wish to tie your /usr/include and /usr/src together.
60#SHARED=	symlinks
61SHARED?=	copies
62
63all:	osreldate.h
64
65osreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
66		${.CURDIR}/../sys/sys/param.h
67	@${ECHO} creating osreldate.h from newvers.sh
68	setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
69	. ${.CURDIR}/../sys/conf/newvers.sh;			\
70	echo "$$COPYRIGHT" > osreldate.h;			\
71	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
72	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h
73
74beforeinstall: ${SHARED}
75	@rm -f ${DESTDIR}/usr/include/timepps.h
76	cd ${.CURDIR}; \
77		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
78		${FILES} ${DESTDIR}/usr/include
79	cd ${.CURDIR}/arpa; \
80		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
81		${ARPAFILES} ${DESTDIR}/usr/include/arpa
82	cd ${.CURDIR}/protocols; \
83		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
84		${PROTOFILES} ${DESTDIR}/usr/include/protocols
85	cd ${.CURDIR}/rpc; \
86		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
87		${RPCFILES} ${DESTDIR}/usr/include/rpc
88	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
89		${.OBJDIR}/osreldate.h \
90		${DESTDIR}/usr/include
91.for i in ${LFILES}
92	ln -sf sys/$i ${DESTDIR}/usr/include/$i
93.endfor
94.for i in ${MFILES}
95	ln -sf machine/$i ${DESTDIR}/usr/include/$i
96.endfor
97.for i in ${PFILES}
98	ln -sf posix4/$i ${DESTDIR}/usr/include/$i
99.endfor
100
101copies:
102.for i in ${LDIRS} ${LSYMSUBDIRS} machine
103	if [ -h ${DESTDIR}/usr/include/$i ]; then \
104		rm -f ${DESTDIR}/usr/include/$i; \
105	fi
106.endfor
107	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -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