xref: /freebsd/include/Makefile (revision 9608d7e2cd58c1a7fff6562810f2ce519e6ec50a)
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD$
3#
4# Doing a "make install" builds /usr/include.
5
6CLEANFILES= osreldate.h version vers.c
7SUBDIR= arpa protocols rpcsvc rpc
8INCS=	a.out.h ar.h assert.h bitstring.h complex.h cpio.h ctype.h db.h \
9	dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
10	fts.h getopt.h glob.h grp.h hesiod.h histedit.h ieeefp.h ifaddrs.h \
11	inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
12	locale.h malloc.h memory.h monetary.h mpool.h ndbm.h netconfig.h \
13	netdb.h nl_types.h nlist.h nss.h nsswitch.h objformat.h paths.h \
14	pthread.h \
15	pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h regexp.h \
16	resolv.h rune.h runetype.h search.h setjmp.h sgtty.h signal.h stab.h \
17	stdbool.h stddef.h stdio.h stdlib.h string.h stringlist.h \
18	strings.h sysexits.h tar.h time.h timeconv.h timers.h ttyent.h \
19	ulimit.h unistd.h utime.h utmp.h uuid.h varargs.h vis.h wchar.h \
20	wctype.h wordexp.h
21
22MHDRS=	float.h floatingpoint.h stdarg.h
23
24# posix4/mqueue.h is useless without an implementation and isn't installed:
25PHDRS=	sched.h semaphore.h _semaphore.h # mqueue.h
26
27LHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
28	termios.h ucontext.h
29
30LDIRS=	cam geom net net80211 netatalk netatm netgraph netinet netinet6 \
31	netipsec netipx netkey netnatm netncp netsmb nfs nfsclient nfsserver \
32	pccard posix4 sys vm
33
34LSUBDIRS=	cam/scsi dev/an dev/bktr dev/firewire dev/ic dev/iicbus \
35	dev/ofw dev/ppbus dev/smbus dev/usb dev/wi dev/utopia fs/devfs \
36	fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs fs/nwfs fs/portalfs \
37	fs/procfs fs/smbfs fs/udf fs/umapfs fs/unionfs isofs/cd9660 \
38	netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
39	netgraph/atm security/mac_biba security/mac_bsdextended \
40	security/mac_lomac security/mac_mls security/mac_partition \
41	ufs/ffs ufs/ufs
42
43.if !defined(NO_BLUETOOTH)
44LSUBSUBDIRS=	netgraph/bluetooth/include
45.endif
46
47# Define SHARED to indicate whether you want symbolic links to the system
48# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
49# probably only useful for developers and should be avoided if you do not
50# wish to tie your /usr/include and /usr/src together.
51#SHARED=	symlinks
52SHARED?=	copies
53
54INCS+=	osreldate.h
55
56osreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
57		${.CURDIR}/../sys/sys/param.h \
58		${.CURDIR}/Makefile
59	@${ECHO} creating osreldate.h from newvers.sh
60	@setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
61	. ${.CURDIR}/../sys/conf/newvers.sh;			\
62	echo "$$COPYRIGHT" > osreldate.h;			\
63	echo "#ifdef _KERNEL" >> osreldate.h;			\
64	echo '#error "<osreldate.h> cannot be used in the kernel, use <sys/param.h>"' >> osreldate.h; \
65	echo "#else" >> osreldate.h;				\
66	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
67	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
68	echo "#endif" >> osreldate.h
69
70.for i in ${LHDRS}
71INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
72.endfor
73.for i in ${MHDRS}
74INCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
75.endfor
76.for i in ${PHDRS}
77INCSLINKS+=	posix4/$i ${INCLUDEDIR}/$i
78.endfor
79
80.include <bsd.prog.mk>
81
82installincludes: ${SHARED}
83${SHARED}: compat
84
85# Take care of stale directory-level symlinks.
86compat:
87.for i in ${LDIRS} ${LSUBDIRS} machine crypto
88	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
89		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
90	fi
91.endfor
92	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
93	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
94	    -p ${DESTDIR}${INCLUDEDIR}
95
96copies:
97.for i in ${LDIRS} ${LSUBDIRS} crypto machine machine/pc
98.if exists(${DESTDIR}${INCLUDEDIR}/$i)
99	cd ${DESTDIR}${INCLUDEDIR}/$i; \
100	for h in *.h; do \
101		if [ -L $$h ]; then rm -f $$h; fi; \
102	done
103.endif
104.endfor
105.for i in ${LDIRS} ${LSUBDIRS:Ndev/bktr} ${LSUBSUBDIRS}
106	cd ${.CURDIR}/../sys; \
107	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
108	    ${DESTDIR}${INCLUDEDIR}/$i
109.endfor
110	cd ${.CURDIR}/../sys/dev/bktr; \
111	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
112	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
113	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
114	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
115	    ${DESTDIR}${INCLUDEDIR}/netinet
116	cd ${.CURDIR}/../sys/opencrypto; \
117	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
118	    ${DESTDIR}${INCLUDEDIR}/crypto
119	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
120	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
121	    ${DESTDIR}${INCLUDEDIR}/machine
122.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
123	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
124	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
125	    ${DESTDIR}${INCLUDEDIR}/machine/pc
126.endif
127
128symlinks:
129	@${ECHO} "Setting up symlinks to kernel source tree..."
130.for i in ${LDIRS}
131	cd ${.CURDIR}/../sys/$i; \
132	for h in *.h; do \
133		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
134	done
135.endfor
136.for i in ${LSUBDIRS}
137	cd ${.CURDIR}/../sys/$i; \
138	for h in *.h; do \
139		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
140	done
141.endfor
142.for i in ${LSUBSUBDIRS}
143	cd ${.CURDIR}/../sys/$i; \
144	for h in *.h; do \
145		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
146	done
147.endfor
148	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
149	for h in *.h; do \
150		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
151		    ${DESTDIR}${INCLUDEDIR}/netinet; \
152	done
153	cd ${.CURDIR}/../sys/opencrypto; \
154	for h in *.h; do \
155		ln -fs ../../../sys/opencrypto/$$h \
156		    ${DESTDIR}${INCLUDEDIR}/crypto; \
157	done
158	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
159	for h in *.h; do \
160		ln -fs ../../../sys/${MACHINE_ARCH}/include/$$h \
161		    ${DESTDIR}${INCLUDEDIR}/machine; \
162	done
163.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
164	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
165	for h in *.h; do \
166		ln -fs ../../../../sys/${MACHINE_ARCH}/include/pc/$$h \
167		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
168	done
169.endif
170