xref: /freebsd/include/Makefile (revision c4f6a2a9e1b1879b618c436ab4f56ff75c73a0f5)
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD$
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= arpa protocols rpcsvc rpc
11INCS=	a.out.h ar.h assert.h bitstring.h complex.h cpio.h ctype.h db.h \
12	dirent.h \
13	dlfcn.h elf.h elf-hints.h err.h fnmatch.h fmtmsg.h fstab.h \
14	fts.h glob.h grp.h \
15	hesiod.h histedit.h ieeefp.h ifaddrs.h inttypes.h iso646.h kenv.h \
16	langinfo.h \
17	libgen.h limits.h link.h locale.h malloc.h memory.h monetary.h mpool.h \
18	ndbm.h netconfig.h netdb.h nl_types.h nlist.h nsswitch.h objformat.h \
19	paths.h pthread.h pthread_np.h pwd.h \
20	ranlib.h readpassphrase.h regex.h regexp.h resolv.h rune.h runetype.h \
21	search.h setjmp.h sgtty.h \
22	signal.h stab.h stdbool.h stddef.h stdio.h stdlib.h strhash.h \
23	string.h stringlist.h strings.h sysexits.h tar.h time.h timeconv.h \
24	timers.h ttyent.h ulimit.h unistd.h utime.h utmp.h vis.h wchar.h \
25	wctype.h
26
27MHDRS=	float.h floatingpoint.h stdarg.h varargs.h
28
29# posix4/aio.h conflicts with dysons and isn't installed:
30PHDRS=	mqueue.h sched.h semaphore.h # aio.h
31
32LHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
33	termios.h ucontext.h
34
35LDIRS=	cam net netatalk netatm netgraph netinet netinet6 \
36	netipx netkey netnatm netncp netns netsmb nfs nfsclient nfsserver \
37	pccard posix4 sys vm
38
39LSUBDIRS=	cam/scsi dev/ic dev/ppbus dev/usb dev/wi dev/an fs/devfs \
40	fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs fs/nwfs fs/portalfs \
41	fs/procfs fs/smbfs fs/umapfs fs/unionfs isofs/cd9660 \
42	netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
43	security/lomac security/mac_biba security/mac_bsdextended \
44	security/mac_mls ufs/ffs ufs/ufs
45
46# For SHARED=symlinks, cam and netatm are symlinks, so cam/scsi and netatm/*
47# are taken care of
48LSYMSUBDIRS=	${LSUBDIRS:Ncam/scsi:Nnetatm/*}
49
50# Define SHARED to indicate whether you want symbolic links to the system
51# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
52# probably only useful for developers and should be avoided if you do not
53# wish to tie your /usr/include and /usr/src together.
54#SHARED=	symlinks
55SHARED?=	copies
56
57INCS+=	osreldate.h
58
59osreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
60		${.CURDIR}/../sys/sys/param.h \
61		${.CURDIR}/Makefile
62	@${ECHO} creating osreldate.h from newvers.sh
63	setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
64	. ${.CURDIR}/../sys/conf/newvers.sh;			\
65	echo "$$COPYRIGHT" > osreldate.h;			\
66	echo "#ifdef _KERNEL" >> osreldate.h;			\
67	echo '#error "/usr/include/osreldate.h cannot be used in the kernel, use sys/param.h"' >> osreldate.h; \
68	echo "#else" >> osreldate.h;				\
69	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
70	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
71	echo "#endif" >> osreldate.h
72
73.for i in ${LHDRS}
74INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
75.endfor
76.for i in ${MHDRS}
77INCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
78.endfor
79.for i in ${PHDRS}
80INCSLINKS+=	posix4/$i ${INCLUDEDIR}/$i
81.endfor
82
83copies:
84.for i in ${LDIRS} ${LSYMSUBDIRS} machine
85	if [ -h ${DESTDIR}/usr/include/$i ]; then \
86		rm -f ${DESTDIR}/usr/include/$i; \
87	fi
88.endfor
89	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
90		-p ${DESTDIR}/usr/include
91.for i in ${LDIRS} ${LSUBDIRS}
92	cd ${.CURDIR}/../sys; \
93		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
94		${DESTDIR}/usr/include/$i
95.endfor
96.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include)
97	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
98		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
99		${DESTDIR}/usr/include/machine
100.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
101	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
102		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
103		${DESTDIR}/usr/include/machine/pc
104.endif
105.endif
106
107symlinks:
108	@${ECHO} "Setting up symlinks to kernel source tree..."
109.for i in ${LDIRS}
110	rm -rf ${DESTDIR}/usr/include/$i
111	ln -s ../../sys/$i ${DESTDIR}/usr/include/$i
112.endfor
113.for i in ${LSYMSUBDIRS}
114	rm -rf ${DESTDIR}/usr/include/$i
115	ln -s ../../../sys/$i ${DESTDIR}/usr/include/$i
116.endfor
117	rm -rf ${DESTDIR}/usr/include/machine
118	ln -s ../../sys/${MACHINE_ARCH}/include ${DESTDIR}/usr/include/machine
119
120.include <bsd.prog.mk>
121
122installincludes: ${SHARED}
123