xref: /freebsd/include/Makefile (revision a246f097d608ffd15198c0933258e5cd2604c1f8)
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 ftw.h getopt.h glob.h grp.h \
11	hesiod.h histedit.h ieeefp.h ifaddrs.h \
12	inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
13	locale.h malloc.h memory.h monetary.h mpool.h ndbm.h netconfig.h \
14	netdb.h nl_types.h nlist.h nss.h nsswitch.h objformat.h paths.h \
15	proc_service.h pthread.h \
16	pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h regexp.h \
17	resolv.h rune.h runetype.h search.h setjmp.h sgtty.h signal.h stab.h \
18	stdbool.h stddef.h stdio.h stdlib.h string.h stringlist.h \
19	strings.h sysexits.h tar.h tgmath.h \
20	time.h timeconv.h timers.h ttyent.h \
21	ulimit.h unistd.h utime.h utmp.h uuid.h varargs.h vis.h wchar.h \
22	wctype.h wordexp.h
23
24MHDRS=	float.h floatingpoint.h stdarg.h
25
26# posix4/mqueue.h is useless without an implementation and isn't installed:
27PHDRS=	sched.h semaphore.h _semaphore.h # mqueue.h
28
29LHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
30	termios.h ucontext.h
31
32LDIRS=	cam geom net net80211 netatalk netatm netgraph netinet netinet6 \
33	netipsec netipx netkey netnatm netncp netsmb nfs nfsclient nfsserver \
34	pccard posix4 sys vm
35
36LSUBDIRS=	cam/scsi dev/an dev/bktr dev/firewire dev/ic dev/iicbus \
37	dev/ofw dev/ppbus dev/smbus dev/usb dev/wi dev/utopia fs/devfs \
38	fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs fs/nwfs fs/portalfs \
39	fs/procfs fs/smbfs fs/udf fs/umapfs fs/unionfs \
40	geom/concat geom/gate geom/label geom/mirror geom/nop geom/stripe \
41	isofs/cd9660 netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
42	netgraph/atm security/mac_biba security/mac_bsdextended \
43	security/mac_lomac security/mac_mls security/mac_partition \
44	ufs/ffs ufs/ufs
45
46.if !defined(NO_BLUETOOTH)
47LSUBSUBDIRS=	netgraph/bluetooth/include
48.endif
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 "<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
83.include <bsd.prog.mk>
84
85installincludes: ${SHARED}
86${SHARED}: compat
87
88# Take care of stale directory-level symlinks.
89compat:
90.for i in ${LDIRS} ${LSUBDIRS} machine crypto
91	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
92		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
93	fi
94.endfor
95	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
96	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
97	    -p ${DESTDIR}${INCLUDEDIR}
98
99copies:
100.for i in ${LDIRS} ${LSUBDIRS} crypto machine machine/pc
101.if exists(${DESTDIR}${INCLUDEDIR}/$i)
102	cd ${DESTDIR}${INCLUDEDIR}/$i; \
103	for h in *.h; do \
104		if [ -L $$h ]; then rm -f $$h; fi; \
105	done
106.endif
107.endfor
108.for i in ${LDIRS} ${LSUBDIRS:Ndev/bktr} ${LSUBSUBDIRS}
109	cd ${.CURDIR}/../sys; \
110	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
111	    ${DESTDIR}${INCLUDEDIR}/$i
112.endfor
113	cd ${.CURDIR}/../sys/dev/bktr; \
114	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
115	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
116	cd ${.CURDIR}/../sys/contrib/altq/altq; \
117	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
118	    ${DESTDIR}${INCLUDEDIR}/altq
119	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
120	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
121	    ${DESTDIR}${INCLUDEDIR}/netinet
122	cd ${.CURDIR}/../sys/contrib/pf/net; \
123	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
124	    ${DESTDIR}${INCLUDEDIR}/net
125	cd ${.CURDIR}/../sys/opencrypto; \
126	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
127	    ${DESTDIR}${INCLUDEDIR}/crypto
128	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
129	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
130	    ${DESTDIR}${INCLUDEDIR}/machine
131.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
132	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
133	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
134	    ${DESTDIR}${INCLUDEDIR}/machine/pc
135.endif
136
137symlinks:
138	@${ECHO} "Setting up symlinks to kernel source tree..."
139.for i in ${LDIRS}
140	cd ${.CURDIR}/../sys/$i; \
141	for h in *.h; do \
142		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
143	done
144.endfor
145.for i in ${LSUBDIRS}
146	cd ${.CURDIR}/../sys/$i; \
147	for h in *.h; do \
148		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
149	done
150.endfor
151.for i in ${LSUBSUBDIRS}
152	cd ${.CURDIR}/../sys/$i; \
153	for h in *.h; do \
154		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
155	done
156.endfor
157	cd ${.CURDIR}/../sys/contrib/altq/altq; \
158	for h in *.h; do \
159		ln -fs ../../../sys/contrib/altq/altq/$$h \
160		    ${DESTDIR}${INCLUDEDIR}/altq; \
161	done
162	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
163	for h in *.h; do \
164		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
165		    ${DESTDIR}${INCLUDEDIR}/netinet; \
166	done
167	cd ${.CURDIR}/../sys/contrib/pf/net; \
168	for h in *.h; do \
169		ln -fs ../../../sys/contrib/pf/net/$$h \
170		    ${DESTDIR}${INCLUDEDIR}/net; \
171	done
172	cd ${.CURDIR}/../sys/opencrypto; \
173	for h in *.h; do \
174		ln -fs ../../../sys/opencrypto/$$h \
175		    ${DESTDIR}${INCLUDEDIR}/crypto; \
176	done
177	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
178	for h in *.h; do \
179		ln -fs ../../../sys/${MACHINE_ARCH}/include/$$h \
180		    ${DESTDIR}${INCLUDEDIR}/machine; \
181	done
182.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
183	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
184	for h in *.h; do \
185		ln -fs ../../../../sys/${MACHINE_ARCH}/include/pc/$$h \
186		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
187	done
188.endif
189