Makefile revision 77031
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD: head/include/Makefile 77031 2001-05-23 09:42:29Z ru $
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 rpc
11FILES=	a.out.h ar.h assert.h bitstring.h ctype.h db.h dirent.h disktab.h \
12	dlfcn.h elf.h elf-hints.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	netconfig.h 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 wchar.h wctype.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
31MFILES=	float.h floatingpoint.h stdarg.h varargs.h
32
33# posix4/aio.h conflicts with dysons and isn't installed:
34PFILES=	mqueue.h sched.h semaphore.h # aio.h
35
36# Only for default SHARED=copies case
37SFILES=	soundcard.h joystick.h
38
39LFILES=	aio.h errno.h fcntl.h inttypes.h linker_set.h poll.h syslog.h \
40	termios.h ucontext.h
41
42LDIRS=	cam msdosfs net netatalk netatm netgraph netinet netinet6 \
43	netipx netkey netnatm netncp netns netsmb nfs ntfs nwfs pccard posix4 \
44	sys vm
45
46LNOHEADERDIRS=	fs isofs ufs dev
47
48LSUBDIRS=	cam/scsi dev/ppbus dev/usb dev/wi \
49	fs/fdesc fs/fifofs fs/nullfs fs/portal fs/procfs fs/smbfs \
50	fs/umapfs fs/union isofs/cd9660 ufs/ffs ufs/mfs ufs/ufs
51
52# Define SHARED to indicate whether you want symbolic links to the system
53# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
54# probably only useful for developers and should be avoided if you do not
55# wish to tie your /usr/include and /usr/src together.
56#SHARED=	symlinks
57SHARED?=	copies
58
59all:	osreldate.h
60
61osreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
62		${.CURDIR}/../sys/sys/param.h
63	@${ECHO} creating osreldate.h from newvers.sh
64	setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
65	. ${.CURDIR}/../sys/conf/newvers.sh;			\
66	echo "$$COPYRIGHT" > osreldate.h;			\
67	echo "#ifdef _KERNEL" >> osreldate.h;			\
68	echo '#error "osreldate.h must not be used in the kernel, use sys/param.h"' >> osreldate.h; \
69	echo "#else" >> osreldate.h;				\
70	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
71	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
72	echo "#endif" >> 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	${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} ${LNOHEADERDIRS} machine
100	if [ -h ${DESTDIR}/usr/include/$i ]; then \
101		rm -f ${DESTDIR}/usr/include/$i; \
102	fi
103.endfor
104	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
105		-p ${DESTDIR}/usr/include
106.for i in ${LDIRS} ${LSUBDIRS}
107	cd ${.CURDIR}/../sys; \
108		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
109		${DESTDIR}/usr/include/$i
110.endfor
111.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include)
112	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
113		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
114		${DESTDIR}/usr/include/machine
115.endif
116.for i in ${SFILES}
117	ln -sf ../sys/$i ${DESTDIR}/usr/include/machine/$i
118.endfor
119
120symlinks:
121	@${ECHO} "Setting up symlinks to kernel source tree..."
122.for i in ${LDIRS}
123	rm -rf ${DESTDIR}/usr/include/$i
124	ln -s ../../sys/$i ${DESTDIR}/usr/include/$i
125.endfor
126.for i in ${LNOHEADERDIRS}
127	rm -rf ${DESTDIR}/usr/include/$i
128	ln -s ../../sys/$i ${DESTDIR}/usr/include/$i
129.endfor
130	rm -rf ${DESTDIR}/usr/include/machine
131	ln -s ../../sys/${MACHINE_ARCH}/include ${DESTDIR}/usr/include/machine
132
133.include <bsd.prog.mk>
134