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