xref: /freebsd/include/Makefile (revision 77b7cdf1999ee965ad494fddd184b18f532ac91a)
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 dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
13	fts.h getopt.h glob.h grp.h hesiod.h histedit.h ieeefp.h ifaddrs.h \
14	inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
15	locale.h malloc.h memory.h monetary.h mpool.h ndbm.h netconfig.h \
16	netdb.h nl_types.h nlist.h nss.h nsswitch.h objformat.h paths.h \
17	pthread.h \
18	pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h regexp.h \
19	resolv.h rune.h runetype.h search.h setjmp.h sgtty.h signal.h stab.h \
20	stdbool.h stddef.h stdio.h stdlib.h strhash.h string.h stringlist.h \
21	strings.h sysexits.h tar.h time.h timeconv.h timers.h ttyent.h \
22	ulimit.h unistd.h utime.h utmp.h uuid.h vis.h wchar.h wctype.h \
23	wordexp.h
24
25MHDRS=	float.h floatingpoint.h stdarg.h varargs.h
26
27# posix4/mqueue.h is useless without an implementation and isn't installed:
28PHDRS=	sched.h semaphore.h _semaphore.h # mqueue.h
29
30LHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
31	termios.h ucontext.h
32
33LDIRS=	cam geom net netatalk netatm netgraph netinet netinet6 netipsec \
34	netipx netkey netnatm netncp netsmb nfs nfsclient nfsserver \
35	pccard posix4 sys vm
36
37LSUBDIRS=	cam/scsi dev/an dev/ic dev/iicbus dev/firewire dev/ofw \
38	dev/ppbus dev/smbus dev/usb dev/wi fs/devfs \
39	fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs fs/nwfs fs/portalfs \
40	fs/procfs fs/smbfs fs/umapfs fs/unionfs isofs/cd9660 \
41	netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
42	netgraph/bluetooth/include \
43	security/mac_biba security/mac_bsdextended security/mac_lomac\
44	security/mac_mls security/mac_partition ufs/ffs ufs/ufs
45
46# For SHARED=symlinks, cam, netatm, and netgraph are symlinks, so cam/scsi,
47# netatm/*, and netgraph/* are taken care of
48LSYMSUBDIRS=	${LSUBDIRS:Ncam/scsi:Nnetatm/*:Nnetgraph/*}
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 crypto
85	if [ -L ${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	cd ${.CURDIR}/../sys; \
97		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 opencrypto/*.h \
98		${DESTDIR}/usr/include/crypto
99.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include)
100	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
101		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
102		${DESTDIR}/usr/include/machine
103.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
104	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
105		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
106		${DESTDIR}/usr/include/machine/pc
107.endif
108.endif
109
110symlinks:
111	@${ECHO} "Setting up symlinks to kernel source tree..."
112.for i in ${LDIRS}
113	rm -rf ${DESTDIR}/usr/include/$i
114	ln -s ../../sys/$i ${DESTDIR}/usr/include/$i
115.endfor
116	rm -rf ${DESTDIR}/usr/include/crypto
117	ln -s ../../sys/opencrypto ${DESTDIR}/usr/include/crypto
118.for i in ${LSYMSUBDIRS}
119	rm -rf ${DESTDIR}/usr/include/$i
120	ln -s ../../../sys/$i ${DESTDIR}/usr/include/$i
121.endfor
122	rm -rf ${DESTDIR}/usr/include/machine
123	ln -s ../../sys/${MACHINE_ARCH}/include ${DESTDIR}/usr/include/machine
124
125.include <bsd.prog.mk>
126
127installincludes: ${SHARED}
128