Makefile revision 77857
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD: head/include/Makefile 77857 2001-06-07 05:04:53Z jlemon $
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 net netatalk netatm netgraph netinet netinet6 \
43	netipx netkey netnatm netncp netns netsmb nfs pccard posix4 \
44	sys vm
45
46LNOHEADERDIRS=	fs isofs ufs dev
47
48LSUBDIRS=	cam/scsi dev/ic dev/ppbus dev/usb dev/wi \
49	fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs fs/nwfs fs/portalfs \
50	fs/procfs fs/smbfs fs/umapfs fs/unionfs isofs/cd9660 \
51	ufs/ffs ufs/ufs
52
53# For SHARED=symlinks, cam is a symlink, so cam/scsi is taken care of
54LSYMSUBDIRS=	${LSUBDIRS:Ncam/scsi}
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 "#ifdef _KERNEL" >> osreldate.h;			\
72	echo '#error "osreldate.h must not be used in the kernel, use sys/param.h"' >> osreldate.h; \
73	echo "#else" >> osreldate.h;				\
74	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
75	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
76	echo "#endif" >> osreldate.h
77
78beforeinstall: ${SHARED}
79	@rm -f ${DESTDIR}/usr/include/timepps.h
80	cd ${.CURDIR}; \
81		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
82		${FILES} ${DESTDIR}/usr/include
83	cd ${.CURDIR}/arpa; \
84		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
85		${ARPAFILES} ${DESTDIR}/usr/include/arpa
86	cd ${.CURDIR}/protocols; \
87		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
88		${PROTOFILES} ${DESTDIR}/usr/include/protocols
89	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
90		${.OBJDIR}/osreldate.h \
91		${DESTDIR}/usr/include
92.for i in ${LFILES}
93	ln -sf sys/$i ${DESTDIR}/usr/include/$i
94.endfor
95.for i in ${MFILES}
96	ln -sf machine/$i ${DESTDIR}/usr/include/$i
97.endfor
98.for i in ${PFILES}
99	ln -sf posix4/$i ${DESTDIR}/usr/include/$i
100.endfor
101
102copies:
103.for i in ${LDIRS} ${LSYMSUBDIRS} machine
104	if [ -h ${DESTDIR}/usr/include/$i ]; then \
105		rm -f ${DESTDIR}/usr/include/$i; \
106	fi
107.endfor
108	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
109		-p ${DESTDIR}/usr/include
110.for i in ${LDIRS} ${LSUBDIRS}
111	cd ${.CURDIR}/../sys; \
112		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
113		${DESTDIR}/usr/include/$i
114.endfor
115.if exists(${.CURDIR}/../sys/contrib/ipfilter/netinet)
116	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
117		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
118		${DESTDIR}/usr/include/netinet
119.endif
120.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include)
121	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
122		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
123		${DESTDIR}/usr/include/machine
124.endif
125.for i in ${SFILES}
126	ln -sf ../sys/$i ${DESTDIR}/usr/include/machine/$i
127.endfor
128
129symlinks:
130	@${ECHO} "Setting up symlinks to kernel source tree..."
131.for i in ${LDIRS}
132	rm -rf ${DESTDIR}/usr/include/$i
133	ln -s ../../sys/$i ${DESTDIR}/usr/include/$i
134.endfor
135.for i in ${LNOHEADERDIRS}
136	rm -rf ${DESTDIR}/usr/include/$i
137	mkdir ${DESTDIR}/usr/include/$i
138.endfor
139.for i in ${LSYMSUBDIRS}
140	ln -s ../../../sys/$i ${DESTDIR}/usr/include/$i
141.endfor
142	rm -rf ${DESTDIR}/usr/include/machine
143	ln -s ../../sys/${MACHINE_ARCH}/include ${DESTDIR}/usr/include/machine
144
145.include <bsd.prog.mk>
146