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