xref: /freebsd/include/Makefile (revision aed23bc4ceaab17b4717b9f4dab300cd372f801b)
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 getopt.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,
30# posix4/mqueue.h is useless without an implementation and isn't installed:
31PHDRS=	sched.h semaphore.h _semaphore.h # aio.h mqueue.h
32
33LHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
34	termios.h ucontext.h
35
36LDIRS=	cam net netatalk netatm netgraph netinet netinet6 \
37	netipx netkey netnatm netncp netns netsmb nfs nfsclient nfsserver \
38	pccard posix4 sys vm
39
40LSUBDIRS=	cam/scsi dev/an dev/ic dev/iicbus dev/ppbus dev/smbus \
41	dev/usb dev/wi fs/devfs \
42	fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs fs/nwfs fs/portalfs \
43	fs/procfs fs/smbfs fs/umapfs fs/unionfs isofs/cd9660 \
44	netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
45	security/lomac security/mac_biba security/mac_bsdextended \
46	security/mac_mls ufs/ffs ufs/ufs
47
48# For SHARED=symlinks, cam and netatm are symlinks, so cam/scsi and netatm/*
49# are taken care of
50LSYMSUBDIRS=	${LSUBDIRS:Ncam/scsi:Nnetatm/*}
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
59INCS+=	osreldate.h
60
61osreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
62		${.CURDIR}/../sys/sys/param.h \
63		${.CURDIR}/Makefile
64	@${ECHO} creating osreldate.h from newvers.sh
65	setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
66	. ${.CURDIR}/../sys/conf/newvers.sh;			\
67	echo "$$COPYRIGHT" > osreldate.h;			\
68	echo "#ifdef _KERNEL" >> osreldate.h;			\
69	echo '#error "/usr/include/osreldate.h cannot be used in the kernel, use sys/param.h"' >> osreldate.h; \
70	echo "#else" >> osreldate.h;				\
71	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
72	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
73	echo "#endif" >> osreldate.h
74
75.for i in ${LHDRS}
76INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
77.endfor
78.for i in ${MHDRS}
79INCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
80.endfor
81.for i in ${PHDRS}
82INCSLINKS+=	posix4/$i ${INCLUDEDIR}/$i
83.endfor
84
85copies:
86.for i in ${LDIRS} ${LSYMSUBDIRS} machine
87	if [ -L ${DESTDIR}/usr/include/$i ]; then \
88		rm -f ${DESTDIR}/usr/include/$i; \
89	fi
90.endfor
91	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
92		-p ${DESTDIR}/usr/include
93.for i in ${LDIRS} ${LSUBDIRS}
94	cd ${.CURDIR}/../sys; \
95		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
96		${DESTDIR}/usr/include/$i
97.endfor
98.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include)
99	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
100		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
101		${DESTDIR}/usr/include/machine
102.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
103	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
104		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
105		${DESTDIR}/usr/include/machine/pc
106.endif
107.endif
108
109symlinks:
110	@${ECHO} "Setting up symlinks to kernel source tree..."
111.for i in ${LDIRS}
112	rm -rf ${DESTDIR}/usr/include/$i
113	ln -s ../../sys/$i ${DESTDIR}/usr/include/$i
114.endfor
115.for i in ${LSYMSUBDIRS}
116	rm -rf ${DESTDIR}/usr/include/$i
117	ln -s ../../../sys/$i ${DESTDIR}/usr/include/$i
118.endfor
119	rm -rf ${DESTDIR}/usr/include/machine
120	ln -s ../../sys/${MACHINE_ARCH}/include ${DESTDIR}/usr/include/machine
121
122.include <bsd.prog.mk>
123
124installincludes: ${SHARED}
125